Update to go v1.16 and embed more extensive default blorg.org

Instead of the bare bones default config we embedded as a string until now we
can use go 1.16 embed to embed the test blorg.org which makes a much better
starting config (if only to see what's possible).
This commit is contained in:
Niklas Fasching 2021-03-01 14:10:13 +01:00
parent 02df432d76
commit 703066682e
4 changed files with 13 additions and 19 deletions

View file

@ -16,6 +16,8 @@ import (
"strings"
"time"
_ "embed"
"github.com/niklasfasching/go-org/org"
)
@ -31,22 +33,8 @@ type Config struct {
var DefaultConfigFile = "blorg.org"
var DefaultConfig = `
#+CONTENT: content
#+PUBLIC: public
* templates
** item
#+name: item
#+begin_src html
{{ . }}
#+end_src
** list
#+name: list
#+begin_src html
{{ . }}
#+end_src`
//go:embed testdata/blorg.org
var DefaultConfig string
var TemplateFuncs = map[string]interface{}{
"Slugify": slugify,
@ -195,7 +183,7 @@ func (c *Config) RenderContent() ([]*Page, error) {
func (c *Config) RenderLists(pages []*Page) error {
ms := toMap(c.OrgConfig.DefaultSettings, nil)
ms["Pages"] = pages
lists := map[string]map[string][]interface{}{"": map[string][]interface{}{"": nil}}
lists := map[string]map[string][]interface{}{"": {"": nil}}
for _, p := range pages {
if p.BufferSettings["DRAFT"] != "" {
continue