CodeExample plugin for Trac version 1.0 has been released

The CodeExample renders a code example box that supports syntax highlighting. It support three types of examples: simple, correct, and incorrect.

I've made the major changes to the plugin and now it is fully compatible with Trac 0.11 and Trac 0.12.

Changelog from version 0.3:

  • Support for multiply repositories (Trac 0.12 and upper) has been added.
  • Collapsing/expanding code blocks have been implemented.
  • Ability to change title has been added.
  • Options using has been reimplemented.

Two examples (the first gets source from repository, the second contains the code inside):

{{{
#!CodeExample
## type = good
## title = GPGData sample code
## repo = MacGPGME
## path=GPGData.m
## regex="static void releaseCallback\(.*"
## lines=4
#!objective-c
}}}

{{{
#!CodeExample
## type = bad
#!haskell
fibs = 0 : 1 : [ a + b | a <- fibs | b <- tail fibs ]
}}}

These will be rendered as:


See details on trac-hacks CodeExampleMacro page.

Comments

Popular posts from this blog

Web application framework comparison by memory consumption

Trac Ticket Workflow

Python vs JS vs PHP for embedded systems