Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions screenplain/export/fdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions screenplain/export/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions screenplain/export/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion screenplain/parsers/fountain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions screenplain/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,8 @@ def lines(self):

class PageBreak(object):
pass


class Synopse(object):
def __init__(self, synopse):
self.synopse = synopse