diff options
author | Joop Kiefte <ikojba@gmail.com> | 2018-12-31 22:55:30 +0100 |
---|---|---|
committer | Joop Kiefte <ikojba@gmail.com> | 2018-12-31 22:55:30 +0100 |
commit | 3b4f9775c15cf7c101c1759ee4e4f0fa0f5117dc (patch) | |
tree | 22b2eedfeddeb821350a343c4ca6aa0ac310a740 /fountain | |
parent | 6274d11f90365f8ba7077838582ceb9570189fc5 (diff) |
Add center alignment for title and refactor fountain parsing.
Diffstat (limited to 'fountain')
-rw-r--r-- | fountain/parse.go | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/fountain/parse.go b/fountain/parse.go index ba3a3e8..a3e1747 100644 --- a/fountain/parse.go +++ b/fountain/parse.go @@ -24,20 +24,21 @@ func Parse(file io.Reader) (out lex.Screenplay) { } if row == "" { action = "empty" - } else { - if i > 0 { - switch out[i-1].Type { - case "allcaps": - out[i-1].Type = "speaker" - if row[0] == '(' && row[len(row)-1] == ')' { - action = "paren" - } else { - action = "dialog" - } - case "paren", "dialog": - action = "dialog" - } + continue + } + if i <= 0 { + continue + } + switch out[i-1].Type { + case "allcaps": + out[i-1].Type = "speaker" + if row[0] == '(' && row[len(row)-1] == ')' { + action = "paren" + } else { + action = "dialog" } + case "paren", "dialog": + action = "dialog" } out = append(out, lex.Line{action, row}) } |