> I haven't done it but I would suggest that you investigate using
> source-highlight to output docbook that you pass through to fop or
> latex that is passed through to dblatex by making a custom filter to
> control source-highlight in these modes.
Lex, thanks. That sounds like a good approach.
I did some more research and determined that the actual colorization
of source code on the dblatex back-end processing chain is
in a latex 'user package':
/usr/share/texmf/tex/latex/listings/
The language dialects are defined the file, listings.cfg.
and the language definitions are in the files lstlang[1-3].sty
The "C" definition begins this way:
\lst@definelanguage[ANSI]{C}%
{morekeywords={auto,break,case,char,const,continue,default,do,double,%
else,enum,extern,float,for,goto,if,int,long,register,return,%
short,signed,sizeof,static,struct,switch,typedef,union,unsigned,%
void,volatile,while},%
What seems to happen is that dblatex transforms the
DocBook 'programlisting' tag into the latex:
\begin{lstlisting}[language=UPC,firstnumber=1,]
}\end{lstlisting}
and that's where, eventually, an error message is printed,
because lslisting{} doesn't have a definition of "UPC",
Therefore, the short-term solution would be to figure out
how to pass a new language definition to dblatex. That will
add some support for the new dialect of C (UPC), but note
that the way dblatex colorizes the code is different than
the way that 'source-highlight' colorizes the code, and
there is still no source highlight support for 'fop'.
Given that GNU 'source-highlight' doesn't add descriptive tags
(only strong emphasis for keywords, etc.), to its docbook output,
using DocBook output directly seems un-workable.
Perhaps best is to take its XHTML output and process it with an
XSLT filter that maps it back into meaningful DocBook XML that:
(1) preserves the HTML formatting, (2) doesn't freak out dblatex, fop,
or any other backend, (3) preserves callouts in a meaningful way.
(This could be done as a user-defined source filter, hopefully.)
The other alternative to investigate is to see if source-highlight's
docbook output can be enhanced, and then insert that directly.
The docbook output would have to be something that both dblatex and fop
understand and can process in a way that leads to output similar
to that of the .html output.
BTW, I first tried the following, to generate .html output:
$ a2x -v -k -f html4 asciidoc-test-upc-highlight.txt
Usage: a2x [OPTIONS] SOURCE_FILE
a2x: error: option -f: invalid choice: 'html4' (choose from 'chunked',
'epub',
'htmlhelp', 'manpage', 'pdf', 'text', 'xhtml', 'dvi', 'ps', 'tex',
'docbook')
Yet, the direct asciidoc invocation worked fine:
$ asciidoc -v -b html4 asciidoc-test-upc-highlight.txt
--
You received this message because you are subscribed to the Google Groups
"asciidoc" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/asciidoc?hl=en.