Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53747 - trunk/libs/mpl/doc/src/docutils/writers/html4_refdoc
From: agurtovoy_at_[hidden]
Date: 2009-06-08 09:12:51


Author: agurtovoy
Date: 2009-06-08 09:12:50 EDT (Mon, 08 Jun 2009)
New Revision: 53747
URL: http://svn.boost.org/trac/boost/changeset/53747

Log:
Further MPL doc generation fixes
Text files modified:
   trunk/libs/mpl/doc/src/docutils/writers/html4_refdoc/__init__.py | 71 +++++++--------------------------------
   1 files changed, 14 insertions(+), 57 deletions(-)

Modified: trunk/libs/mpl/doc/src/docutils/writers/html4_refdoc/__init__.py
==============================================================================
--- trunk/libs/mpl/doc/src/docutils/writers/html4_refdoc/__init__.py (original)
+++ trunk/libs/mpl/doc/src/docutils/writers/html4_refdoc/__init__.py 2009-06-08 09:12:50 EDT (Mon, 08 Jun 2009)
@@ -21,47 +21,9 @@
         self.translator = refdoc_translator
 
 
-class hacked_html_translator(nodes.NodeVisitor):
-
- def __init__(self, document):
- self.__super = nodes.NodeVisitor
- self.__super.__init__(self, document)
- self.base = html4css1.HTMLTranslator(document)
- self.body = self.base.body
- self.head = self.base.head
- self.astext = self.base.astext
- self.starttag = self.base.starttag
- self.words_and_spaces = self.base.words_and_spaces
- self.encode = self.base.encode
- self.recursion_level = 0
-
- def visit_section(self, node):
- if self.base.section_level == 1:
- self.base.section_level = 2
-
- self.base.body_prefix = self.body_prefix
- self.base.visit_section(node)
-
- def depart_section(self, node):
- self.base.depart_section(node)
- if self.base.section_level == 2:
- self.base.section_level = 1
-
-
- def visit_generated(self, node):
- if node.get('class', '') == 'sectnum':
- node[0].data = string.strip(node[0].data, u'\u00a0')
-
- self.base.visit_generated(node)
-
- def depart_generated(self, node):
- self.base.depart_generated(node)
-
-
 class refdoc_translator(html4_frames.frame_pages_translator):
 
     tocframe_width = 25
- page_translator = hacked_html_translator
     re_include = re.compile(r'(\s*#include\s+<)(.*?\.hpp)?(>\s*)?')
     re_identifier = re.compile(r'(.*?\W*)(\w+)(\W.*?)?')
     re_modtime = re.compile(r'\s*modtime:\s*(.*)')
@@ -75,6 +37,20 @@
         self.__super.__init__(self, document, index_page, page_files_dir, extension)
 
 
+ def visit_section( self, node ):
+ base = self
+ self = self.active_visitor()
+ if self.section_level == 1:
+ self.section_level = 2
+ base.__super.visit_section( base, node )
+
+ def depart_section( self, node ):
+ self.__super.depart_section( self, node )
+ self = self.active_visitor()
+ if self.section_level == 2:
+ self.section_level = 1
+
+
     def visit_title( self, node ):
         self.__super.visit_title( self, node )
         if self.re_auto_id.match( self._node_id( node.parent ) ):
@@ -249,22 +225,3 @@
 
         return node_id
 
-
-def _setup_forwarding(visitor):
- for name in nodes.node_class_names:
- if not getattr(visitor, 'visit_' + name, None):
-
- def forward_visit(self, node, name=name):
- self.recursion_level += 1
- #print '%svisit_%s' % ( '+' * self.recursion_level, name )
- getattr(self.base, 'visit_' + name)(node)
-
- def forward_depart(self, node, name=name):
- #print '%sdepart_%s' % ( '-' * self.recursion_level, name )
- self.recursion_level -= 1
- getattr(self.base, 'depart_' + name)(node)
-
- setattr(visitor, 'visit_' + name, forward_visit)
- setattr(visitor, 'depart_' + name, forward_depart)
-
-_setup_forwarding(hacked_html_translator)


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk