Bug 653432 - line numbering of <programlisting> broken
line numbering of <programlisting> broken
Product: Publican
Classification: Community
Component: publican (Show other bugs)
Unspecified Unspecified
low Severity medium
: ---
: ---
Assigned To: Jeff Fearn
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2010-11-15 07:56 EST by Klaus.Malorny
Modified: 2011-07-25 20:42 EDT (History)
4 users (show)

See Also:
Fixed In Version: 2.6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 718717 (view as bug list)
Last Closed: 2011-07-25 20:42:37 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Klaus.Malorny 2010-11-15 07:56:36 EST
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
Comment 1 Jeff Fearn 2011-03-13 07:11:40 EDT
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.
Comment 2 Jeff Fearn 2011-07-04 08:01:23 EDT
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
Comment 3 Ruediger Landmann 2011-07-18 00:38:47 EDT
Verified in build 2.5-2.fc15.t14

linenumbering and startinglinenumber attributes working as expected; < and > correctly escaped.

Note You need to log in before you can comment on or make changes to this bug.