mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Return early from parseOptions
This commit is contained in:
parent
02e50c0126
commit
8d86f1ec6e
1 changed files with 11 additions and 8 deletions
|
@ -158,15 +158,18 @@ func init() {
|
|||
|
||||
func parseOptions(options map[string]string, in string) error {
|
||||
in = strings.Trim(in, " ")
|
||||
if in != "" {
|
||||
for _, v := range strings.Split(in, ",") {
|
||||
keyVal := strings.Split(v, "=")
|
||||
key := strings.ToLower(strings.Trim(keyVal[0], " "))
|
||||
if len(keyVal) != 2 || !pygmentsKeywords[key] {
|
||||
return fmt.Errorf("invalid Pygments option: %s", key)
|
||||
}
|
||||
options[key] = keyVal[1]
|
||||
|
||||
if in == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
for _, v := range strings.Split(in, ",") {
|
||||
keyVal := strings.Split(v, "=")
|
||||
key := strings.ToLower(strings.Trim(keyVal[0], " "))
|
||||
if len(keyVal) != 2 || !pygmentsKeywords[key] {
|
||||
return fmt.Errorf("invalid Pygments option: %s", key)
|
||||
}
|
||||
options[key] = keyVal[1]
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue