Add comments to metadata
Closes # 17
This commit is contained in:
parent
67d4f8a10a
commit
da7b3ad950
3
meta.go
3
meta.go
@ -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
|
||||||
|
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user