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 /pdf/create.go | |
parent | 99ebe57d73abe7448da656b9122e98f3f5b151b3 (diff) |
Gofmt and improving front page support
Diffstat (limited to 'pdf/create.go')
-rw-r--r-- | pdf/create.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pdf/create.go b/pdf/create.go index 52c3122..f4346a1 100644 --- a/pdf/create.go +++ b/pdf/create.go @@ -16,23 +16,30 @@ type Tree struct { } func (t Tree) pr(a string, text string) { - line(t.PDF, t.Rules.Get(a), text) + line(t.PDF, t.Rules.Get(a), t.Rules.Get(a).Prefix+text+t.Rules.Get(a).Postfix) } func (t Tree) Render() { + var block string for _, row := range t.F { switch row.Type { case "newpage": + block = "" t.PDF.AddPage() continue case "titlepage": + block = "title" t.PDF.SetY(4) case "metasection": + block = "meta" t.PDF.SetY(-2) } - if t.Rules.Get(row.Type).Hide { + if t.Rules.Get(row.Type).Hide && block == "" { continue } + if block != "" { + row.Type = block + } t.pr(row.Type, row.Contents) } } |