mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-28 06:30:33 +03:00
Create a struct with all of Hugo's config options
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes #10896 Closes #10620
This commit is contained in:
parent
6aededf6b4
commit
241b21b0fd
337 changed files with 13377 additions and 14898 deletions
|
@ -35,17 +35,13 @@ import (
|
|||
func NewConverterProvider(cfg converter.ProviderConfig) (ConverterProvider, error) {
|
||||
converters := make(map[string]converter.Provider)
|
||||
|
||||
markupConfig, err := markup_config.Decode(cfg.Cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mcfg := cfg.MarkupConfig()
|
||||
|
||||
if cfg.Highlighter == nil {
|
||||
cfg.Highlighter = highlight.New(markupConfig.Highlight)
|
||||
cfg.Highlighter = highlight.New(mcfg.Highlight)
|
||||
}
|
||||
|
||||
cfg.MarkupConfig = markupConfig
|
||||
defaultHandler := cfg.MarkupConfig.DefaultMarkdownHandler
|
||||
defaultHandler := mcfg.DefaultMarkdownHandler
|
||||
var defaultFound bool
|
||||
|
||||
add := func(p converter.ProviderProvider, aliases ...string) error {
|
||||
|
@ -123,7 +119,7 @@ func (r *converterRegistry) GetHighlighter() highlight.Highlighter {
|
|||
}
|
||||
|
||||
func (r *converterRegistry) GetMarkupConfig() markup_config.Config {
|
||||
return r.config.MarkupConfig
|
||||
return r.config.MarkupConfig()
|
||||
}
|
||||
|
||||
func addConverter(m map[string]converter.Provider, c converter.Provider, aliases ...string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue