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] | [Elist Home]


Subject: Re: DOCBOOK-APPS: color coding


/ Arjan Huijzer <ahuijze@bit-ic.nl> was heard to say:
| Thanks for the advice. I especially like the code2html application. I would
| like to extend my DocBook "framework" to include it. What I would like to
| accomplish is this: if a <programlisting> element has the attribute "role"
| set, apply syntax highlighting in that language e.g. <programlisting
| role="html">.

That may be impractical. You really need to pre-process the code
listing to add markup for the syntax highlighting. (Trying to get XSLT
to do syntax highlighting by semantic analysis of the code listing is
probably more trouble than its worth.)

| How can i do this? Any help is greatly appreciated!

When I wanted to have syntax highlighted XML in a document I was
writing, I wrote prettyprint.pl (attached) that reads an XML document
and produces marked-up DocBook.

Then I added a little CSS to my HTML file:

tt.sgmltag-starttag    { color: #4080B0; }
tt.sgmltag-endtag      { color: #4080B0; }
tt.sgmltag-emptytag    { color: #4080B0; }
tt.sgmltag-sgmlcomment { color: #B02020; }
tt.sgmltag-xmlpi       { color: #0000F8; }
tt.sgmltag-genentity   { color: #686868; }
pre.programlisting     { background-color: #F0DCB0; }

Result: syntax highlighted XML.

Maybe something similar would work for your application.

prettyprint.pl



                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com>      | My dog is worried about the
http://www.oasis-open.org/docbook/ | economy because Alpo is up to 99
Chair, DocBook Technical Committee | cents a can. That's almost $7.00
                                   | in dog money.--Joe Weinstein


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


Powered by eList eXpress LLC