OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] computeroutput vs screen vs xmllint


Bonjour Mathieu,

On Tue, Sep 11, 2012 at 10:01 AM, Stefan Hinz <stefan.hinz@oracle.com> wrote:
    We are internally using different docbook editors (vi, emacs, serna
and xmlmind). To some extent, we would like to preserve a nice and
clear history of revision of our XML files in SVN (subversion). For
this we use a script based on xmllint --format to reformat to a unique
presentation. This has work quite well until today. Could someone
please let me know if the following situation is an issue with either
XML or docbook itself:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";>
<article>
    <section>
      <title>Introduction</title>
      <para>Before</para>
      <screen><computeroutput>a.txt
b.txt
</computeroutput>
</screen>
      <para>After</para>
    </section>
</article>

while xmllint --format prefers:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";>
<article>
    <section>
      <title>Introduction</title>
      <para>Before</para>
      <screen>
        <computeroutput>a.txt
b.txt
</computeroutput>
      </screen>
      <para>After</para>
    </section>
</article>


The latter is wrong. Stuff within "verbatim" containers such as <screen> or
<programlisting> shouldn't be re-formatted at all, but rather preserved as
is.

I'd suggest using Paul DuBois' XML Formatter which does what it's supposed
to do. It's included in many Linux distros already, but if it's not in yours
(or if you're not using Linux) you can find it here:

http://www.kitebird.com/software/xmlformat/

$ wget http://www.kitebird.com/software/xmlformat/xmlformat-1.04.tar.gz
$ tar xvfz xmlformat-1.04.tar.gz
$ cd xmlformat-1.04
$ cp xmlformat.pl /usr/local/bin/xmlformat
$ xmlformat input.xml > new.xml
$ cat new.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";>
<article>
  <section>
   <title>Introduction</title>
   <para>Before</para>
   <screen>
    <computeroutput>a.txt
b.txt
</computeroutput>
   </screen>
   <para>After</para>
  </section>
</article>


This is *exactly* what I am trying to avoid. xmllint and xmlformat
seems to produce the exact same output. Is it working as supposed on
your machine ? Which version are you using ?

Darn, sorry for that. :-(

I guess xmlformat-1.04 still doesn't include the setting it includes in our setup here:

atlas~/svn/mysqldoc-toolset/tools> grep screen xmlformat.conf
programlisting literallayout synopsis screen

In other words, add "screen" to the respective line of xmlformat.conf, and things should work properly.

--
Cheers,

Stefan Hinz <stefan.hinz@oracle.com>, MySQL Documentation Manager

Phone: +49-30-82702940, Fax: +49-30-82702941, http://dev.mysql.com/doc

ORACLE Deutschland B.V.&  Co. KG
Registered Office: Riesstr. 25, 80992 Muenchen, Germany
Commercial Register: Local Court Of Munich, HRA 95603
Managing Director: Jürgen Kunz

General Partner: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Register Of Chamber Of Commerce: Midden-Niederlande, No. 30143697
Managing Directors: Alexander van der Ven, Astrid Kepper, Val Maher


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]