aboutsummaryrefslogtreecommitdiffhomepage
path: root/parser/lowercase_camel_json.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2020-03-20 16:34:53 +0100
committerBjørn Erik Pedersen <[email protected]>2020-03-20 20:35:57 +0100
commit7204b354a9f46778f068a4712447d6d4fefbefd8 (patch)
treea7d58d64fb9266f5c3f28251cb677b245925e728 /parser/lowercase_camel_json.go
parent574c2959b8d3338764fa1db102a5e0fd6ed322d9 (diff)
downloadhugo-7204b354a9f46778f068a4712447d6d4fefbefd8.tar.gz
hugo-7204b354a9f46778f068a4712447d6d4fefbefd8.zip
Some minify configuration adjustments
Diffstat (limited to 'parser/lowercase_camel_json.go')
-rw-r--r--parser/lowercase_camel_json.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/parser/lowercase_camel_json.go b/parser/lowercase_camel_json.go
index e7aeb2abf..6994d1215 100644
--- a/parser/lowercase_camel_json.go
+++ b/parser/lowercase_camel_json.go
@@ -14,6 +14,7 @@
package parser
import (
+ "bytes"
"encoding/json"
"regexp"
"unicode"
@@ -35,6 +36,12 @@ 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)
+ }
+
// Empty keys are valid JSON, only lowercase if we do not have an
// empty key.
if len(match) > 2 {