diff options
author | Joop Kiefte <ikojba@gmail.com> | 2019-01-12 05:03:06 +0100 |
---|---|---|
committer | Joop Kiefte <ikojba@gmail.com> | 2019-01-12 05:03:06 +0100 |
commit | a6318ee25fac188de4ffb2d568c0a73d242207df (patch) | |
tree | dc420521db16cd7b1b3a64c1f48989ea380d8755 /fountain/parse.go | |
parent | 99ebe57d73abe7448da656b9122e98f3f5b151b3 (diff) |
Gofmt and improving front page support
Diffstat (limited to 'fountain/parse.go')
-rw-r--r-- | fountain/parse.go | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/fountain/parse.go b/fountain/parse.go index 2d0b0b7..abc3164 100644 --- a/fountain/parse.go +++ b/fountain/parse.go @@ -142,24 +142,24 @@ func Parse(file io.Reader) (out lex.Screenplay) { dialog = true } - checkfuncs := []func(string) (bool, string, string){ - CheckScene, // should actually check for empty lines, but doing that creates more problems than it solves - CheckCrow, - CheckEqual, - CheckSection, - CheckForce, - } - for _, checkfunc := range checkfuncs { - check, element, contents := checkfunc(row) - if check { - action = element - row = contents - if action == "speaker" { - dialog = true - } - break + checkfuncs := []func(string) (bool, string, string){ + CheckScene, // should actually check for empty lines, but doing that creates more problems than it solves + CheckCrow, + CheckEqual, + CheckSection, + CheckForce, + } + for _, checkfunc := range checkfuncs { + check, element, contents := checkfunc(row) + if check { + action = element + row = contents + if action == "speaker" { + dialog = true } + break } + } if titlepage { if titletag == "" { @@ -167,21 +167,20 @@ func Parse(file io.Reader) (out lex.Screenplay) { } split := strings.SplitN(row, ":", 2) if len(split) == 2 { - action = strings.ToLower(split[0]) - switch action { + action = split[0] + switch strings.ToLower(action) { case "title", "credit", "author", "authors": - action = "title" + titletag = "title" default: if titletag == "title" { out = append(out, lex.Line{Type: "metasection"}) } - action = "meta" + titletag = action } row = strings.TrimSpace(split[1]) if row == "" { continue } - titletag = action } else { action = titletag row = strings.TrimSpace(row) |