Red Hat Bugzilla – Bug 653432
line numbering of <programlisting> broken
Last modified: 2011-07-25 20:42:37 EDT
This applies to publican 2.3:
if the linenumbering="numbered" attribute is being set, various problems occur:
* syntax highlighting (via language attribute) no longer works
* line numbering starts a 0 (startinglinenumber not honoured anyway)
* if the content contains < and & (either via CDATA or numeric entities),
they are literally interpreted as XML, causing parsing errors
The problems can be traced down to the numberLines function in Builder.pm:
* the node list converted to a string. I guess that syntax highlighting
happens before, so all generated markup is lost due to this conversion
* the $count variable is initialized to zero, the line number generation
uses $count++, causing the 0
* the augmented content is then converted back to a document fragment by simply
parsing the content with an XML parser. As special characters (<, &)
are not escaped, they are interpreted as XML
Hi Klaus, I've committed fixes to startinglinenumber and the use of <, >, etc.
The code highlight fix will take a bit longer, the modified tree isn't being passed to the function so I'll need to track down why it's getting stale data passed in from XSLT.
I've cloned this bug to separate the line numbering and sql escaping (this bug) from the line numbering + highlighting not working (717817)
back ported fix to branches/publican-2x
Verified in build 2.5-2.fc15.t14
linenumbering and startinglinenumber attributes working as expected; < and > correctly escaped.