chore: make frontmatter optional

This commit is contained in:
Justin Lin committed 2025-07-25 13:35:02 +10:00
1 parent f976860f33
commit 88d6d98282
2 files changed
+12 -27

No files matched your search

+2 -19
View File
@@ -6,28 +6,11 @@ import (
"os"
)
var TMPL_EXAMPLE = `
---
output: "reports/${from}.md"
params:
from:
required: true
file:
default: "ledger.j"
---
Hello this is the text:
Start from {{ .from }}
{{ sh "hledger bal assets -b $from" }}
`
func main() {
tmpl, err := loadTemplate()
doc, err := loadTemplate()
handleError(err)
frontmatter, body, err := parseDocument(tmpl)
handleError(err)
templateMeta, err := parseFrontmatter(frontmatter)
templateMeta, body, err := parseDocument(doc)
handleError(err)
ctx, err := parseParams(templateMeta)