Le mer. 02 janv. 2013 à 18:09:08 +1300, Stuart Rackham a écrit :
> Hi Julien
Hi Stuart

> Thank you for the patch, I did see it but glossed over it because it was
> quite large and there was no explanation or use cases as to why it was
> necessary.
> 
> I'm guessing its purpose is to allow the AsciiDoc '+' line breaks to
> work when generating roff formatted man pages.
yes, as I said back then:
> Joined is a patch that tries to handle line breaks in manpage output.

> The patch is non-trivial (it increases the code size in manpage.xsl by 5x)
sure it's non-trivial, but so is the problem to solve;

Well, first, as annotated, there is an (elegant) use of <xsl:key/>
to gather nodes placed after each <?asciidoc-br?>,
then two case-switching <xsl:template/>s,
to put ROFF newlines around normalize-space()'d nodes
respectively placed after <?asciidoc-br?> or placed after and before
when it is the first <?asciidoc-br?> in the <simpara/>,
both in mode="asciidoc-br", to control when they apply
and remove their input nodes with a third <xsl:template/>.

The effective code is only 50 lines long,
the remaining code being, as annotated, an ugly copy/paste/fix
of docbook-xsl/manpages/{block,lists}.xsl own code,
as I did not find a better way to avoid a few normalize-space() calls
and to apply the case-switching <xsl:template/>s with mode="asciidoc-br".

> and because it's not something that's ever come up before I'm
> leaving it out. Maybe you could post your patched version with an
> explanation of how to use it with the a2x --xsl-file option.
There is nothing unusual to do at this point,
just use a2x --xsl-file fix-asciidoc-br.xsl
or if you want to use several custom .xsl,
then pass a --xsl-file manpage.xsl containing:
        <xsl:stylesheet
         xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
         version='1.0'>
                <xsl:import 
href="http://asciidoc.googlecode.com/hg/docbook-xsl/manpage.xsl"/>
                <xsl:include href="./fix-asciidoc-br.xsl"/>
                <xsl:include href="./fix-something-else.xsl"/>
                <!-- ... and so on ... -->
         </xsl:stylesheet>

This is for instance what this custom .xsl does to gather fixes:
        
http://git.grenouille.com/?p=tool/asciidoc.git;a=blob;f=docbook-xsl/manpage.xsl

Also for that, on Debian one may want this
(to my knowledge not included) patch:
        https://groups.google.com/forum/?fromgroups=#!topic/asciidoc/T3ac-vCVUcc
to avoid repeated downloads of:
        http://asciidoc.googlecode.com/hg/docbook-xsl/manpage.xsl

For the record I'm attaching manpage/fix-asciidoc-br.xsl
from 
http://git.grenouille.com/?p=tool/asciidoc.git;a=blob;f=docbook-xsl/manpage/fix-asciidoc-br.xsl
and xhtml/fix-asciidoc-br.xsl (much simpler) for the XHTML output
from 
http://git.grenouille.com/?p=tool/asciidoc.git;a=blob;f=docbook-xsl/xhtml/fix-asciidoc-br.xsl

cheers
--julm

Attachment: fix-asciidoc-br.xsl
Description: XML document

Attachment: fix-asciidoc-br.xsl
Description: XML document

Attachment: signature.asc
Description: Digital signature

Reply via email to