I have used DocBook in the past for documents where I would like to distribute both HTML and for-print versions. It works reasonably well, but there are three major shortcomings:
I have long yearned for a Turing-complete language to use instead of XML. It turns out that Scala's case classes are about equally as expressive, while addressing most of these issues. The first issue goes away entirely. The second is actually reduced, but only because I wrote my own style sheets instead of relying on Docbook. (As an aside, why in the world do the standard Docbook styles generate such bad for-print versions? Latex's simple article style looks much better.) Only the third is left untouched.
Enough said. The implementations are about equally long, if you discount the style sheets. Here's the original file and counts:
manual.xml
:
795 lines, 33kb
Manual.scala
:
720 lines, 32kb
Documents.scala
:
41 lines, 1.5kb
EmitHtml.scala
:
115 lines, 2kb
EmitLatex.scala
:
138 lines, 3kb
Finally, here's the output. I think it all looks so so, although naturally I mildly prefer both of my versions to the Docbook ones.