blob: e19f6213a01c4c27159215eac56e5b75da42fcf8 [file] [log] [blame]
Fred Drake86bc7b01998-12-02 17:21:35 +00001These scripts and Makefile fragment are used to convert the Python
Fred Drake478a2651999-07-29 22:01:39 +00002documentation in LaTeX format to SGML or XML. Though I originally
3thought that the XML was unlikely to be used, tool support for XML
4is increasing quickly enough that it may well be the final format.
5(It is the default output format when using the makefiles included
6here.)
Fred Drake86bc7b01998-12-02 17:21:35 +00007
Fred Drake77274161999-01-14 18:12:33 +00008This material is preliminary and incomplete. The XML omnibus package
Fred Drake7281b3b1999-01-29 22:35:23 +00009developed by the Python XML-SIG is required; specifically, the version
10available in the public CVS repository. See
Fred Drake86bc7b01998-12-02 17:21:35 +000011http://www.python.org/sigs/xml-sig/ for more information on the
12package.
13
Fred Drake0ee48911999-08-26 18:08:13 +000014To convert all documents to XML:
Fred Drake77274161999-01-14 18:12:33 +000015
16 cd Doc/
Fred Drake478a2651999-07-29 22:01:39 +000017 make -f tools/sgmlconv/Makefile sgml
Fred Drake77274161999-01-14 18:12:33 +000018
Fred Drake0ee48911999-08-26 18:08:13 +000019To convert one document to XML:
Fred Drake86bc7b01998-12-02 17:21:35 +000020
21 cd Doc/<document-dir>
22 make -f ../tools/sgmlconv/make.rules TOOLSDIR=../tools
23
Fred Drake0ee48911999-08-26 18:08:13 +000024To generate SGML instead, use:
Fred Drake86bc7b01998-12-02 17:21:35 +000025
26 cd Doc/<document-dir>
Fred Drake0ee48911999-08-26 18:08:13 +000027 make -f ../tools/sgmlconv/make.rules TOOLSDIR=../tools sgml
Fred Drake86bc7b01998-12-02 17:21:35 +000028
29Note that building the second target format is fast because both
30conversions use the same intermediate format (an ESIS event stream).
Fred Drake77274161999-01-14 18:12:33 +000031This is true regardless of whether you build SGML or XML first.
Fred Drake86bc7b01998-12-02 17:21:35 +000032
33Please send comments and bug reports to python-docs@python.org.
Fred Drake0ee48911999-08-26 18:08:13 +000034
35
36What do the tools do?
37---------------------
38
39latex2esis.py
40 Reads in a conversion specification written in XML
41 (conversion.xml), reads a LaTeX document fragment, and interprets
42 the markup according to the specification. The output is a stream
43 of ESIS events like those created by the nsgmls SGML parser, but
44 is *not* guaranteed to represent a single tree! This is done to
45 allow conversion per entity rather than per document. Since many
46 of the LaTeX files for the Python documentation contain two
47 sections on closely related modules, it is important to allow both
48 of the resulting <section> elements to exist in the same output
49 stream. Additionally, since comments are not supported in ESIS,
50 comments are converted to <COMMENT> elements, which might exist at
51 the same level as the top-level content elements.
52
53docfixer.py
54 This is the really painful part of the conversion. Well, it's the
55 second really painful part, but more of the pain is specific to
56 the structure of the Python documentation and desired output
57 rather than to the parsing of LaTeX markup.
58
59 This script loads the ESIS data created by latex2esis.py into a
60 DOM document *fragment* (remember, the latex2esis.py output may
61 not be well-formed). Once loaded, it walks over the tree many
62 times looking for a variety of possible specific
63 micro-conversions. Most of the code is not in any way "general".
64 After processing the fragment, a new ESIS data stream is written
65 out. Like the input, it may not represent a well-formed
66 document.
67
68 The output of docfixer.py is what gets saved in <filename>.esis.
69
70esis2sgml.py
71 Reads an ESIS stream and convert to SGML or XML. This also
72 converts <COMMENT> elements to real comments. This works quickly
73 because there's not much to actually do.