C++ source wiki entry

The other day I wanted to put up some code for the oop344 wiki and I was having a heck of a time.  I just couldn’t get it to format it correctly when I used <code></code>.  This was likely because the code I had used templates which of course looks like:

template <class T>
class Obj{
  //blah blah
};

It seemed like the <> for the template statement was confusing the wiki editor.  In any case after doing some searching I’ve discovered the wiki software we use actually supports the <source> tags.  I put all my code (cut/paste no editing) in <source lang=”cpp”> tags and it came out really nice with coloured formatting :).  Just thought I’d share this with other people trying put up source on our wiki pages.  Other languages are also supported but I haven’t actually tried it.  Check out the nicely highlighted code here 😛

Advertisements

2 responses to “C++ source wiki entry

  1. Hey Cathy,
    On a similar note, I recently learned how to do syntax highlighting in WordPress, just use

     var foo; 

    It looks much better than using code or pre tags:
    http://asalga.wordpress.com/2010/05/29/querying-webgl-commands-and-symbols/

  2. Awesome! I just injected formatting into my post, one more try:

    Wrap the two lines using square brackets:

    sourcecode language=”javascript”
    /sourcecode

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s