diff --git a/screenplain/export/fdx.py b/screenplain/export/fdx.py index 85cc0ab..3a4c297 100644 --- a/screenplain/export/fdx.py +++ b/screenplain/export/fdx.py @@ -91,6 +91,9 @@ def to_fdx(screenplay, out): write_paragraph(out, 'Scene Heading', para.lines) elif isinstance(para, Transition): write_paragraph(out, 'Transition', para.lines) + elif isinstance(para, Synopse): + # Ignore synopses + pass else: # Ignore unknown types pass diff --git a/screenplain/export/html.py b/screenplain/export/html.py index 81c0f8b..af36422 100644 --- a/screenplain/export/html.py +++ b/screenplain/export/html.py @@ -84,6 +84,7 @@ def __init__(self, out): Transition: self.format_transition, Section: self.format_section, PageBreak: self.format_page_break, + Synopse: self.format_synopse, } def convert(self, screenplay): @@ -159,6 +160,9 @@ def format_transition(self, para): def format_page_break(self, para): self.page_break_before_next = True + def format_synopse(self, para): + pass + def _tag(self, tag_name, classes=[]): if self.page_break_before_next: self.page_break_before_next = False diff --git a/screenplain/export/pdf.py b/screenplain/export/pdf.py index 6955616..0b03bbe 100644 --- a/screenplain/export/pdf.py +++ b/screenplain/export/pdf.py @@ -265,6 +265,9 @@ def to_pdf( add_paragraph(story, para, transition_style) elif isinstance(para, types.PageBreak): story.append(platypus.PageBreak()) + elif isinstance(para, types.Synopse): + # Ignore synopses + pass else: # Ignore unknown types pass diff --git a/screenplain/parsers/fountain.py b/screenplain/parsers/fountain.py index 7f367aa..eabc978 100644 --- a/screenplain/parsers/fountain.py +++ b/screenplain/parsers/fountain.py @@ -7,7 +7,7 @@ import re from screenplain.types import ( - Slug, Action, Dialog, DualDialog, Transition, Section, PageBreak, + Slug, Action, Dialog, DualDialog, Transition, Section, PageBreak, Synopse, Screenplay ) from screenplain.richstring import parse_emphasis, plain @@ -35,6 +35,7 @@ transition_re = re.compile(r'(>?)\s*(.+?)(TO:)?$') page_break_re = re.compile(r'^={3,}$') note_re = re.compile(r'\[\[.*?\]\]', re.DOTALL) +synopse_re = re.compile(r'^=([^=].*)?') def _sequence_to_rich(lines): @@ -58,6 +59,7 @@ def update_list(self, previous_paragraphs): """ ( self.append_page_break(previous_paragraphs) or + self.append_synopse(previous_paragraphs) or self.append_synopsis(previous_paragraphs) or self.append_sections_and_synopsises(previous_paragraphs) or self.append_slug(previous_paragraphs) or @@ -195,6 +197,16 @@ def append_page_break(self, paragraphs): else: return False + def append_synopse(self, paragraphs): + found_synopse = False + for line in self.lines: + synopse = synopse_re.match(line) + if synopse: + paragraphs.append(Synopse((synopse.group(1) or "").strip())) + found_synopse = True + + return found_synopse + def _preprocess_line(raw_line): r"""Replaces tabs with spaces and removes trailing end of line markers. diff --git a/screenplain/types.py b/screenplain/types.py index 0325148..975a694 100644 --- a/screenplain/types.py +++ b/screenplain/types.py @@ -133,3 +133,8 @@ def lines(self): class PageBreak(object): pass + + +class Synopse(object): + def __init__(self, synopse): + self.synopse = synopse