[Doc-SIG] Producing output

Ueli Schläpfer usc@ieee.org
18 Sep 2001 00:28:21 +0200


Tibs, Paul,

Recently, I started writing short notes in the reST format because I
wanted to get a feeling for how well it works and what it's good for.
Excellent job -- thanks (this obviously includes David Goodger!!)

Up to now, all that was missing was the processing.  Now I've got some
time to spare and started playing around with the DPS.  I found that I
had to make the following modifications to the latest DPS snapshot
from CVS in order to get html output from plain text files:

- `dps2html` wants an `Errorist` class, whoch I found nowhere and
  assumed that David's `Reporter` would do fine.
- David has used `bibliographic_labels` in his language files,
  whereas, in restructuredtext/restructuredtext/states.py, it's
  `bibliographic_fields`.

In pydps/html.py, there are several references to `element.tagName`
which should probably read `element.tagname`.

The diffs_ are included below.

Ueli





.. _diffs:

---8<------------------------------------------------------------
Index: dps/dps/utils.py
===================================================================
RCS file: /cvsroot/docstring/dps/dps/utils.py,v
retrieving revision 1.6
diff -u -r1.6 utils.py
--- dps/dps/utils.py	2001/09/17 03:54:29	1.6
+++ dps/dps/utils.py	2001/09/17 21:57:10
@@ -1,3 +1,4 @@
+
 #! /usr/bin/env python
 
 """
@@ -66,3 +67,5 @@
         if sourcetext:
             children.append(nodes.literal_block('', sourcetext))
         return self.system_warning(3, children=children)
+
+class Errorist(Reporter): pass
---8<------------------------------------------------------------

---8<------------------------------------------------------------
Index: restructuredtext/restructuredtext/states.py
===================================================================
RCS file: /cvsroot/structuredtext/restructuredtext/restructuredtext/states.py,v
retrieving revision 1.20
diff -u -r1.20 states.py
--- restructuredtext/restructuredtext/states.py	2001/09/17 04:24:20	1.20
+++ restructuredtext/restructuredtext/states.py	2001/09/17 21:57:19
@@ -210,7 +210,7 @@
     def extractbibliographic(self, field_list, title):
         nodelist = []
         remainder = []
-        bibliofields = self.language.bibliographic_fields
+        bibliofields = self.language.bibliographic_labels
         abstract = None
         for field in field_list:
             try:
---8<------------------------------------------------------------

---8<------------------------------------------------------------
--- pydps/html.py	Mon Sep 17 22:57:43 2001
+++ pydps.orig/html.py	Sun Sep  9 20:32:50 2001
@@ -132,7 +132,7 @@
 
         # Hmm - have we been handed a "document" rooted tree,
         # or a DOM-like tree that has "document" as its single child?
-        if document.tagname == "document":
+        if document.tagName == "document":
             self.write_html(document,stream)
         else:
             for element in document:
@@ -187,10 +187,10 @@
         """Write out the HTML representation of `element` on `stream`.
         """
 
-        if element.tagname == "#text":
+        if element.tagName == "#text":
             stream.write(self.escape(element.astext()))
-        elif self.indirect.has_key(element.tagname):
-            value = self.indirect[element.tagname]
+        elif self.indirect.has_key(element.tagName):
+            value = self.indirect[element.tagName]
             if value is None:
                 # Nothing to do with this element - but check its children
                 for node in element:
@@ -215,7 +215,7 @@
         """Write out an element which we don't recognise.
         """
 
-        stream.write("\n<p><font color='red'>&lt;%s"%element.tagname)
+        stream.write("\n<p><font color='red'>&lt;%s"%element.tagName)
         for name,value in element.attlist():
             stream.write(" %s='%s'"%(name,self.escape(value)))
         stream.write("&gt;</font>\n")
@@ -224,7 +224,7 @@
             self.write_html(node,stream)
 
         stream.write("\n<font color='red'>"
-                     "&lt;/%s&gt;</font>\n"%element.tagname)
+                     "&lt;/%s&gt;</font>\n"%element.tagName)
 
     def write_section(self,element,stream):
         """Write a section - i.e., something with a title
@@ -404,7 +404,7 @@
                 "system_warning"  : write_warning,
                 }
     """Entries in this dictionary are all keyed by a DPS element's
-    tagname. The values are either:
+    tagName. The values are either:
 
     * a simple string, representing the HTML tag to use for this
       element
@@ -556,7 +556,7 @@
         stream.write("<li><samp>%s</samp>\n"%element["name"])
         if len(element) > 0:
             for node in element:
-                if node.tagname == "py_docstring":
+                if node.tagName == "py_docstring":
                     self.write_docstring(node,stream)
                 else:
                     self.write_html(node,stream)
---8<------------------------------------------------------------