summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoop Kiefte <ikojba@gmail.com>2020-11-20 09:33:12 +0200
committerJoop Kiefte <ikojba@gmail.com>2020-11-20 09:33:12 +0200
commitce24e1d516b3ebcf09acd620e6fe29f8912dd170 (patch)
tree7e202bbcf3cc6ae2c7676fa543475d7e18baafc6
parentd2102540519ea342485565845f64bb83c454cf26 (diff)
Fix empty first page issue
-rw-r--r--fountain/parse.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/fountain/parse.go b/fountain/parse.go
index 60ea6b5..161a611 100644
--- a/fountain/parse.go
+++ b/fountain/parse.go
@@ -110,6 +110,12 @@ func Parse(scenes []string, file io.Reader) (out lex.Screenplay) {
}
toParse = append(toParse, "") // Trigger the backtracking also for the last line
for _, row := range toParse {
+ if titlepage && !strings.Contains(toParse[0], ":") {
+ out = append(out, lex.Line{Type: "titlepage"})
+ out = append(out, lex.Line{Type: "Title", Contents: "Untitled"})
+ out = append(out, lex.Line{Type: "newpage"})
+ titlepage = false
+ }
row = strings.TrimRight(row, "\n\r")
action := "action"
if row == "" {