aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Vilcans <martin@librador.com>2012-07-10 00:40:49 +0200
committerMartin Vilcans <martin@librador.com>2012-07-10 00:40:49 +0200
commitf0fea172c34f62f8a35b1c28549e25e4a30589c5 (patch)
treeb0ec59efc9d32500ce0d5aac3a3489523fb91934
parent6b8ecde671306398f1c242df74ef918e12724f35 (diff)
downloadscreenplain-f0fea172c34f62f8a35b1c28549e25e4a30589c5.tar.gz
Strip leading and trailing whitespace from character names.
Closes #2
-rw-r--r--screenplain/parsers/fountain.py2
-rw-r--r--tests/files/dialogue.fountain5
-rw-r--r--tests/files/dialogue.fountain.fdx17
-rw-r--r--tests/files/dialogue.fountain.html2
4 files changed, 25 insertions, 1 deletions
diff --git a/screenplain/parsers/fountain.py b/screenplain/parsers/fountain.py
index 7fda23d..f48e94c 100644
--- a/screenplain/parsers/fountain.py
+++ b/screenplain/parsers/fountain.py
@@ -118,7 +118,7 @@ class InputParagraph(object):
def _create_dialog(self, character):
return Dialog(
- parse_emphasis(character),
+ parse_emphasis(character.strip()),
_to_rich(line.strip() for line in self.lines[1:])
)
diff --git a/tests/files/dialogue.fountain b/tests/files/dialogue.fountain
new file mode 100644
index 0000000..e4a2ac2
--- /dev/null
+++ b/tests/files/dialogue.fountain
@@ -0,0 +1,5 @@
+GIRL
+Let me tell you something.
+
+ GUY
+ I don't wanna.
diff --git a/tests/files/dialogue.fountain.fdx b/tests/files/dialogue.fountain.fdx
new file mode 100644
index 0000000..4953b17
--- /dev/null
+++ b/tests/files/dialogue.fountain.fdx
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+<FinalDraft DocumentType="Script" Template="No" Version="1">
+<Content>
+<Paragraph Type="Character">
+<Text>GIRL</Text>
+</Paragraph>
+<Paragraph Type="Dialogue">
+<Text>Let me tell you something.</Text>
+</Paragraph>
+<Paragraph Type="Character">
+<Text>GUY</Text>
+</Paragraph>
+<Paragraph Type="Dialogue">
+<Text>I don't wanna.</Text>
+</Paragraph>
+</Content>
+</FinalDraft>
diff --git a/tests/files/dialogue.fountain.html b/tests/files/dialogue.fountain.html
new file mode 100644
index 0000000..9b19719
--- /dev/null
+++ b/tests/files/dialogue.fountain.html
@@ -0,0 +1,2 @@
+<div class="dialog"><p class="character">GIRL</p><p>Let me tell you something.</p></div>
+<div class="dialog"><p class="character">GUY</p><p>I don't wanna.</p></div>