From a596a34d9582311d72825430b8705db50acf6eb1 Mon Sep 17 00:00:00 2001 From: Joop Kiefte Date: Tue, 1 Jan 2019 02:55:59 +0100 Subject: Improving fountain support. Still not perfect, but steadily improving --- lex/parse.go | 8 ++++---- lex/type.go | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'lex') diff --git a/lex/parse.go b/lex/parse.go index e105a22..00a6cbd 100644 --- a/lex/parse.go +++ b/lex/parse.go @@ -1,8 +1,8 @@ package lex import ( - "io" "bufio" + "io" "strings" ) @@ -18,9 +18,9 @@ func Parse(file io.Reader) (out Screenplay) { var line Line s, err = f.ReadString('\n') split := strings.SplitN(s, ":", 2) - switch len(split){ - case 0,1: - line.Type = strings.Trim(s,": \n\r") + switch len(split) { + case 0, 1: + line.Type = strings.Trim(s, ": \n\r") case 2: line.Type = split[0] line.Contents = strings.TrimSpace(split[1]) diff --git a/lex/type.go b/lex/type.go index eec2f3e..a906ac2 100644 --- a/lex/type.go +++ b/lex/type.go @@ -3,8 +3,7 @@ package lex type Screenplay []Line -type Line struct{ - Type string +type Line struct { + Type string Contents string } - -- cgit v1.2.3-70-g09d2