in reply to Re: RFC: Almost a Book
in thread RFC: Almost a Book
There is a lot of support code for the listings however. I use PPI to transform the perl source into XML, with line number and "changed since last version" (delta="Y/N") attributes, then use XML::LibXML to search the listings with XPath. I pre-cache references to subroutines like this:
<cache-sub key="rep0" src="PScm-0.0.0/lib/PScm.xml" pkg="PScm" sub="ReadEvalPrint" />
Then displaying a sub is just:
Also when I want to refer to a line I say:<subsample key="rep0"/>
<pl>ReadEvalPrint()</pl> on <lineno-of-sub key="rep0"/> is the central control routine of the whole interpreter. It takes an input file handle and an output file handle as arguments. Starting on <lineno-of-var key="rep0" var="*STDOUT"/> it defaults the output file handle to <pl>STDOUT</pl>, ...
Also the delta attributes allow the text that changed from the previous version to be hilighted.
The upshot of all of this is that the book is pulling the code listings directly out of a working application under CVS, I don't have to cut'n'paste anything, and changes to the codebase are immediately reflected in the book. I was quite pleased about that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: RFC: Almost a Book
by wolv (Pilgrim) on Apr 19, 2006 at 11:39 UTC |