Add comments to metadata

Closes # 17
This commit is contained in:
Sasha Koshka 2024-12-12 03:13:14 -05:00
parent 67d4f8a10a
commit da7b3ad950
2 changed files with 4 additions and 1 deletions

View File

@ -48,7 +48,8 @@ func ParseMeta (input string) (Meta, error) {
meta := make(Meta) meta := make(Meta)
for _, line := range strings.Split(input, "\n") { for _, line := range strings.Split(input, "\n") {
line = strings.TrimSpace(line) line = strings.TrimSpace(line)
if line == "" { continue } if line == "" { continue }
if strings.HasPrefix(line, "#") { continue }
key, value, ok := strings.Cut(line, ":") key, value, ok := strings.Cut(line, ":")
if !ok { if !ok {
return nil, ErrMetaMalformed return nil, ErrMetaMalformed

View File

@ -20,6 +20,8 @@ FOO: baR
Shouldn't break anything: --- Shouldn't break anything: ---
this : that this : that
# a comment
#also a comment
Sentence: ` + quickBrownFox + ` Sentence: ` + quickBrownFox + `
--- ---
` + correctBody) ` + correctBody)