Skip to content

Commit 09c4155

Browse files
bug: allow space in metadata name
1 parent 822efeb commit 09c4155

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

pkg/parser/parser.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var (
1818
sepRegex = regexp.MustCompile(`^\s*---+\s*$`)
1919
endHeaderRegex = regexp.MustCompile(`^\s*===+\s*$`)
2020
strictSepRegex = regexp.MustCompile(`^---\n$`)
21-
skipRegex = regexp.MustCompile(`^![-.:*\w]+\s*$`)
21+
skipRegex = regexp.MustCompile(`^![ -.:*\w]+\s*$`)
2222
nameRegex = regexp.MustCompile(`^[a-z]+$`)
2323
)
2424

pkg/parser/parser_test.go

+17
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,23 @@ share output filters: shared
242242
}}).Equal(t, out)
243243
}
244244

245+
func TestParseMetaDataSpace(t *testing.T) {
246+
input := `
247+
name: a space
248+
body
249+
---
250+
!metadata:a space:other
251+
foo bar
252+
`
253+
tools, err := ParseTools(strings.NewReader(input))
254+
require.NoError(t, err)
255+
256+
assert.Len(t, tools, 1)
257+
autogold.Expect(map[string]string{
258+
"other": "foo bar",
259+
}).Equal(t, tools[0].MetaData)
260+
}
261+
245262
func TestParseMetaData(t *testing.T) {
246263
input := `
247264
name: first

0 commit comments

Comments
 (0)