aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Vilcans <martin@librador.com>2012-02-01 22:59:05 +0100
committerMartin Vilcans <martin@librador.com>2012-02-01 23:00:05 +0100
commit45ae626de30f9676aa6a16f868644f2054e65074 (patch)
tree0785a96fc208b48ef8fcb4afd7189cc8394979a3
parent801d04db2238c8f93c5762bbb291ac9af40995b5 (diff)
downloadscreenplain-45ae626de30f9676aa6a16f868644f2054e65074.tar.gz
Don't count number of blank lines between paragraphs.
It's not needed by the latest spec.
-rw-r--r--screenplain/parsers/spmd.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/screenplain/parsers/spmd.py b/screenplain/parsers/spmd.py
index 8826d9f..7df7ce3 100644
--- a/screenplain/parsers/spmd.py
+++ b/screenplain/parsers/spmd.py
@@ -41,8 +41,7 @@ def _to_rich(line_or_line_list):
class InputParagraph(object):
- def __init__(self, blanks_before, lines):
- self.blanks_before = 0
+ def __init__(self, lines):
self.lines = lines
def update_list(self, previous_paragraphs):
@@ -142,14 +141,11 @@ def _is_blank(line):
def parse(source):
"""Reads raw text input and generates paragraph objects."""
- blank_count = 0
source = (_preprocess_line(line) for line in source)
paragraphs = []
for blank, input_lines in itertools.groupby(source, _is_blank):
- if blank:
- blank_count = sum(1 for line in input_lines)
- else:
- paragraph = InputParagraph(blank_count, list(input_lines))
+ if not blank:
+ paragraph = InputParagraph(list(input_lines))
paragraph.update_list(paragraphs)
return paragraphs