mirror of
https://github.com/lancatlin/mdsh.git
synced 2026-11-08 11:40:12 +08:00
chore: make frontmatter optional
This commit is contained in:
1 parent
f976860f33
commit
88d6d98282
2 files changed
+12
-27
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user