summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-10-06 15:31:30 (GMT)
committerGuido van Rossum <guido@python.org>1995-10-06 15:31:30 (GMT)
commit909507dd0be2a0a2371461744e828b1f71518051 (patch)
treee1c08dbf7ed5ad66687f56ff5210958f6ec8badf /Lib
parent84175bacd194b3934962d596670a37a8aacd0dcc (diff)
downloadcpython-909507dd0be2a0a2371461744e828b1f71518051.zip
cpython-909507dd0be2a0a2371461744e828b1f71518051.tar.gz
cpython-909507dd0be2a0a2371461744e828b1f71518051.tar.bz2
added NullFormatter
Diffstat (limited to 'Lib')
-rw-r--r--Lib/formatter.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/Lib/formatter.py b/Lib/formatter.py
index 9ff03b5..50615f4 100644
--- a/Lib/formatter.py
+++ b/Lib/formatter.py
@@ -9,6 +9,25 @@ AS_IS = None
whitespace = '[' + string.whitespace + ']+'
+class NullFormatter:
+
+ def __init__(self): pass
+ def end_paragraph(self, blankline): pass
+ def add_line_break(self): pass
+ def add_hor_rule(self): pass
+ def add_label_data(self, format, counter): pass
+ def add_flowing_data(self, data): pass
+ def add_literal_data(self, data): pass
+ def flush_softspace(self): pass
+ def push_font(self, x): pass
+ def pop_font(self): pass
+ def push_margin(self, margin): pass
+ def pop_margin(self): pass
+ def set_spacing(self, spacing): pass
+ def push_style(self, style): pass
+ def pop_style(self): pass
+
+
class AbstractFormatter:
def __init__(self, writer):
@@ -17,8 +36,8 @@ class AbstractFormatter:
self.margin_stack = [] # Margin state
self.spacing = None # Vertical spacing state
self.style_stack = [] # Other state, e.g. color
- self.nospace = 1 # Should leading space be suppressed
- self.softspace = 0 # Should a space be inserted
+ self.nospace = 1 # Should leading space be suppressed
+ self.softspace = 0 # Should a space be inserted
def end_paragraph(self, blankline):
if not self.nospace: