Remove the now superflous defaultExtension

And some other unsed fields and methods.
This commit is contained in:
Bjørn Erik Pedersen 2017-03-25 16:09:56 +01:00
parent 15b64d51da
commit ee75e2999b
12 changed files with 4 additions and 88 deletions

View file

@ -129,7 +129,6 @@ func (p *PathSpec) URLEscape(uri string) string {
// base: http://spf13.com/
// path: post/how-i-blog
// result: http://spf13.com/post/how-i-blog
// TODO(bep) output check why this is still in use.
func MakePermalink(host, plink string) *url.URL {
base, err := url.Parse(host)

View file

@ -86,7 +86,6 @@ func loadDefaultSettingsFor(v *viper.Viper) {
v.SetDefault("taxonomies", map[string]string{"tag": "tags", "category": "categories"})
v.SetDefault("permalinks", make(PermalinkOverrides, 0))
v.SetDefault("sitemap", Sitemap{Priority: -1, Filename: "sitemap.xml"})
v.SetDefault("defaultExtension", "html")
v.SetDefault("pygmentsStyle", "monokai")
v.SetDefault("pygmentsUseClasses", false)
v.SetDefault("pygmentsCodeFences", false)

View file

@ -28,7 +28,6 @@ func TestDefaultHandler(t *testing.T) {
cfg, fs = newTestCfg()
)
cfg.Set("defaultExtension", "html")
cfg.Set("verbose", true)
cfg.Set("uglyURLs", true)

View file

@ -811,7 +811,6 @@ var tocPageWithShortcodesInHeadingsExpected = `<nav id="TableOfContents">
</nav>`
var multiSiteTOMLConfigTemplate = `
defaultExtension = "html"
baseURL = "http://example.com/blog"
disableSitemap = false
disableRSS = false
@ -872,7 +871,6 @@ lag = "lag"
`
var multiSiteYAMLConfigTemplate = `
defaultExtension: "html"
baseURL: "http://example.com/blog"
disableSitemap: false
disableRSS: false
@ -934,7 +932,6 @@ Languages:
var multiSiteJSONConfigTemplate = `
{
"defaultExtension": "html",
"baseURL": "http://example.com/blog",
"disableSitemap": false,
"disableRSS": false,

View file

@ -244,7 +244,6 @@ type pageInit struct {
plainInit sync.Once
plainWordsInit sync.Once
renderingConfigInit sync.Once
pageURLInit sync.Once
}
// IsNode returns whether this is an item of one of the list types in Hugo,
@ -764,15 +763,9 @@ func (p *Page) analyzePage() {
}
func (p *Page) Extension() string {
if p.extension != "" {
// TODO(bep) output remove/deprecate this
return p.extension
}
//
// TODO(bep) return MediaType.Suffix
// TODO(bep) remove this config option =>
return p.s.Cfg.GetString("defaultExtension")
// Remove in Hugo 0.22.
helpers.Deprecated("Page", "Extension", "See OutputFormats with its MediaType", false)
return p.extension
}
// AllTranslations returns all translations, including the current Page.
@ -1696,17 +1689,6 @@ func (p *Page) addLangPathPrefixIfFlagSet(outfile string, should bool) string {
return outfile
}
func (p *Page) addLangFilepathPrefix(outfile string) string {
if outfile == "" {
outfile = helpers.FilePathSeparator
}
if !p.shouldAddLanguagePrefix() {
return outfile
}
return helpers.FilePathSeparator + filepath.Join(p.Lang(), outfile)
}
func sectionsFromFilename(filename string) []string {
var sections []string
dir, _ := filepath.Split(filename)

View file

@ -64,8 +64,6 @@ func TestPermalink(t *testing.T) {
cfg, fs := newTestCfg()
cfg.Set("defaultExtension", "html")
cfg.Set("uglyURLs", test.uglyURLs)
cfg.Set("canonifyURLs", test.canonifyURLs)
cfg.Set("baseURL", test.base)

View file

@ -104,28 +104,6 @@ Content of the file goes Here
Some text
`
simplePageNoLayout = `---
title: simple_no_layout
---
No Layout called out`
simplePageLayoutFoobar = `---
title: simple layout foobar
layout: foobar
---
Layout foobar`
simplePageTypeFoobar = `---
type: foobar
---
type foobar`
simplePageTypeLayout = `---
type: barfoo
layout: buzfoo
---
type and layout set`
simplePageWithSummaryDelimiter = `---
title: Simple
---
@ -1089,10 +1067,6 @@ func TestSectionEvaluation(t *testing.T) {
}
}
func L(s ...string) []string {
return s
}
func TestSliceToLower(t *testing.T) {
t.Parallel()
tests := []struct {
@ -1140,8 +1114,6 @@ func TestPagePaths(t *testing.T) {
for _, test := range tests {
cfg, fs := newTestCfg()
cfg.Set("defaultExtension", "html")
if test.hasPermalink {
cfg.Set("permalinks", siteParmalinksSetting)
}
@ -1387,20 +1359,6 @@ func TestChompBOM(t *testing.T) {
checkPageTitle(t, p, "Simple")
}
func listEqual(left, right []string) bool {
if len(left) != len(right) {
return false
}
for i := range left {
if left[i] != right[i] {
return false
}
}
return true
}
// TODO(bep) this may be useful for other tests.
func compareObjects(a interface{}, b interface{}) bool {
aStr := strings.Split(fmt.Sprintf("%v", a), "")

View file

@ -532,7 +532,6 @@ tags:
cfg, fs := newTestCfg()
cfg.Set("defaultExtension", "html")
cfg.Set("defaultContentLanguage", "en")
cfg.Set("baseURL", baseURL)
cfg.Set("uglyURLs", false)

View file

@ -1958,13 +1958,6 @@ func (s *Site) publish(path string, r io.Reader) (err error) {
return helpers.WriteToDisk(path, r, s.Fs.Destination)
}
func (s *Site) langDir() string {
if s.Language.Lang != s.Info.multilingual.DefaultLang.Lang || s.Info.defaultContentLanguageInSubdir {
return s.Language.Lang
}
return ""
}
func (s *Site) draftStats() string {
var msg string

View file

@ -124,6 +124,7 @@ func (s *Site) renderPaginator(p *PageOutput) error {
// write alias for page 1
// TODO(bep) ml all of these n.addLang ... fix.
//TODO(bep) output fix
aliasPath := p.addLangPathPrefix(s.PathSpec.PaginateAliasPath(path.Join(p.sections...), 1))
link := p.Permalink()

View file

@ -273,7 +273,6 @@ THE END.`, refShortcode)),
cfg, fs := newTestCfg()
cfg.Set("defaultExtension", "html")
cfg.Set("baseURL", baseURL)
cfg.Set("uglyURLs", uglyURLs)
cfg.Set("verbose", true)
@ -325,7 +324,6 @@ func doTestShouldAlwaysHaveUglyURLs(t *testing.T, uglyURLs bool) {
cfg, fs := newTestCfg()
cfg.Set("defaultExtension", "html")
cfg.Set("verbose", true)
cfg.Set("baseURL", "http://auth/bub")
cfg.Set("disableSitemap", false)
@ -427,7 +425,6 @@ func doTestSectionNaming(t *testing.T, canonify, uglify, pluralize bool) {
cfg, fs := newTestCfg()
cfg.Set("baseURL", "http://auth/sub/")
cfg.Set("defaultExtension", "html")
cfg.Set("uglyURLs", uglify)
cfg.Set("pluralizeListTitles", pluralize)
cfg.Set("canonifyURLs", canonify)
@ -481,7 +478,6 @@ func TestSkipRender(t *testing.T) {
cfg, fs := newTestCfg()
cfg.Set("defaultExtension", "html")
cfg.Set("verbose", true)
cfg.Set("canonifyURLs", true)
cfg.Set("uglyURLs", true)
@ -539,7 +535,6 @@ func TestAbsURLify(t *testing.T) {
cfg, fs := newTestCfg()
cfg.Set("defaultExtension", "html")
cfg.Set("uglyURLs", true)
cfg.Set("canonifyURLs", canonify)
cfg.Set("baseURL", baseURL)
@ -934,7 +929,6 @@ func setupLinkingMockSite(t *testing.T) *Site {
cfg, fs := newTestCfg()
cfg.Set("baseURL", "http://auth/")
cfg.Set("defaultExtension", "html")
cfg.Set("uglyURLs", false)
cfg.Set("pluralizeListTitles", false)
cfg.Set("canonifyURLs", false)

View file

@ -439,9 +439,6 @@ func isBackupFile(path string) bool {
const baseFileBase = "baseof"
var aceTemplateInnerMarkers = [][]byte{[]byte("= content")}
var goTemplateInnerMarkers = [][]byte{[]byte("{{define"), []byte("{{ define")}
func isBaseTemplate(path string) bool {
return strings.Contains(path, baseFileBase)
}