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: Syntax highlighting, HTML, PDF, XSLT, extensibility


I was writing something in DocBook XML, and realised that my code listings
look pretty boring and somewhat hard to read, and how they would look much
better if the keywords and so on were highlighted like they are in my
editor.

I can think of a number of ways to do this:

1) Manually extend Docbook with loads of new tags like keyword and so on,
this seems over the top, tedious, and non-extensible.
2) Markup the programlisting with manually with <code role=keyword"></code>
or something, and put in the XSLT how to render a keyword and so on.
3) Mark a programlisting with a tag like sourcelanguage="c", then have some
kind of modular post processor do the HTML syntax highlighting based on
language.
4) Same as 2 but have another program automatically do the markup from a
source file.

The way I see it, no manual work should be necessary. The processing could
be done either before translation, automatically marking up into XML, or
during translation at the XSLT stage, but some kind of modular program shoud
be used that can have different syntax files plugged in. I can see that this
might be trickier when PDF output and other outputs also have to be
considered.

Has anyone else been thinking about this? I don't know enough about XML or
DocBook to know whether or not this kind of thing is easily done.

I would like to use DocBook here, but I am thinking that it is probably
going to be much easier just to write this directly into HTML since I don't
really need a PDF version, although this would be nice. It might also be
easier just to rewrite the same document in LaTeX if I want a PDF version
since probably there already exists programs to automatically convert a
source file to a syntax highlighted latex environment.

I found a program that converts source to syntax highlighted html:

http://ostermiller.org/syntax/tohtml.html

but I haven't yet found one for latex, the plugging in of already existing 
programs seems to me like the outwardly most easy method? What would be 
mega-cool of course, would be if popular colour schemes and syntax 
highlighting formats of popular editors such as vim and emacs were 
supported, now that would be awesome.

Any thoughts?

cal 



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