Debian Codegraph @

test/local-writer.py

raw symbols SCIP
1 # $Id: local-writer.py 9037 2022-03-05 23:31:10Z milde $
2 # Author: Engelbert Gruber <[email protected]>
3 # Copyright: This module is put into the public domain.
4
5 """
6 mini-writer to test get_writer_class with local writer
7 """
8
9 from docutils import nodes, writers
10
11
12 class Writer(writers.Writer):
13
14 supported = ('dummy',)
15 """Formats this writer supports."""
16
17 output = None
18 """Final translated form of `document`."""
19
20 def __init__(self):
21 writers.Writer.__init__(self)
22 self.translator_class = Translator
23
24 def translate(self):
25 visitor = self.translator_class(self.document)
26 self.document.walkabout(visitor)
27 self.output = visitor.astext()
28
29
30 class Translator(nodes.NodeVisitor):
31 def __init__(self, document):
32 nodes.NodeVisitor.__init__(self, document)