Improve node coverage for latex/text writers.

This commit is contained in:
Georg Brandl 2008-11-01 14:40:02 +00:00
parent 2ebb04f10f
commit 1ed2d916cd
3 changed files with 64 additions and 0 deletions

View File

@ -358,6 +358,15 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.in_title = 0
self.body.append(self.context.pop())
def visit_subtitle(self, node):
if isinstance(node.parent, nodes.sidebar):
self.body.append('~\\\\\n\\textbf{')
self.context.append('}\n\\smallskip\n')
else:
self.context.append('')
def depart_subtitle(self, node):
self.body.append(self.context.pop())
desc_map = {
'function' : 'funcdesc',
'class': 'classdesc',

View File

@ -126,6 +126,16 @@ class TextTranslator(nodes.NodeVisitor):
self.add_text(' ]-')
self.end_state()
def visit_sidebar(self, node):
pass
def depart_sidebar(self, node):
pass
def visit_compound(self, node):
pass
def depart_compound(self, node):
pass
def visit_glossary(self, node):
pass
def depart_glossary(self, node):
@ -145,6 +155,16 @@ class TextTranslator(nodes.NodeVisitor):
self.stateindent.pop()
self.states[-1].append((0, ['', text, '%s' % (char * len(text)), '']))
def visit_subtitle(self, node):
pass
def depart_subtitle(self, node):
pass
def visit_attribution(self, node):
self.add_text('-- ')
def depart_attribution(self, node):
pass
def visit_module(self, node):
if node.has_key('platform'):
self.new_state(0)

View File

@ -31,6 +31,41 @@ Admonitions
Tip text.
Body directives
---------------
.. topic:: Title
Topic body.
.. sidebar:: Sidebar
:subtitle: Sidebar subtitle
Sidebar body.
.. rubric:: Test rubric
.. epigraph:: Epigraph title
Epigraph body.
-- Author
.. highlights:: Highlights
Highlights body.
.. pull-quote:: Pull-quote
Pull quote body.
.. compound::
a
b
Tables
------