File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -39,15 +39,18 @@ def __repr__(self):
39
39
40
40
class Fountain :
41
41
def __init__ (self , string = None , path = None ):
42
+ self .metadata = dict ()
43
+ self .elements = list ()
44
+
42
45
if path :
43
46
with open (path ) as fp :
44
47
self .contents = fp .read ()
45
48
else :
46
49
self .contents = string
47
- self .parse ()
50
+ if self .contents != '' :
51
+ self .parse ()
48
52
49
53
def parse (self ):
50
- self .metadata = dict ()
51
54
contents = self .contents .strip ().replace ('\r ' , '' )
52
55
if ':' in contents .splitlines ()[0 ]:
53
56
script_head , script_body = contents .split ('\n \n ' , 1 )
@@ -74,7 +77,6 @@ def _parse_body(self, script_body):
74
77
is_inside_dialogue_block = False
75
78
newlines_before = 0
76
79
index = - 1
77
- self .elements = list ()
78
80
comment_text = list ()
79
81
80
82
for linenum , line in enumerate (script_body ):
You can’t perform that action at this time.
0 commit comments