[Zope-Checkins] CVS: Zope/lib/python/docutils/writers - __init__.py:1.1.2.3 docutils_xml.py:1.1.2.2 html4css1.py:1.1.2.2 html4zope.py:1.1.2.3 pep_html.py:1.1.2.2 pseudoxml.py:1.1.2.2
Andreas Jung
andreas@andreas-jung.com
Sat, 25 Jan 2003 07:43:11 -0500
Update of /cvs-repository/Zope/lib/python/docutils/writers
In directory cvs.zope.org:/tmp/cvs-serv2099/writers
Modified Files:
Tag: ajung-restructuredtext-integration-branch
__init__.py docutils_xml.py html4css1.py html4zope.py
pep_html.py pseudoxml.py
Log Message:
docutils updated
=== Zope/lib/python/docutils/writers/__init__.py 1.1.2.2 => 1.1.2.3 ===
--- Zope/lib/python/docutils/writers/__init__.py:1.1.2.2 Tue Nov 5 04:37:45 2002
+++ Zope/lib/python/docutils/writers/__init__.py Sat Jan 25 07:43:06 2003
@@ -68,7 +68,6 @@
_writer_aliases = {
'html': 'html4css1',
- 'html4zope': 'html4zope',
'pprint': 'pseudoxml',
'pformat': 'pseudoxml',
'pdf': 'rlpdf',
=== Zope/lib/python/docutils/writers/docutils_xml.py 1.1.2.1 => 1.1.2.2 ===
--- Zope/lib/python/docutils/writers/docutils_xml.py:1.1.2.1 Tue Nov 5 04:03:59 2002
+++ Zope/lib/python/docutils/writers/docutils_xml.py Sat Jan 25 07:43:06 2003
@@ -22,12 +22,18 @@
settings_spec = (
'"Docutils XML" Writer Options',
- 'Warning: these options may adversely affect whitespace; use them '
- 'only for reading convenience.',
+ 'Warning: the --newlines and --indents options may adversely affect '
+ 'whitespace; use them only for reading convenience.',
(('Generate XML with newlines before and after tags.',
['--newlines'], {'action': 'store_true'}),
('Generate XML with indents and newlines.',
- ['--indents'], {'action': 'store_true'}),),)
+ ['--indents'], {'action': 'store_true'}),
+ ('Omit the XML declaration. Use with caution.',
+ ['--no-xml-declaration'], {'dest': 'xml_declaration', 'default': 1,
+ 'action': 'store_false'}),
+ ('Omit the DOCTYPE declaration.',
+ ['--no-doctype'], {'dest': 'doctype_declaration', 'default': 1,
+ 'action': 'store_false'}),))
output = None
"""Final translated form of `document`."""
@@ -48,9 +54,13 @@
if settings.indents:
newline = '\n'
indent = ' '
- output_prefix = [self.xml_declaration % settings.output_encoding,
- self.doctype,
- self.generator % docutils.__version__]
+ output_prefix = []
+ if settings.xml_declaration:
+ output_prefix.append(
+ self.xml_declaration % settings.output_encoding)
+ if settings.doctype_declaration:
+ output_prefix.append(self.doctype)
+ output_prefix.append(self.generator % docutils.__version__)
docnode = self.document.asdom().childNodes[0]
self.output = (''.join(output_prefix)
+ docnode.toprettyxml(indent, newline))
=== Zope/lib/python/docutils/writers/html4css1.py 1.1.2.1 => 1.1.2.2 ===
--- Zope/lib/python/docutils/writers/html4css1.py:1.1.2.1 Tue Nov 5 04:03:59 2002
+++ Zope/lib/python/docutils/writers/html4css1.py Sat Jan 25 07:43:06 2003
@@ -34,7 +34,7 @@
'HTML-Specific Options',
None,
(('Specify a stylesheet URL, used verbatim. Default is '
- '"default.css".',
+ '"default.css". Overridden by --stylesheet-path.',
['--stylesheet'],
{'default': 'default.css', 'metavar': '<URL>'}),
('Specify a stylesheet file, relative to the current working '
@@ -125,21 +125,22 @@
paragraph is the only child of its parent (footnotes & citations
are allowed a label first).
- - Regardless of the above, in definitions, table cells, field
- bodies, option descriptions, and list items, mark the first
- child with 'class="first"' if it is a paragraph. The stylesheet
- sets the top margin to 0 for these paragraphs.
+ - Regardless of the above, in definitions, table cells, field bodies,
+ option descriptions, and list items, mark the first child with
+ 'class="first"' and the last child with 'class="last"'. The stylesheet
+ sets the margins (top & bottom respecively) to 0 for these elements.
The ``no_compact_lists`` setting (``--no-compact-lists`` command-line
option) disables list whitespace optimization.
"""
- xml_declaration = '<?xml version="1.0" encoding="%s"?>\n'
+ xml_declaration = '<?xml version="1.0" encoding="%s" ?>\n'
doctype = ('<!DOCTYPE html'
' PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
' "http://www.w3.org/TR/xhtml1/DTD/'
'xhtml1-transitional.dtd">\n')
- html_head = '<html lang="%s">\n<head>\n'
+ html_head = ('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="%s" '
+ 'lang="%s">\n<head>\n')
content_type = ('<meta http-equiv="Content-Type" content="text/html; '
'charset=%s" />\n')
generator = ('<meta name="generator" content="Docutils %s: '
@@ -153,11 +154,12 @@
def __init__(self, document):
nodes.NodeVisitor.__init__(self, document)
self.settings = settings = document.settings
- self.language = languages.get_language(settings.language_code)
+ lcode = settings.language_code
+ self.language = languages.get_language(lcode)
self.head_prefix = [
self.xml_declaration % settings.output_encoding,
self.doctype,
- self.html_head % settings.language_code,
+ self.html_head % (lcode, lcode),
self.content_type % settings.output_encoding,
self.generator % docutils.__version__]
self.head = []
@@ -167,7 +169,10 @@
self.stylesheet = [self.embedded_stylesheet % stylesheet_text]
else:
stylesheet = self.get_stylesheet_reference()
- self.stylesheet = [self.stylesheet_link % stylesheet]
+ if stylesheet:
+ self.stylesheet = [self.stylesheet_link % stylesheet]
+ else:
+ self.stylesheet = []
self.body_prefix = ['</head>\n<body>\n']
self.body_pre_docinfo = []
self.docinfo = []
@@ -714,14 +719,6 @@
def depart_important(self, node):
self.depart_admonition()
- def visit_interpreted(self, node):
- # @@@ Incomplete, pending a proper implementation on the
- # Parser/Reader end.
- self.body.append('<span class="interpreted">')
-
- def depart_interpreted(self, node):
- self.body.append('</span>')
-
def visit_label(self, node):
self.body.append(self.starttag(node, 'td', '%s[' % self.context.pop(),
CLASS='label'))
@@ -775,7 +772,7 @@
self.body.append('\n</pre>\n')
def visit_meta(self, node):
- self.head.append(self.starttag(node, 'meta', **node.attributes))
+ self.head.append(self.emptytag(node, 'meta', **node.attributes))
def depart_meta(self, node):
pass
@@ -1068,6 +1065,12 @@
def depart_title(self, node):
self.body.append(self.context.pop())
+
+ def visit_title_reference(self, node):
+ self.body.append(self.starttag(node, 'cite', ''))
+
+ def depart_title_reference(self, node):
+ self.body.append('</cite>')
def visit_topic(self, node):
self.body.append(self.starttag(node, 'div', CLASS='topic'))
=== Zope/lib/python/docutils/writers/html4zope.py 1.1.2.2 => 1.1.2.3 ===
--- Zope/lib/python/docutils/writers/html4zope.py:1.1.2.2 Tue Nov 5 04:50:11 2002
+++ Zope/lib/python/docutils/writers/html4zope.py Sat Jan 25 07:43:06 2003
@@ -1,16 +1,13 @@
-# Author: David Goodger
-# Contact: goodger@users.sourceforge.net
+# Author: Andreas Jung
+# Contact: andreas@andreas-jung.com
# Revision: $Revision$
# Date: $Date$
# Copyright: This module has been placed in the public domain.
"""
-Simple HyperText Markup Language document tree Writer.
-
-The output conforms to the HTML 4.01 Transitional DTD and to the Extensible
-HTML version 1.0 Transitional DTD (*almost* strict). The output contains a
-minimum of formatting information. A cascading style sheet ("default.css" by
-default) is required for proper viewing with a modern graphical browser.
+Writer module to integrate reST into Zope. This writer subclasses the standard
+html4css1 writer and changes the starting level for <H> elements from 1 to 3
+(default behaviour inside Zope.
"""
__docformat__ = 'reStructuredText'
=== Zope/lib/python/docutils/writers/pep_html.py 1.1.2.1 => 1.1.2.2 ===
=== Zope/lib/python/docutils/writers/pseudoxml.py 1.1.2.1 => 1.1.2.2 ===