diff options
-rw-r--r-- | helpers/url.go | 1 | ||||
-rw-r--r-- | hugolib/config.go | 1 | ||||
-rw-r--r-- | hugolib/handler_test.go | 1 | ||||
-rw-r--r-- | hugolib/hugo_sites_build_test.go | 3 | ||||
-rw-r--r-- | hugolib/page.go | 24 | ||||
-rw-r--r-- | hugolib/page_permalink_test.go | 2 | ||||
-rw-r--r-- | hugolib/page_test.go | 42 | ||||
-rw-r--r-- | hugolib/shortcode_test.go | 1 | ||||
-rw-r--r-- | hugolib/site.go | 7 | ||||
-rw-r--r-- | hugolib/site_render.go | 1 | ||||
-rw-r--r-- | hugolib/site_test.go | 6 | ||||
-rw-r--r-- | tpl/tplimpl/template.go | 3 |
12 files changed, 4 insertions, 88 deletions
diff --git a/helpers/url.go b/helpers/url.go index defde6a17..445302123 100644 --- a/helpers/url.go +++ b/helpers/url.go @@ -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) diff --git a/hugolib/config.go b/hugolib/config.go index f266d3955..189b593e6 100644 --- a/hugolib/config.go +++ b/hugolib/config.go @@ -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) diff --git a/hugolib/handler_test.go b/hugolib/handler_test.go index 76a9b38d1..faba04a97 100644 --- a/hugolib/handler_test.go +++ b/hugolib/handler_test.go @@ -28,7 +28,6 @@ func TestDefaultHandler(t *testing.T) { cfg, fs = newTestCfg() ) - cfg.Set("defaultExtension", "html") cfg.Set("verbose", true) cfg.Set("uglyURLs", true) diff --git a/hugolib/hugo_sites_build_test.go b/hugolib/hugo_sites_build_test.go index e0d3ce7b8..b5eac857c 100644 --- a/hugolib/hugo_sites_build_test.go +++ b/hugolib/hugo_sites_build_test.go @@ -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, diff --git a/hugolib/page.go b/hugolib/page.go index 36c89d958..11754fb5f 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -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) diff --git a/hugolib/page_permalink_test.go b/hugolib/page_permalink_test.go index 0d7e983da..d46f0d35d 100644 --- a/hugolib/page_permalink_test.go +++ b/hugolib/page_permalink_test.go @@ -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) diff --git a/hugolib/page_test.go b/hugolib/page_test.go index 790a69b38..d24bd2f96 100644 --- a/hugolib/page_test.go +++ b/hugolib/page_test.go @@ -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), "") diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go index abfbb425e..28b03aa9b 100644 --- a/hugolib/shortcode_test.go +++ b/hugolib/shortcode_test.go @@ -532,7 +532,6 @@ tags: cfg, fs := newTestCfg() - cfg.Set("defaultExtension", "html") cfg.Set("defaultContentLanguage", "en") cfg.Set("baseURL", baseURL) cfg.Set("uglyURLs", false) diff --git a/hugolib/site.go b/hugolib/site.go index fa37f41d1..b57b132f8 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -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 diff --git a/hugolib/site_render.go b/hugolib/site_render.go index 5290f0179..bcb6f9582 100644 --- a/hugolib/site_render.go +++ b/hugolib/site_render.go @@ -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() diff --git a/hugolib/site_test.go b/hugolib/site_test.go index 8204ee99e..a3ec66880 100644 --- a/hugolib/site_test.go +++ b/hugolib/site_test.go @@ -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) diff --git a/tpl/tplimpl/template.go b/tpl/tplimpl/template.go index 04f932ddd..17cbb40f3 100644 --- a/tpl/tplimpl/template.go +++ b/tpl/tplimpl/template.go @@ -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) } |