aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Vilcans <martin@librador.com>2012-02-19 22:42:29 +0100
committerMartin Vilcans <martin@librador.com>2012-02-19 22:42:29 +0100
commit84d6de1f11cee777e9d256b1e170794b58c3c08c (patch)
treea692abf77da2ab7f672626c8aa98b8233ecd8ba8
parentd16fe5395253c19e554efc332a3f038eac0ab2e8 (diff)
downloadscreenplain-84d6de1f11cee777e9d256b1e170794b58c3c08c.tar.gz
Transition must end with "TO:", not just ":"
New in Fountain spec.
-rw-r--r--screenplain/main.py1
-rw-r--r--screenplain/parsers/fountain.py10
-rw-r--r--tests/fountain_test.py8
3 files changed, 14 insertions, 5 deletions
diff --git a/screenplain/main.py b/screenplain/main.py
index 2fdfb9e..57ca371 100644
--- a/screenplain/main.py
+++ b/screenplain/main.py
@@ -30,6 +30,7 @@ def invalid_format(parser, message):
(message, ' '.join(output_formats))
)
+
def main(args):
parser = OptionParser(usage=usage)
parser.add_option(
diff --git a/screenplain/parsers/fountain.py b/screenplain/parsers/fountain.py
index 4083725..6e45171 100644
--- a/screenplain/parsers/fountain.py
+++ b/screenplain/parsers/fountain.py
@@ -27,7 +27,7 @@ dual_dialog_re = re.compile(r'^(.+?)(\s*\^)$')
slug_re = re.compile(r'(?:(\.)\s*)?(\S.*?)\s*$')
scene_number_re = re.compile(r'(.*?)\s*(?:#([\w\-.]+)#)\s*$')
section_re = re.compile(r'^(#{1,6})\s*([^#].*)$')
-transition_re = re.compile(r'(>?)\s*(.+?)(:?)$')
+transition_re = re.compile(r'(>?)\s*(.+?)(TO:)?$')
def _to_rich(line_or_line_list):
@@ -127,13 +127,13 @@ class InputParagraph(object):
match = transition_re.match(self.lines[0])
if not match:
return None
- greater_than, text, colon = match.groups()
+ greater_than, text, to_colon = match.groups()
if greater_than:
- return Transition(_to_rich(text.upper() + colon))
+ return Transition(_to_rich(text.upper() + (to_colon or '')))
- if text.isupper() and colon:
- return Transition(_to_rich(text + colon))
+ if text.isupper() and to_colon:
+ return Transition(_to_rich(text + to_colon))
return None
diff --git a/tests/fountain_test.py b/tests/fountain_test.py
index 99578cf..11a0939 100644
--- a/tests/fountain_test.py
+++ b/tests/fountain_test.py
@@ -217,6 +217,14 @@ class TransitionTests(unittest2.TestCase):
]))
self.assertEquals([Action, Transition, Slug], [type(p) for p in paras])
+ def test_transition_must_end_with_to(self):
+ paras = list(parse([
+ 'CUT TOO:',
+ '',
+ "EXT. BRICK'S POOL - DAY",
+ ]))
+ self.assertEquals([Action, Slug], [type(p) for p in paras])
+
def test_transition_needs_to_be_upper_case(self):
paras = list(parse([
'Jack begins to argue vociferously in Vietnamese (?)',