aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Vilcans <martin@librador.com>2011-11-28 00:47:06 +0100
committerMartin Vilcans <martin@librador.com>2011-11-28 00:47:06 +0100
commit4d50fbdc2b58d9744e80b04518f22fb7a3da5699 (patch)
treed030b9f10c8e9c3543b15cb61f8f556aed5a6740
parent9d1530c9a13a5a6802ef907e27d41ff5d8252d3b (diff)
downloadscreenplain-4d50fbdc2b58d9744e80b04518f22fb7a3da5699.tar.gz
Slug and Transition support only one line.
Show that in parameter to __init__.
-rw-r--r--screenplain/parsers/spmd.py4
-rw-r--r--screenplain/types.py20
2 files changed, 14 insertions, 10 deletions
diff --git a/screenplain/parsers/spmd.py b/screenplain/parsers/spmd.py
index 6348d75..39e6b50 100644
--- a/screenplain/parsers/spmd.py
+++ b/screenplain/parsers/spmd.py
@@ -64,7 +64,7 @@ def _to_rich(line_list):
def create_paragraph(blanks_before, line_list):
if is_slug(blanks_before, line_list):
- return Slug(_to_rich(line_list))
+ return Slug(_to_rich(line_list)[0])
elif all(centered_re.match(line) for line in line_list):
return Action(_to_rich(
centered_re.match(line).group(1) for line in line_list
@@ -81,7 +81,7 @@ def create_paragraph(blanks_before, line_list):
):
# Assume this is a transition. It may be changed to Action
# later if we find that it's not followed by a slug.
- return Transition(_to_rich(line_list))
+ return Transition(_to_rich(line_list)[0])
else:
return Action(_to_rich(line_list))
diff --git a/screenplain/types.py b/screenplain/types.py
index 1eb7c26..1a82f5a 100644
--- a/screenplain/types.py
+++ b/screenplain/types.py
@@ -5,8 +5,12 @@ class Slug(object):
indent = ''
top_margin = 1
- def __init__(self, lines):
- self.line = lines[0]
+ def __init__(self, line):
+ self.line = line
+
+ @property
+ def lines(self):
+ return [self.line]
class Dialog(object):
@@ -88,17 +92,17 @@ class Action(object):
yield self.indent + line
-class Centered(Action):
- pass
-
-
class Transition(object):
indent = ''
fill = 68
top_margin = 1
- def __init__(self, lines):
- self.lines = lines
+ def __init__(self, line):
+ self.line = line
+
+ @property
+ def lines(self):
+ return [self.line]
def format(self):
for logical_line in self.lines: