mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-12 20:13:59 +02:00
@@ -22,8 +22,10 @@ import (
|
||||
)
|
||||
|
||||
// Regexp definitions
|
||||
var keyMatchRegex = regexp.MustCompile(`\"(\w+)\":`)
|
||||
var wordBarrierRegex = regexp.MustCompile(`(\w)([A-Z])`)
|
||||
var (
|
||||
keyMatchRegex = regexp.MustCompile(`\"(\w+)\":`)
|
||||
wordBarrierRegex = regexp.MustCompile(`(\w)([A-Z])`)
|
||||
)
|
||||
|
||||
// Code adapted from https://gist.github.com/piersy/b9934790a8892db1a603820c0c23e4a7
|
||||
type LowerCaseCamelJSONMarshaller struct {
|
||||
@@ -36,7 +38,6 @@ func (c LowerCaseCamelJSONMarshaller) MarshalJSON() ([]byte, error) {
|
||||
converted := keyMatchRegex.ReplaceAllFunc(
|
||||
marshalled,
|
||||
func(match []byte) []byte {
|
||||
|
||||
// Attributes on the form XML, JSON etc.
|
||||
if bytes.Equal(match, bytes.ToUpper(match)) {
|
||||
return bytes.ToLower(match)
|
||||
|
Reference in New Issue
Block a user