diff options
author | Martin Vilcans <martin@librador.com> | 2019-02-21 21:27:47 +0100 |
---|---|---|
committer | Martin Vilcans <martin@librador.com> | 2019-02-21 21:27:47 +0100 |
commit | 815a2c80c88bf78afc15caa7f2389ee155b5020f (patch) | |
tree | 9fdd269be0494be76f1167de7d86e513f93a8fc1 | |
parent | 4704104f02dfa5b49dd11a5e90c04101ef320bc1 (diff) | |
download | screenplain-815a2c80c88bf78afc15caa7f2389ee155b5020f.tar.gz |
Do not create empty paragraph if Note is a full paragraph
-rw-r--r-- | screenplain/parsers/fountain.py | 2 | ||||
-rw-r--r-- | tests/files/notes.fountain | 14 | ||||
-rw-r--r-- | tests/files/notes.fountain.html | 4 |
3 files changed, 20 insertions, 0 deletions
diff --git a/screenplain/parsers/fountain.py b/screenplain/parsers/fountain.py index 1a72aa7..c2f6d71 100644 --- a/screenplain/parsers/fountain.py +++ b/screenplain/parsers/fountain.py @@ -255,6 +255,8 @@ def parse_body(source): for blank, input_lines in itertools.groupby(source, _is_blank): if not blank: as_string = note_re.sub('', '\n'.join(input_lines)) + if _is_blank(as_string): + continue paragraph = InputParagraph(as_string.split('\n')) paragraph.update_list(paragraphs) diff --git a/tests/files/notes.fountain b/tests/files/notes.fountain index 1e68fd2..f72b4fc 100644 --- a/tests/files/notes.fountain +++ b/tests/files/notes.fountain @@ -16,3 +16,17 @@ a proper note because it contains a blank line ]] + +Before full paragraph note + +[[Note as its own paragraph does not generate an empty paragraph]] + +After full paragraph note + +Before multi-paragraph note + +[[Note as its own paragraph +on several lines +does not generate an empty paragraph]] + +After multi-paragraph note diff --git a/tests/files/notes.fountain.html b/tests/files/notes.fountain.html index 033f63c..f9558bc 100644 --- a/tests/files/notes.fountain.html +++ b/tests/files/notes.fountain.html @@ -4,3 +4,7 @@ <div class="action"><p>Multiple on one</p></div> <div class="action"><p>This is not [[<br/>a proper note</p></div> <div class="action"><p>because it contains a blank line<br/>]]</p></div> +<div class="action"><p>Before full paragraph note</p></div> +<div class="action"><p>After full paragraph note</p></div> +<div class="action"><p>Before multi-paragraph note</p></div> +<div class="action"><p>After multi-paragraph note</p></div> |