mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-13 20:24:00 +02:00
Correct initialisms as suggested by golint
First step to use initialisms that golint suggests, for example: Line 116: func GetHtmlRenderer should be GetHTMLRenderer as see on http://goreportcard.com/report/spf13/hugo Thanks to @bep for the idea! Note that command-line flags (cobra and pflag) as well as struct fields like .BaseUrl and .Url that are used in Go HTML templates need more work to maintain backward-compatibility, and thus are NOT yet dealt with in this commit. First step in fixing #959.
This commit is contained in:
@@ -151,30 +151,30 @@ func FormatSanitize(kind string) string {
|
||||
func DetectFrontMatter(mark rune) (f *FrontmatterType) {
|
||||
switch mark {
|
||||
case '-':
|
||||
return &FrontmatterType{[]byte(YAML_DELIM), []byte(YAML_DELIM), HandleYamlMetaData, false}
|
||||
return &FrontmatterType{[]byte(YAML_DELIM), []byte(YAML_DELIM), HandleYAMLMetaData, false}
|
||||
case '+':
|
||||
return &FrontmatterType{[]byte(TOML_DELIM), []byte(TOML_DELIM), HandleTomlMetaData, false}
|
||||
return &FrontmatterType{[]byte(TOML_DELIM), []byte(TOML_DELIM), HandleTOMLMetaData, false}
|
||||
case '{':
|
||||
return &FrontmatterType{[]byte{'{'}, []byte{'}'}, HandleJsonMetaData, true}
|
||||
return &FrontmatterType{[]byte{'{'}, []byte{'}'}, HandleJSONMetaData, true}
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func HandleTomlMetaData(datum []byte) (interface{}, error) {
|
||||
func HandleTOMLMetaData(datum []byte) (interface{}, error) {
|
||||
m := map[string]interface{}{}
|
||||
datum = removeTomlIdentifier(datum)
|
||||
datum = removeTOMLIdentifier(datum)
|
||||
if _, err := toml.Decode(string(datum), &m); err != nil {
|
||||
return m, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func removeTomlIdentifier(datum []byte) []byte {
|
||||
func removeTOMLIdentifier(datum []byte) []byte {
|
||||
return bytes.Replace(datum, []byte(TOML_DELIM), []byte(""), -1)
|
||||
}
|
||||
|
||||
func HandleYamlMetaData(datum []byte) (interface{}, error) {
|
||||
func HandleYAMLMetaData(datum []byte) (interface{}, error) {
|
||||
m := map[string]interface{}{}
|
||||
if err := yaml.Unmarshal(datum, &m); err != nil {
|
||||
return m, err
|
||||
@@ -182,7 +182,7 @@ func HandleYamlMetaData(datum []byte) (interface{}, error) {
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func HandleJsonMetaData(datum []byte) (interface{}, error) {
|
||||
func HandleJSONMetaData(datum []byte) (interface{}, error) {
|
||||
var f interface{}
|
||||
if err := json.Unmarshal(datum, &f); err != nil {
|
||||
return f, err
|
||||
|
Reference in New Issue
Block a user