Fred Drake | 86bc7b0 | 1998-12-02 17:21:35 +0000 | [diff] [blame] | 1 | These scripts and Makefile fragment are used to convert the Python |
Fred Drake | 382a75d | 2000-11-22 16:58:25 +0000 | [diff] [blame] | 2 | documentation in LaTeX format to XML. |
Fred Drake | 86bc7b0 | 1998-12-02 17:21:35 +0000 | [diff] [blame] | 3 | |
Fred Drake | 382a75d | 2000-11-22 16:58:25 +0000 | [diff] [blame] | 4 | This material is preliminary and incomplete. Python 2.0 is required. |
Fred Drake | 86bc7b0 | 1998-12-02 17:21:35 +0000 | [diff] [blame] | 5 | |
Fred Drake | 0ee4891 | 1999-08-26 18:08:13 +0000 | [diff] [blame] | 6 | To convert all documents to XML: |
Fred Drake | 7727416 | 1999-01-14 18:12:33 +0000 | [diff] [blame] | 7 | |
| 8 | cd Doc/ |
Fred Drake | 382a75d | 2000-11-22 16:58:25 +0000 | [diff] [blame] | 9 | make -f tools/sgmlconv/Makefile |
Fred Drake | 7727416 | 1999-01-14 18:12:33 +0000 | [diff] [blame] | 10 | |
Fred Drake | 0ee4891 | 1999-08-26 18:08:13 +0000 | [diff] [blame] | 11 | To convert one document to XML: |
Fred Drake | 86bc7b0 | 1998-12-02 17:21:35 +0000 | [diff] [blame] | 12 | |
| 13 | cd Doc/<document-dir> |
| 14 | make -f ../tools/sgmlconv/make.rules TOOLSDIR=../tools |
| 15 | |
Fred Drake | 86bc7b0 | 1998-12-02 17:21:35 +0000 | [diff] [blame] | 16 | Please send comments and bug reports to python-docs@python.org. |
Fred Drake | 0ee4891 | 1999-08-26 18:08:13 +0000 | [diff] [blame] | 17 | |
| 18 | |
| 19 | What do the tools do? |
| 20 | --------------------- |
| 21 | |
| 22 | latex2esis.py |
| 23 | Reads in a conversion specification written in XML |
| 24 | (conversion.xml), reads a LaTeX document fragment, and interprets |
| 25 | the markup according to the specification. The output is a stream |
| 26 | of ESIS events like those created by the nsgmls SGML parser, but |
| 27 | is *not* guaranteed to represent a single tree! This is done to |
| 28 | allow conversion per entity rather than per document. Since many |
| 29 | of the LaTeX files for the Python documentation contain two |
| 30 | sections on closely related modules, it is important to allow both |
| 31 | of the resulting <section> elements to exist in the same output |
| 32 | stream. Additionally, since comments are not supported in ESIS, |
| 33 | comments are converted to <COMMENT> elements, which might exist at |
| 34 | the same level as the top-level content elements. |
| 35 | |
Fred Drake | 382a75d | 2000-11-22 16:58:25 +0000 | [diff] [blame] | 36 | The output of latex2esis.py gets saved as <filename>.esis1. |
| 37 | |
Fred Drake | 0ee4891 | 1999-08-26 18:08:13 +0000 | [diff] [blame] | 38 | docfixer.py |
| 39 | This is the really painful part of the conversion. Well, it's the |
| 40 | second really painful part, but more of the pain is specific to |
| 41 | the structure of the Python documentation and desired output |
| 42 | rather than to the parsing of LaTeX markup. |
| 43 | |
| 44 | This script loads the ESIS data created by latex2esis.py into a |
| 45 | DOM document *fragment* (remember, the latex2esis.py output may |
| 46 | not be well-formed). Once loaded, it walks over the tree many |
| 47 | times looking for a variety of possible specific |
| 48 | micro-conversions. Most of the code is not in any way "general". |
| 49 | After processing the fragment, a new ESIS data stream is written |
| 50 | out. Like the input, it may not represent a well-formed |
Fred Drake | 382a75d | 2000-11-22 16:58:25 +0000 | [diff] [blame] | 51 | document, but does represent a parsed entity. |
Fred Drake | 0ee4891 | 1999-08-26 18:08:13 +0000 | [diff] [blame] | 52 | |
| 53 | The output of docfixer.py is what gets saved in <filename>.esis. |
| 54 | |
| 55 | esis2sgml.py |
| 56 | Reads an ESIS stream and convert to SGML or XML. This also |
| 57 | converts <COMMENT> elements to real comments. This works quickly |
| 58 | because there's not much to actually do. |