diff --git a/pkg/renderer/renderer.go b/pkg/renderer/renderer.go index 66e7563..980332b 100644 --- a/pkg/renderer/renderer.go +++ b/pkg/renderer/renderer.go @@ -17,11 +17,10 @@ type renderer struct { } func (r *renderer) Render(w io.Writer) error { - if err := Header(r.s.Header).Render(w); err != nil { - return err - } - - return nil + return Write(w, + Header(r.s.Header), + Spacer(), + Footer(r.s.Footer)) } func New(s *spec.Spec) Renderer { @@ -59,3 +58,22 @@ func (s *stringer) Render(w io.Writer) error { func Header(header string) Node { return &stringer{text: header} } + +func Footer(footer string) Node { + return &stringer{text: footer} +} + +func Spacer() Node { + return &stringer{text: "\n"} +} + +func Write(out io.Writer, fn ...Renderer) error { + for _, f := range fn { + err := f.Render(out) + if err != nil { + return err + } + } + + return nil +} diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go index 142e4c0..7647d8d 100644 --- a/pkg/spec/spec.go +++ b/pkg/spec/spec.go @@ -38,7 +38,9 @@ type Spec struct { // Description is a short description of the project or repository (optional) Description string `yaml:"description,omitempty"` // Header is the header of the markdown file - Header string `yaml:"header"` + Header string `yaml:"header"` + // Footer is the footer of the markdown file + Footer string `yaml:"footer"` Groups []Group `yaml:"groups"` Contents ContentsConfig `yaml:"contents"` EntryConfig EntryConfig `yaml:"entry"`