Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Public Attributes
MoinMoin.parser.text_rst.MoinWriter Class Reference
Collaboration diagram for MoinMoin.parser.text_rst.MoinWriter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def wiki_resolver
def __init__
def translate

Public Attributes

 formatter
 request
 unknown_reference_resolvers
 wikiparser
 nodes
 visitor

Static Public Attributes

string config_section = 'MoinMoin writer'
tuple config_section_dependencies = ('writers', )
 output = None

Detailed Description

Definition at line 104 of file text_rst.py.


Constructor & Destructor Documentation

def MoinMoin.parser.text_rst.MoinWriter.__init__ (   self,
  formatter,
  request 
)

Definition at line 136 of file text_rst.py.

00136 
00137     def __init__(self, formatter, request):
00138         html4css1.Writer.__init__(self)
00139         self.formatter = formatter
00140         self.request = request
00141         # Add our wiki unknown_reference_resolver to our list of functions to
00142         # run when a target isn't found
00143         self.unknown_reference_resolvers = [self.wiki_resolver]
00144         # We create a new parser to process MoinMoin wiki style links in the
00145         # reST.
00146         self.wikiparser = WikiParser('', self.request)
00147         self.wikiparser.formatter = self.formatter
00148         self.wikiparser.hilite_re = None
00149         self.nodes = []
00150         # Make sure it's a supported docutils version.
00151         required_version = (0, 3, 10)
00152         current_version = tuple([int(i) for i in (docutils.__version__.split('.') + ['0', '0'])[:3]])
00153         if current_version < required_version:
00154             err = 'ERROR: The installed docutils version is %s;' % ('.'.join([str(i) for i in current_version]))
00155             err += ' version %s or later is required.' % ('.'.join([str(i) for i in required_version]))
00156             raise RuntimeError, err


Member Function Documentation

Definition at line 157 of file text_rst.py.

00157 
00158     def translate(self):
00159         visitor = MoinTranslator(self.document,
00160                                  self.formatter,
00161                                  self.request,
00162                                  self.wikiparser,
00163                                  self)
00164         self.document.walkabout(visitor)
00165         self.visitor = visitor
00166         # Docutils 0.5 and later require the writer to have the visitor
00167         # attributes.
00168         if (hasattr(html4css1.Writer, 'visitor_attributes')):
00169             for attr in html4css1.Writer.visitor_attributes:
00170                 setattr(self, attr, getattr(visitor, attr))
00171         self.output = html_escape_unicode(visitor.astext())
00172 
# mark quickhelp as translatable
    Normally an unknown reference would be an error in an reST document.
    However, this is how new documents are created in the wiki. This
    passes on unknown references to eventually be handled by
    MoinMoin.

Definition at line 112 of file text_rst.py.

00112 
00113     def wiki_resolver(self, node):
00114         """
00115             Normally an unknown reference would be an error in an reST document.
00116             However, this is how new documents are created in the wiki. This
00117             passes on unknown references to eventually be handled by
00118             MoinMoin.
00119         """
00120         if hasattr(node, 'indirect_reference_name'):
00121             node['refuri'] = node.indirect_reference_name
00122         elif (len(node['ids']) != 0):
00123             # If the node has an id then it's probably an internal link. Let
00124             # docutils generate an error.
00125             return False
00126         elif node.hasattr('name'):
00127             node['refuri'] = node['name']
00128         else:
00129             node['refuri'] = node['refname']
00130         del node['refname']
00131         node.resolved = 1
00132         self.nodes.append(node)
00133         return True


Member Data Documentation

string MoinMoin.parser.text_rst.MoinWriter.config_section = 'MoinMoin writer' [static]

Definition at line 106 of file text_rst.py.

Definition at line 107 of file text_rst.py.

Definition at line 138 of file text_rst.py.

Definition at line 148 of file text_rst.py.

Definition at line 110 of file text_rst.py.

Definition at line 139 of file text_rst.py.

Definition at line 142 of file text_rst.py.

Definition at line 164 of file text_rst.py.

Definition at line 145 of file text_rst.py.


The documentation for this class was generated from the following file: