"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "markup/markup_config/config.go" between
hugo-0.80.0.tar.gz and hugo-0.81.0.tar.gz

About: Hugo is a static site generator that takes a source directory of Markdown files and templates and uses these as input to create a complete website (written in Go).

config.go  (hugo-0.80.0):config.go  (hugo-0.81.0)
skipping to change at line 17 skipping to change at line 17
// //
// Unless required by applicable law or agreed to in writing, software // Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, // distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package markup_config package markup_config
import ( import (
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/config" "github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/docshelper" "github.com/gohugoio/hugo/docshelper"
"github.com/gohugoio/hugo/markup/asciidocext/asciidocext_config" "github.com/gohugoio/hugo/markup/asciidocext/asciidocext_config"
"github.com/gohugoio/hugo/markup/blackfriday/blackfriday_config" "github.com/gohugoio/hugo/markup/blackfriday/blackfriday_config"
"github.com/gohugoio/hugo/markup/goldmark/goldmark_config" "github.com/gohugoio/hugo/markup/goldmark/goldmark_config"
"github.com/gohugoio/hugo/markup/highlight" "github.com/gohugoio/hugo/markup/highlight"
"github.com/gohugoio/hugo/markup/tableofcontents" "github.com/gohugoio/hugo/markup/tableofcontents"
"github.com/gohugoio/hugo/parser" "github.com/gohugoio/hugo/parser"
"github.com/mitchellh/mapstructure" "github.com/mitchellh/mapstructure"
"github.com/spf13/cast"
) )
type Config struct { type Config struct {
// Default markdown handler for md/markdown extensions. // Default markdown handler for md/markdown extensions.
// Default is "goldmark". // Default is "goldmark".
// Before Hugo 0.60 this was "blackfriday". // Before Hugo 0.60 this was "blackfriday".
DefaultMarkdownHandler string DefaultMarkdownHandler string
Highlight highlight.Config Highlight highlight.Config
TableOfContents tableofcontents.Config TableOfContents tableofcontents.Config
skipping to change at line 51 skipping to change at line 53
AsciidocExt asciidocext_config.Config AsciidocExt asciidocext_config.Config
} }
func Decode(cfg config.Provider) (conf Config, err error) { func Decode(cfg config.Provider) (conf Config, err error) {
conf = Default conf = Default
m := cfg.GetStringMap("markup") m := cfg.GetStringMap("markup")
if m == nil { if m == nil {
return return
} }
normalizeConfig(m)
err = mapstructure.WeakDecode(m, &conf) err = mapstructure.WeakDecode(m, &conf)
if err != nil { if err != nil {
return return
} }
if err = applyLegacyConfig(cfg, &conf); err != nil { if err = applyLegacyConfig(cfg, &conf); err != nil {
return return
} }
if err = highlight.ApplyLegacyConfig(cfg, &conf.Highlight); err != nil { if err = highlight.ApplyLegacyConfig(cfg, &conf.Highlight); err != nil {
return return
} }
return return
} }
func normalizeConfig(m map[string]interface{}) {
v, err := maps.GetNestedParam("goldmark.parser", ".", m)
if err != nil {
return
}
vm := cast.ToStringMap(v)
// Changed from a bool in 0.81.0
if vv, found := vm["attribute"]; found {
if vvb, ok := vv.(bool); ok {
vm["attribute"] = goldmark_config.ParserAttribute{
Title: vvb,
}
}
}
}
func applyLegacyConfig(cfg config.Provider, conf *Config) error { func applyLegacyConfig(cfg config.Provider, conf *Config) error {
if bm := cfg.GetStringMap("blackfriday"); bm != nil { if bm := cfg.GetStringMap("blackfriday"); bm != nil {
// Legacy top level blackfriday config. // Legacy top level blackfriday config.
err := mapstructure.WeakDecode(bm, &conf.BlackFriday) err := mapstructure.WeakDecode(bm, &conf.BlackFriday)
if err != nil { if err != nil {
return err return err
} }
} }
if conf.BlackFriday.FootnoteAnchorPrefix == "" { if conf.BlackFriday.FootnoteAnchorPrefix == "" {
 End of changes. 4 change blocks. 
0 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)