Bug 653432 - line numbering of <programlisting> broken
Summary: line numbering of <programlisting> broken
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Publican
Classification: Community
Component: publican
Version: 2.3
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Jeff Fearn 🐞
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-11-15 12:56 UTC by Klaus.Malorny
Modified: 2011-07-26 00:42 UTC (History)
4 users (show)

Fixed In Version: 2.6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 718717 (view as bug list)
Environment:
Last Closed: 2011-07-26 00:42:37 UTC
Embargoed:


Attachments (Terms of Use)

Description Klaus.Malorny 2010-11-15 12:56:36 UTC
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 11:11:40 UTC
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 12:01:23 UTC
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 04:38:47 UTC
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.