Skip to content

Commit

Permalink
bug: allow space in metadata name
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuildthecloud committed Oct 10, 2024
1 parent 822efeb commit 8a0f8c6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
sepRegex = regexp.MustCompile(`^\s*---+\s*$`)
endHeaderRegex = regexp.MustCompile(`^\s*===+\s*$`)
strictSepRegex = regexp.MustCompile(`^---\n$`)
skipRegex = regexp.MustCompile(`^![-.:*\w]+\s*$`)
skipRegex = regexp.MustCompile(`^![ -.:*\w]+\s*$`)
nameRegex = regexp.MustCompile(`^[a-z]+$`)
)

Expand Down
17 changes: 17 additions & 0 deletions pkg/parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,23 @@ share output filters: shared
}}).Equal(t, out)
}

func TestParseMetaDataSpace(t *testing.T) {
input := `
name: a space
body
---
!metadata:a space:other
foo bar
`
tools, err := ParseTools(strings.NewReader(input))
require.NoError(t, err)

assert.Len(t, tools, 1)
autogold.Expect(map[string]string{
"other": "foo bar",
}).Equal(t, tools[0].MetaData)
}

func TestParseMetaData(t *testing.T) {
input := `
name: first
Expand Down

0 comments on commit 8a0f8c6

Please sign in to comment.