How to Paste Source Code into a WordPress Blog Posting

This feature makes use of Alex Gorbatchev’s open-source program SyntaxHighlighter (please note that alexgorbatchev.com/pub/sh/current/styles must be accessible for the formatting to work).

When creating a blog post, click on the “Edit HTML” tab, and enclose your code snippet in the following tags…

[sourcecode language=”xml”]
your code here
[/sourcecode]

Some examples of commonly used languages:

Formatted using the xml formatter

<group>
<data>Some test data</data>
<data>Some more data</data>
</group>

Formatted using the jscript formatter

<title>Test Page</title>

<script type="text/javascript" language="JavaScript">
  document.cookie = "OADiagnostic=1";
  document.cookie = "OADeveloperMode=0";
  document.cookie = "OAPassivationTestMode=0";
  document.cookie = "OAConnectionTestMode=0";
  document.cookie = "OADumpUIXTree=0";
</script>

Formatted using the bash formatter

f_Custom_Request()
{
  PROCESS="CUSTREQ"
  echo "Submitting Concurrent Request "`date +%H:%M:%S`
  echo " \n"
  CONCSUB_MSG=`CONCSUB $CONNECT C4AP \"$RESPNAME\" $USERNAME WAIT=Y CONCURRENT AP AP132`
  echo "$CONCSUB_MSG"
  echo " \n"
  REQUEST_ID=`echo $CONCSUB_MSG | cut -d" " -f3`
  NORMAL=`echo $CONCSUB_MSG | cut -d" " -f8`
  f_Check_Error
  #v3.0
  #f_Send_Email
  echo "Concurrent request C4 AP BTC Invoice Load completed sucessfully at "`date +%H:%M:%S`
  echo " \n"
  SEQ=1
  FILENAME=$CAT_INV_FILE
  STEP="USER"
  INTRESU="'Success'"
  RECS="NA"
  REVIEW="No"
  function_fnd004
}
Formatted using the sql formatter

SELECT user_id
,      user_name
FROM   fnd_user
WHERE  last_update_date > TO_DATE('07/04/2011','DD/MM/YYYY')
;
Formatted using the css formatter

/* ########## CSS for .com ########## */

html
  {
  height: 100%;
  max-height: 100%;
  padding:0;
  margin:0;
  border:0;
  background-color: rgb(209,205,193);
  background: url(images/small-grid.gif);
  z-index: 0;
  }

body
  {
  height:100%;
  max-height:100%;
/*overflow:hidden;*/
  padding:0;
  margin:0;
  border:0;
  font-family: Verdana, Helvetica, Arial, sans-serif;
  background-color: rgb(209,205,193); /* #7DA5D8; #E2EDFF; */
  background: url(images/small-grid.gif);
  line-height: 100%;
  z-index: 1;
  }
Formatted using the java formatter

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    ClientUtil.writeLogProcedure(pageContext, this,
                                "Entering processFormRequest");

    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    String pgEvent = pageContext.getParameter(EVENT_PARAM);

    if(pageContext.getParameter("MatchBtn") != null)
      {
      am.invokeMethod("matchPOLines");
      }
    else if(pageContext.getParameter("AddPOLineBtn") != null)
      {
      am.invokeMethod("addSinglePOLine");
      }
    else if(pageContext.getParameter("AddAllPOLinesBtn") != null)
      {
      am.invokeMethod("addAllPOLines");
      }         }

      ClientUtil.writeLogProcedure(pageContext, this,
                                   "Leaving processFormRequest");
  }

The following languages are supported:

actionscript3
bash
coldfusion
cpp
csharp
css
delphi
erlang
fsharp
diff
groovy
html
javascript
java
javafx
matlab (keywords only)
objc
perl
php
text
powershell
python
r
ruby
scala
sql
vb
xml

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s