Description

I used the 'Render as Docbook' menu item to generate the XML for a page in my local wiki. The page contains {{{#!highlight python... }}} code areas. I save the XML to a file. I try to use dblatex on it to generate a PDF, but the 'language' attribute of the '<programlisting>' tags are set to "highlight" instead of "python". The causes the dblatex step to fail because it does not understand "highlight" as a language.

Steps to reproduce

  1. Create a page that contains some python code with highlighting turned on.

= Highlight Test =
{{{#!highlight python
class Foo():
    pass
}}}
  1. Use the 'Render as Docbook' menu item to generate the XML for the page and save it to a file such as page.xml.

  2. Run dblatex on the file: dblatex -T simple -o page.pdf page.xml

  3. Note the errors in the output regarding the language

Example

Component selection

Details

MoinMoin Version

1.9.8

OS and Version

Debian Testing (Debian 8.0)

Python Version

2.7.8

Server Setup

Debian Testing (Debian 8.0)/Apache 2

Server Details

Python 2.7.8

Language you are using the wiki in (set in the browser/UserPreferences)

English

Workaround

I created a bash script that changes language="highlight" to language="python" in the XML using sed and then runs dblatex on the new XML to get a proper PDF.

   1 #!/bin/bash
   2 xml_file=${1}
   3 pdf_file=${xml_file%%.xml}.pdf
   4 new_xml_file=${xml_file%%.xml}_new.xml
   5 
   6 sed -e 's/language="highlight"/language="python"/' < ${xml_file} > ${new_xml_file}
   7 
   8 dblatex -T simple -o ${pdf_file} ${new_xml_file}

I also created a Python script which does a similar thing, but works with the XML tree so that it won't change user text that actually contains language="highlight".

Discussion

We have no developer using docbook and working on moin 1.9.x currently, so patches are welcome!

I added a patch to the attachments. The patch was created from the moin-1.9 repository. I tested it with:

They all worked as expected.

Plan


CategoryMoinMoinBug

MoinMoin: MoinMoinBugs/RenderAsDocbookXmlFailsPdfGenBecauseLangEqualHighlight (last edited 2015-02-04 23:09:34 by Vincent Vega)