Bug 461369 - Publican incorrectly formats programlisting and screen sections
Publican incorrectly formats programlisting and screen sections
Status: CLOSED CURRENTRELEASE
Product: Publican
Classification: Community
Component: publican (Show other bugs)
1.6
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Fearn
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-09-06 16:15 EDT by Jared Smith
Modified: 2010-11-23 23:19 EST (History)
3 users (show)

See Also:
Fixed In Version: 0.38
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-09-08 23:42:36 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
The generated HTML page (5.09 KB, text/html)
2008-09-06 16:15 EDT, Jared Smith
no flags Details
The generated PDF file (61.44 KB, application/pdf)
2008-09-06 16:19 EDT, Jared Smith
no flags Details

  None (edit)
Description Jared Smith 2008-09-06 16:15:57 EDT
Created attachment 315955 [details]
The generated HTML page

Description of problem:

Publican incorrectly formats <programlisting> and <screen> sections in DocBook.  As explained in both http://docbook.org/tdg/en/html/programlisting.html and http://docbook.org/tdg/en/html/screen.html, all whitespace and line breaks in those sections are significant and must be preserved.  The current version of publican does not preserve line-breaks correctly in either of these tags.

Version-Release number of selected component (if applicable):

publican-0.34-0.fc9.noarch

How reproducible:

Always

Steps to Reproduce:
1.  Add the following section to a default Publican document (I did it in an article):

<programlisting format="linespecific"><computeroutput>[root@localhost ~]# </computeroutput><userinput>mkdir /tmp/one</userinput>
<computeroutput>[root@localhost ~]# </computeroutput><userinput>mkdir /tmp/two</userinput>
<computeroutput>[root@localhost ~]# </computeroutput><userinput>mkdir /tmp/three</userinput></programlisting>

2. Create both PDF and HTML versions of the document
3. Notice how the line breaks are not correct.  The PDF doesn't add line breaks where they belong, and the HTML adds extra line breaks and extra indents.
  
Actual results:

See the attached files... I'm attaching both a PDF and HTML version.

Expected results:

Three individual lines, that look like:

[root@localhost ~]# mkdir /tmp/one
[root@localhost ~]# mkdir /tmp/two
[root@localhost ~]# mkdir /tmp/three

Additional info:

I tried out the "Fedora" branding in publican as well, and it suffered from the same formatting problems.
Comment 1 Jared Smith 2008-09-06 16:19:06 EDT
Created attachment 315956 [details]
The generated PDF file
Comment 2 Jared Smith 2008-09-07 07:34:25 EDT
Murray McAllister kindly pointed out that this bug is probably related to bug #461221.
Comment 3 Jeff Fearn 2008-09-08 23:42:36 EDT
Non-verbatim tags are fully entitled to munch you white space, even when nested inside verbatim tags.
Comment 4 Jeff Fearn 2008-09-19 03:17:45 EDT
This was a bug!

The new line was being removed from the verbatim tag itself and not from an inline tag within the verbatim tag.

e.g. 1

This will, correctly, have it's new line removed because computeroutput is an inline tag and inline tags never, ever, EVER respect white space:

<screen><computeroutput>
Preparing...                ######################################### [100%]   
   1:foo                    ######################################### [100%]</computeroutput></screen>

e.g. 2

This would have it's new line removed because the userinput tag swallowed up the following new line:

<programlisting>
[root@localhost ~]# <userinput>mkdir /tmp/one</userinput>
[root@localhost ~]# <userinput>mkdir /tmp/two</userinput>
</programlisting>

This second is a bug because the new line is in the verbatim screen tag and not inside the inline userinput tag.

Changed white space munching code to respect new lines directly in verbatim tags regardless of what precedes them.
Comment 5 Jared Smith 2008-09-20 01:18:35 EDT
Thanks for revisiting this one, Jeff!
Comment 6 Fedora Update System 2008-10-16 18:43:33 EDT
publican-0.38-0.fc9,perl-XML-TreeBuilder-3.09-11.fc9 has been submitted as an update for Fedora 9.
http://admin.fedoraproject.org/updates/publican-0.38-0.fc9,perl-XML-TreeBuilder-3.09-11.fc9
Comment 7 Fedora Update System 2008-11-06 21:54:49 EST
publican-0.38-0.fc9, perl-XML-TreeBuilder-3.09-11.fc9 has been pushed to the Fedora 9 stable repository.  If problems still persist, please make note of it in this bug report.

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