This is the mail archive of the davenport@berkshire.net mailing list for the Davenport project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: DAVENPORT: language support


> having had a quick look into the docbook documentation
> I find only specifications for documenting APIs in C.
> Are there activities to support other languages, especially
> object oriented ? I'm most interested in IDL and C++.

I had the same problem with documenting a Python library. And I couldn't
wait for some future DocBook version with support for other languages.
I ended up using the XML version of DocBook, with modifications to
support Python. Then I wrote my own converter from this DTD to
LaTeX and HTML, using the DOM module from the Python-XML package.
This turned out to be less work than expected, and it gave me the complete
freedom to extend the DTD and to get the printed output in the form
I want.

Here's my final DTD. Most of the additions are for documenting classes,
the only other one is a tag for default values of function arguments.

<!DOCTYPE book PUBLIC "-//Norman Walsh//DTD DocBk XML V3.1.4//EN" [

  <!-- Redefinition of paramdef to permit defaultvalue -->
  <!ELEMENT paramdef (#PCDATA 
		  | replaceable 
		  | parameter | defaultvalue
		  | funcparams)*>
  <!-- Additional element: defaultvalue -->
  <!ELEMENT defaultvalue (#PCDATA)>
  <!-- Additional markup for classes -->
  <!ELEMENT classdescription (classdef, (para | itemizedlist
                                         | methoddescription)*)>
  <!ATTLIST classdescription role CDATA #IMPLIED>
  <!ENTITY % local.synop.class "|classdescription">
  <!ELEMENT classdef (#PCDATA | class | classinfo)*>
  <!ELEMENT class (#PCDATA)>
  <!ELEMENT classinfo (#PCDATA)>
  <!ELEMENT methoddescription (methoddef, (void | varargs | paramdef+),
                               (para | itemizedlist)*)>
  <!ELEMENT methoddef (#PCDATA | method)*>
  <!ELEMENT method (#PCDATA)>

]>

If anyone wants my converter to HTML and LaTeX, send me an e-mail.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]