Skip to content

Commit

Permalink
fixed cross platform empty line detection
Browse files Browse the repository at this point in the history
the culling stage of the parse strips lines before anything else to allow for easier detection of a break line across platforms
  • Loading branch information
njunius committed Jul 9, 2020
1 parent eac5998 commit 179cbf0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/optional/scene_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ def __init__(self, scene_script, stage_directions = False):
# the scene as read directly from the file opened and passed in as scene_script
# local variable since this information is not useful in future usage at this time and takes up memory
scene_script_raw = scene_script.readlines()

# the scene with all the empty line breaks removed and leading and trailing whitespace removed
# local variable since this information is not useful in future usage at this time and takes up memory
script_new_line_culled = []

for line in scene_script_raw:
if line != '\n':
script_new_line_culled.append(line.strip())
# strip the line to make cross-platform detection of an empty line simpler
stripped_line = line.strip()
if stripped_line != '':
script_new_line_culled.append(stripped_line)

# process the stripped line into the ('<character name>', '<character dialogue>') tuple format
for line in script_new_line_culled:
Expand Down

0 comments on commit 179cbf0

Please sign in to comment.