* Consolidated version numbering documentation in docs/dev/policies.txt (moved text...
[docutils.git] / docutils / test / local-writer.py
blobf11f4775aef3a329349cf476c5098fdd4b2566c4
1 # -*- coding: utf-8 -*-
2 # $Id$
3 # Author: Engelbert Gruber <grubert@users.sourceforge.net>
4 # Copyright: This module is put into the public domain.
6 """
7 mini-writer to test get_writer_class with local writer
8 """
10 import docutils
11 from docutils import nodes, writers, languages
12 try:
13 import roman
14 except ImportError:
15 import docutils.utils.roman as roman
17 class Writer(writers.Writer):
19 supported = ('dummy',)
20 """Formats this writer supports."""
22 output = None
23 """Final translated form of `document`."""
25 def __init__(self):
26 writers.Writer.__init__(self)
27 self.translator_class = Translator
29 def translate(self):
30 visitor = self.translator_class(self.document)
31 self.document.walkabout(visitor)
32 self.output = visitor.astext()
34 class Translator(nodes.NodeVisitor):
35 def __init__(self, document):
36 nodes.NodeVisitor.__init__(self, document)