~testdoc-dev/testdoc/trunk.git

« back to all changes in this revision

Viewing changes to testdoc/__init__.py

  • Committer: jml@canonical.com
  • Date: 2007-03-31 02:23:22 UTC
  • Revision ID: git-v1:e2a0f0f199ecca56fb9133f6a817c1397813c784
Split out the formatter code into a separate module.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
        docs = self.getDocs(method)
87
87
        if docs is not None:
88
88
            self.formatter.paragraph(docs)
89
 
 
90
 
 
91
 
class WikiFormatter(object):
92
 
    def __init__(self, stream):
93
 
        self.stream = stream
94
 
 
95
 
    def writeln(self, line):
96
 
        self.stream.write('%s\n' % (line,))
97
 
 
98
 
    def title(self, name):
99
 
        self.writeln('= %s =\n' % (name,))
100
 
 
101
 
    def section(self, name):
102
 
        self.writeln('== %s ==\n' % (name,))
103
 
 
104
 
    def subsection(self, name):
105
 
        self.writeln('=== %s ===\n' % (name,))
106
 
 
107
 
    def paragraph(self, text):
108
 
        self.writeln('%s\n' % (text.strip(),))