Login | Register
My pages Projects Community openCollabNet

A.2.  Included Source Code Comment Processing

[ fromfile: grammar.xml id: commentprocessing ]

Comments, when formatted a certain way, will be processed by Slacker's Docbook allowing you to do the following:

  • Using //start and //end comments, you can trim the included code so you only show in the book the relevant snippet.

  • Using //start id=idName, you can give IDs to different snippets of code in the same source file, and refer to them from an <include segid="idName"> the XML file.

  • Reformat multiline comments that come after non-whitespace as numbered "callouts" where the comments show up in a numbered list after the program listing.

For languages where the comment character is a # instead of a // (Python, Bash, Perl), Slacker's Docbook also supports #start and #end comments.