shithub: hugo

Download patch

ref: 4c2abe0015393de6e7a2af119c2df5b05879fe19
parent: 6bf010fed432e5574e19fd2946ee6397d895950e
author: Bjørn Erik Pedersen <[email protected]>
date: Thu Mar 16 04:32:14 EDT 2017

Rename OutputType to OutputFormat

--- a/hugolib/hugo_sites_build.go
+++ b/hugolib/hugo_sites_build.go
@@ -176,8 +176,8 @@
 	for _, s := range h.Sites {
 		for _, p := range s.Pages {
 			// May have been set in front matter
-			if len(p.outputTypes) == 0 {
-				p.outputTypes = s.defaultOutputDefinitions.ForKind(p.Kind)
+			if len(p.outputFormats) == 0 {
+				p.outputFormats = s.defaultOutputDefinitions.ForKind(p.Kind)
 			}
 		}
 		s.assembleMenus()
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -198,10 +198,10 @@
 
 	lang string
 
-	// The output types this page will be rendered to.
-	outputTypes output.Types
+	// The output formats this page will be rendered to.
+	outputFormats output.Formats
 
-	// This is the PageOutput that represents the first item in outputTypes.
+	// This is the PageOutput that represents the first item in outputFormats.
 	// Use with care, as there are potential for inifinite loops.
 	mainPageOutput *PageOutput
 
@@ -792,7 +792,7 @@
 		return p.extension
 	}
 	//
-	// TODO(bep) return p.outputType.MediaType.Suffix
+	// TODO(bep) return MediaType.Suffix
 
 	// TODO(bep) remove this config option =>
 	return p.s.Cfg.GetString("defaultExtension")
@@ -952,13 +952,13 @@
 		case "outputs":
 			outputs := cast.ToStringSlice(v)
 			if len(outputs) > 0 {
-				// Output types are exlicitly set in front matter, use those.
-				outTypes, err := output.GetTypes(outputs...)
+				// Output formats are exlicitly set in front matter, use those.
+				outFormats, err := output.GetTypes(outputs...)
 				if err != nil {
-					p.s.Log.ERROR.Printf("Failed to resolve output types: %s", err)
+					p.s.Log.ERROR.Printf("Failed to resolve output formats: %s", err)
 				} else {
-					p.outputTypes = outTypes
-					p.Params[loki] = outTypes
+					p.outputFormats = outFormats
+					p.Params[loki] = outFormats
 				}
 
 			}
--- a/hugolib/page_output.go
+++ b/hugolib/page_output.go
@@ -31,11 +31,11 @@
 	// Keep this to create URL/path variations, i.e. paginators.
 	targetPathDescriptor targetPathDescriptor
 
-	outputType output.Type
+	outputFormat output.Format
 }
 
 func (p *PageOutput) targetPath(addends ...string) (string, error) {
-	tp, err := p.createTargetPath(p.outputType, addends...)
+	tp, err := p.createTargetPath(p.outputFormat, addends...)
 	if err != nil {
 		return "", err
 	}
@@ -43,13 +43,13 @@
 
 }
 
-func newPageOutput(p *Page, createCopy bool, outputType output.Type) (*PageOutput, error) {
+func newPageOutput(p *Page, createCopy bool, f output.Format) (*PageOutput, error) {
 	if createCopy {
 		p.initURLs()
 		p = p.copy()
 	}
 
-	td, err := p.createTargetPathDescriptor(outputType)
+	td, err := p.createTargetPathDescriptor(f)
 
 	if err != nil {
 		return nil, err
@@ -57,7 +57,7 @@
 
 	return &PageOutput{
 		Page:                 p,
-		outputType:           outputType,
+		outputFormat:         f,
 		targetPathDescriptor: td,
 	}, nil
 }
@@ -65,7 +65,7 @@
 // copy creates a copy of this PageOutput with the lazy sync.Once vars reset
 // so they will be evaluated again, for word count calculations etc.
 func (p *PageOutput) copy() *PageOutput {
-	c, err := newPageOutput(p.Page, true, p.outputType)
+	c, err := newPageOutput(p.Page, true, p.outputFormat)
 	if err != nil {
 		panic(err)
 	}
--- a/hugolib/page_paths.go
+++ b/hugolib/page_paths.go
@@ -36,7 +36,7 @@
 type targetPathDescriptor struct {
 	PathSpec *helpers.PathSpec
 
-	Type output.Type
+	Type output.Format
 	Kind string
 
 	Sections []string
@@ -66,10 +66,10 @@
 	UglyURLs bool
 }
 
-// createTargetPathDescriptor adapts a Page and the given output.Type into
+// createTargetPathDescriptor adapts a Page and the given output.Format into
 // a targetPathDescriptor. This descriptor can then be used to create paths
 // and URLs for this Page.
-func (p *Page) createTargetPathDescriptor(t output.Type) (targetPathDescriptor, error) {
+func (p *Page) createTargetPathDescriptor(t output.Format) (targetPathDescriptor, error) {
 	d := targetPathDescriptor{
 		PathSpec: p.s.PathSpec,
 		Type:     t,
@@ -107,9 +107,9 @@
 }
 
 // createTargetPath creates the target filename for this Page for the given
-// output.Type. Some additional URL parts can also be provided, the typical
+// output.Format. Some additional URL parts can also be provided, the typical
 // use case being pagination.
-func (p *Page) createTargetPath(t output.Type, addends ...string) (string, error) {
+func (p *Page) createTargetPath(t output.Format, addends ...string) (string, error) {
 	d, err := p.createTargetPathDescriptor(t)
 	if err != nil {
 		return "", nil
@@ -205,13 +205,13 @@
 
 func (p *Page) createRelativePermalink() string {
 
-	if len(p.outputTypes) == 0 {
+	if len(p.outputFormats) == 0 {
 		panic(fmt.Sprintf("Page %q missing output format(s)", p.Title))
 	}
 
 	// Choose the main output format. In most cases, this will be HTML.
-	outputType := p.outputTypes[0]
-	tp, err := p.createTargetPath(outputType)
+	outFormat := p.outputFormats[0]
+	tp, err := p.createTargetPath(outFormat)
 
 	if err != nil {
 		p.s.Log.ERROR.Printf("Failed to create permalink for page %q: %s", p.FullFilePath(), err)
@@ -218,7 +218,7 @@
 		return ""
 	}
 
-	tp = strings.TrimSuffix(tp, outputType.BaseFilename())
+	tp = strings.TrimSuffix(tp, outFormat.BaseFilename())
 
 	return p.s.PathSpec.URLizeFilename(tp)
 }
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -1661,7 +1661,7 @@
 }
 
 func (s *Site) layouts(p *PageOutput) []string {
-	return s.layoutHandler.For(p.layoutIdentifier, "", p.outputType)
+	return s.layoutHandler.For(p.layoutIdentifier, "", p.outputFormat)
 }
 
 func (s *Site) preparePages() error {
@@ -1806,7 +1806,7 @@
 
 }
 
-func (s *Site) renderAndWritePage(tp output.Type, name string, dest string, d interface{}, layouts ...string) error {
+func (s *Site) renderAndWritePage(f output.Format, name string, dest string, d interface{}, layouts ...string) error {
 	renderBuffer := bp.GetBuffer()
 	defer bp.PutBuffer(renderBuffer)
 
@@ -1878,7 +1878,7 @@
 
 	}
 
-	if err = w.writeDestPage(tp, dest, outBuffer); err != nil {
+	if err = w.writeDestPage(f, dest, outBuffer); err != nil {
 		return err
 	}
 
@@ -2061,7 +2061,7 @@
 		Data:     make(map[string]interface{}),
 		Site:     &s.Info,
 		s:        s}
-	p.outputTypes = p.s.defaultOutputDefinitions.ForKind(typ)
+	p.outputFormats = p.s.defaultOutputDefinitions.ForKind(typ)
 	p.layoutIdentifier = pageLayoutIdentifier{p}
 	return p
 
--- a/hugolib/site_output.go
+++ b/hugolib/site_output.go
@@ -29,11 +29,11 @@
 	// Comma separated list (for now).
 	ExcludedKinds string
 
-	Outputs []output.Type
+	Outputs []output.Format
 }
 
-func (defs siteOutputDefinitions) ForKind(kind string) []output.Type {
-	var result []output.Type
+func (defs siteOutputDefinitions) ForKind(kind string) []output.Format {
+	var result []output.Format
 
 	for _, def := range defs {
 		if def.ExcludedKinds == "" || !strings.Contains(def.ExcludedKinds, kind) {
@@ -49,7 +49,7 @@
 	var defs siteOutputDefinitions
 
 	// All have HTML
-	defs = append(defs, siteOutputDefinition{ExcludedKinds: "", Outputs: []output.Type{output.HTMLType}})
+	defs = append(defs, siteOutputDefinition{ExcludedKinds: "", Outputs: []output.Format{output.HTMLType}})
 
 	// TODO(bep) output deprecate rssURI
 	rssBase := cfg.GetString("rssURI")
@@ -63,7 +63,7 @@
 	rssType.BaseName = rssBase
 
 	// Some have RSS
-	defs = append(defs, siteOutputDefinition{ExcludedKinds: "page", Outputs: []output.Type{rssType}})
+	defs = append(defs, siteOutputDefinition{ExcludedKinds: "page", Outputs: []output.Format{rssType}})
 
 	return defs
 }
--- a/hugolib/site_output_test.go
+++ b/hugolib/site_output_test.go
@@ -32,10 +32,10 @@
 	tests := []struct {
 		name string
 		kind string
-		want []output.Type
+		want []output.Format
 	}{
-		{"RSS not for regular pages", KindPage, []output.Type{output.HTMLType}},
-		{"Home Sweet Home", KindHome, []output.Type{output.HTMLType, output.RSSType}},
+		{"RSS not for regular pages", KindPage, []output.Format{output.HTMLType}},
+		{"Home Sweet Home", KindHome, []output.Format{output.HTMLType, output.RSSType}},
 	}
 
 	for _, tt := range tests {
@@ -88,7 +88,7 @@
 
 	require.NotNil(t, home)
 
-	require.Len(t, home.outputTypes, 1)
+	require.Len(t, home.outputFormats, 1)
 
 	// TODO(bep) output assert template/text
 
--- a/hugolib/site_render.go
+++ b/hugolib/site_render.go
@@ -65,10 +65,10 @@
 	var mainPageOutput *PageOutput
 
 	for page := range pages {
-		for i, outputType := range page.outputTypes {
-			pageOutput, err := newPageOutput(page, i > 0, outputType)
+		for i, outFormat := range page.outputFormats {
+			pageOutput, err := newPageOutput(page, i > 0, outFormat)
 			if err != nil {
-				s.Log.ERROR.Printf("Failed to create output page for type %q for page %q: %s", outputType.Name, page, err)
+				s.Log.ERROR.Printf("Failed to create output page for type %q for page %q: %s", outFormat.Name, page, err)
 				continue
 			}
 			if i == 0 {
@@ -85,7 +85,7 @@
 				layouts = s.layouts(pageOutput)
 			}
 
-			switch pageOutput.outputType.Name {
+			switch pageOutput.outputFormat.Name {
 
 			case "RSS":
 				if err := s.renderRSS(pageOutput); err != nil {
@@ -94,13 +94,13 @@
 			default:
 				targetPath, err := pageOutput.targetPath()
 				if err != nil {
-					s.Log.ERROR.Printf("Failed to create target path for output %q for page %q: %s", outputType.Name, page, err)
+					s.Log.ERROR.Printf("Failed to create target path for output %q for page %q: %s", outFormat.Name, page, err)
 					continue
 				}
 
 				s.Log.DEBUG.Printf("Render %s to %q with layouts %q", pageOutput.Kind, targetPath, layouts)
 
-				if err := s.renderAndWritePage(outputType, "page "+pageOutput.FullFilePath(), targetPath, pageOutput, layouts...); err != nil {
+				if err := s.renderAndWritePage(outFormat, "page "+pageOutput.FullFilePath(), targetPath, pageOutput, layouts...); err != nil {
 					results <- err
 				}
 
@@ -149,7 +149,7 @@
 			addend := fmt.Sprintf("/%s/%d", paginatePath, pageNumber)
 			targetPath, _ := p.targetPath(addend)
 
-			if err := s.renderAndWritePage(p.outputType, pagerNode.Title,
+			if err := s.renderAndWritePage(p.outputFormat, pagerNode.Title,
 				targetPath, pagerNode, p.layouts()...); err != nil {
 				return err
 			}
--- a/hugolib/site_writer.go
+++ b/hugolib/site_writer.go
@@ -27,7 +27,7 @@
 )
 
 // We may find some abstractions/interface(s) here once we star with
-// "Multiple Output Types".
+// "Multiple Output Formats".
 type siteWriter struct {
 	langDir      string
 	publishDir   string
@@ -40,8 +40,8 @@
 	log *jww.Notepad
 }
 
-func (w siteWriter) targetPathPage(tp output.Type, src string) (string, error) {
-	dir, err := w.baseTargetPathPage(tp, src)
+func (w siteWriter) targetPathPage(f output.Format, src string) (string, error) {
+	dir, err := w.baseTargetPathPage(f, src)
 	if err != nil {
 		return "", err
 	}
@@ -51,7 +51,7 @@
 	return dir, nil
 }
 
-func (w siteWriter) baseTargetPathPage(tp output.Type, src string) (string, error) {
+func (w siteWriter) baseTargetPathPage(f output.Format, src string) (string, error) {
 	if src == helpers.FilePathSeparator {
 		return "index.html", nil
 	}
@@ -178,7 +178,7 @@
 	return f[:len(f)-len(ext)]
 }
 
-func (w siteWriter) writeDestPage(tp output.Type, path string, reader io.Reader) error {
+func (w siteWriter) writeDestPage(f output.Format, path string, reader io.Reader) error {
 	w.log.DEBUG.Println("creating page:", path)
 	path, _ = w.targetPathFile(path)
 	// TODO(bep) output remove this file ... targetPath, err := w.targetPathPage(tp, path)
--- a/hugolib/site_writer_test.go
+++ b/hugolib/site_writer_test.go
@@ -127,9 +127,9 @@
 	w := siteWriter{log: newErrorLogger(), uglyURLs: true}
 
 	tests := []struct {
-		outputType output.Type
-		content    string
-		expected   string
+		outFormat output.Format
+		content   string
+		expected  string
 	}{
 		{output.HTMLType, "foo.html", "foo.html"},
 		{output.HTMLType, "/", "index.html"},
@@ -139,7 +139,7 @@
 	}
 
 	for i, test := range tests {
-		dest, err := w.targetPathPage(test.outputType, filepath.FromSlash(test.content))
+		dest, err := w.targetPathPage(test.outFormat, filepath.FromSlash(test.content))
 		if err != nil {
 			t.Fatalf(" [%d] targetPathPage returned an unexpected err: %s", i, err)
 		}
--- a/output/layout.go
+++ b/output/layout.go
@@ -60,7 +60,7 @@
 `
 )
 
-func (l *LayoutHandler) For(id LayoutIdentifier, layoutOverride string, tp Type) []string {
+func (l *LayoutHandler) For(id LayoutIdentifier, layoutOverride string, f Format) []string {
 	var layouts []string
 
 	layout := id.PageLayout()
@@ -72,15 +72,15 @@
 	switch id.PageKind() {
 	// TODO(bep) move the Kind constants some common place.
 	case "home":
-		layouts = resolveTemplate(layoutsHome, id, tp)
+		layouts = resolveTemplate(layoutsHome, id, f)
 	case "section":
-		layouts = resolveTemplate(layoutsSection, id, tp)
+		layouts = resolveTemplate(layoutsSection, id, f)
 	case "taxonomy":
-		layouts = resolveTemplate(layoutTaxonomy, id, tp)
+		layouts = resolveTemplate(layoutTaxonomy, id, f)
 	case "taxonomyTerm":
-		layouts = resolveTemplate(layoutTaxonomyTerm, id, tp)
+		layouts = resolveTemplate(layoutTaxonomyTerm, id, f)
 	case "page":
-		layouts = regularPageLayouts(id.PageType(), layout, tp)
+		layouts = regularPageLayouts(id.PageType(), layout, f)
 	}
 
 	if l.hasTheme {
@@ -112,10 +112,10 @@
 	return layouts
 }
 
-func resolveTemplate(templ string, id LayoutIdentifier, tp Type) []string {
+func resolveTemplate(templ string, id LayoutIdentifier, f Format) []string {
 	return strings.Fields(replaceKeyValues(templ,
-		"SUFFIX", tp.MediaType.Suffix,
-		"NAME", strings.ToLower(tp.Name),
+		"SUFFIX", f.MediaType.Suffix,
+		"NAME", strings.ToLower(f.Name),
 		"SECTION", id.PageSection()))
 }
 
@@ -124,13 +124,13 @@
 	return replacer.Replace(s)
 }
 
-func regularPageLayouts(types string, layout string, tp Type) (layouts []string) {
+func regularPageLayouts(types string, layout string, f Format) (layouts []string) {
 	if layout == "" {
 		layout = "single"
 	}
 
-	suffix := tp.MediaType.Suffix
-	name := strings.ToLower(tp.Name)
+	suffix := f.MediaType.Suffix
+	name := strings.ToLower(f.Name)
 
 	if types != "" {
 		t := strings.Split(types, "/")
--- a/output/layout_test.go
+++ b/output/layout_test.go
@@ -44,7 +44,7 @@
 	return l.pageSection
 }
 
-var ampType = Type{
+var ampType = Format{
 	Name:      "AMP",
 	MediaType: media.HTMLType,
 	BaseName:  "index",
@@ -57,7 +57,7 @@
 		li             testLayoutIdentifier
 		hasTheme       bool
 		layoutOverride string
-		tp             Type
+		tp             Format
 		expect         []string
 	}{
 		{"Home", testLayoutIdentifier{"home", "", "", ""}, true, "", ampType,
--- /dev/null
+++ b/output/outputFormat.go
@@ -1,0 +1,120 @@
+// Copyright 2017-present The Hugo Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package output
+
+import (
+	"fmt"
+	"strings"
+
+	"github.com/spf13/hugo/media"
+)
+
+var (
+	// An ordered list of built-in output formats
+	// See https://www.ampproject.org/learn/overview/
+	AMPType = Format{
+		Name:      "AMP",
+		MediaType: media.HTMLType,
+		BaseName:  "index",
+		Path:      "amp",
+	}
+
+	CSSType = Format{
+		Name:      "CSS",
+		MediaType: media.CSSType,
+		BaseName:  "styles",
+	}
+
+	HTMLType = Format{
+		Name:      "HTML",
+		MediaType: media.HTMLType,
+		BaseName:  "index",
+	}
+
+	JSONType = Format{
+		Name:        "JSON",
+		MediaType:   media.JSONType,
+		BaseName:    "index",
+		IsPlainText: true,
+	}
+
+	RSSType = Format{
+		Name:      "RSS",
+		MediaType: media.RSSType,
+		BaseName:  "index",
+		NoUgly:    true,
+	}
+)
+
+var builtInTypes = map[string]Format{
+	strings.ToLower(AMPType.Name):  AMPType,
+	strings.ToLower(CSSType.Name):  CSSType,
+	strings.ToLower(HTMLType.Name): HTMLType,
+	strings.ToLower(JSONType.Name): JSONType,
+	strings.ToLower(RSSType.Name):  RSSType,
+}
+
+type Formats []Format
+
+// Format represents an output represenation, usually to a file on disk.
+type Format struct {
+	// The Name is used as an identifier. Internal output formats (i.e. HTML and RSS)
+	// can be overridden by providing a new definition for those types.
+	Name string
+
+	MediaType media.Type
+
+	// Must be set to a value when there are two or more conflicting mediatype for the same resource.
+	Path string
+
+	// The base output file name used when not using "ugly URLs", defaults to "index".
+	BaseName string
+
+	// The protocol to use, i.e. "webcal://". Defaults to the protocol of the baseURL.
+	Protocol string
+
+	// IsPlainText decides whether to use text/template or html/template
+	// as template parser.
+	IsPlainText bool
+
+	// Enable to ignore the global uglyURLs setting.
+	NoUgly bool
+}
+
+func GetType(key string) (Format, bool) {
+	found, ok := builtInTypes[key]
+	if !ok {
+		found, ok = builtInTypes[strings.ToLower(key)]
+	}
+	return found, ok
+}
+
+// TODO(bep) outputs rewamp on global config?
+func GetTypes(keys ...string) (Formats, error) {
+	var types []Format
+
+	for _, key := range keys {
+		tpe, ok := GetType(key)
+		if !ok {
+			return types, fmt.Errorf("OutputFormat with key %q not found", key)
+		}
+		types = append(types, tpe)
+	}
+
+	return types, nil
+}
+
+func (t Format) BaseFilename() string {
+	return t.BaseName + "." + t.MediaType.Suffix
+}
--- /dev/null
+++ b/output/outputFormat_test.go
@@ -1,0 +1,43 @@
+// Copyright 2017-present The Hugo Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package output
+
+import (
+	"testing"
+
+	"github.com/spf13/hugo/media"
+	"github.com/stretchr/testify/require"
+)
+
+func TestDefaultTypes(t *testing.T) {
+	require.Equal(t, "HTML", HTMLType.Name)
+	require.Equal(t, media.HTMLType, HTMLType.MediaType)
+	require.Empty(t, HTMLType.Path)
+	require.False(t, HTMLType.IsPlainText)
+
+	require.Equal(t, "RSS", RSSType.Name)
+	require.Equal(t, media.RSSType, RSSType.MediaType)
+	require.Empty(t, RSSType.Path)
+	require.False(t, RSSType.IsPlainText)
+	require.True(t, RSSType.NoUgly)
+}
+
+func TestGetType(t *testing.T) {
+	tp, _ := GetType("html")
+	require.Equal(t, HTMLType, tp)
+	tp, _ = GetType("HTML")
+	require.Equal(t, HTMLType, tp)
+	_, found := GetType("FOO")
+	require.False(t, found)
+}
--- a/output/outputType.go
+++ /dev/null
@@ -1,120 +1,0 @@
-// Copyright 2017-present The Hugo Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package output
-
-import (
-	"fmt"
-	"strings"
-
-	"github.com/spf13/hugo/media"
-)
-
-var (
-	// An ordered list of built-in output formats
-	// See https://www.ampproject.org/learn/overview/
-	AMPType = Type{
-		Name:      "AMP",
-		MediaType: media.HTMLType,
-		BaseName:  "index",
-		Path:      "amp",
-	}
-
-	CSSType = Type{
-		Name:      "CSS",
-		MediaType: media.CSSType,
-		BaseName:  "styles",
-	}
-
-	HTMLType = Type{
-		Name:      "HTML",
-		MediaType: media.HTMLType,
-		BaseName:  "index",
-	}
-
-	JSONType = Type{
-		Name:        "JSON",
-		MediaType:   media.JSONType,
-		BaseName:    "index",
-		IsPlainText: true,
-	}
-
-	RSSType = Type{
-		Name:      "RSS",
-		MediaType: media.RSSType,
-		BaseName:  "index",
-		NoUgly:    true,
-	}
-)
-
-var builtInTypes = map[string]Type{
-	strings.ToLower(AMPType.Name):  AMPType,
-	strings.ToLower(CSSType.Name):  CSSType,
-	strings.ToLower(HTMLType.Name): HTMLType,
-	strings.ToLower(JSONType.Name): JSONType,
-	strings.ToLower(RSSType.Name):  RSSType,
-}
-
-type Types []Type
-
-// Type represents an output represenation, usually to a file on disk.
-type Type struct {
-	// The Name is used as an identifier. Internal output types (i.e. HTML and RSS)
-	// can be overridden by providing a new definition for those types.
-	Name string
-
-	MediaType media.Type
-
-	// Must be set to a value when there are two or more conflicting mediatype for the same resource.
-	Path string
-
-	// The base output file name used when not using "ugly URLs", defaults to "index".
-	BaseName string
-
-	// The protocol to use, i.e. "webcal://". Defaults to the protocol of the baseURL.
-	Protocol string
-
-	// IsPlainText decides whether to use text/template or html/template
-	// as template parser.
-	IsPlainText bool
-
-	// Enable to ignore the global uglyURLs setting.
-	NoUgly bool
-}
-
-func GetType(key string) (Type, bool) {
-	found, ok := builtInTypes[key]
-	if !ok {
-		found, ok = builtInTypes[strings.ToLower(key)]
-	}
-	return found, ok
-}
-
-// TODO(bep) outputs rewamp on global config?
-func GetTypes(keys ...string) (Types, error) {
-	var types []Type
-
-	for _, key := range keys {
-		tpe, ok := GetType(key)
-		if !ok {
-			return types, fmt.Errorf("OutputType with key %q not found", key)
-		}
-		types = append(types, tpe)
-	}
-
-	return types, nil
-}
-
-func (t Type) BaseFilename() string {
-	return t.BaseName + "." + t.MediaType.Suffix
-}
--- a/output/outputType_test.go
+++ /dev/null
@@ -1,43 +1,0 @@
-// Copyright 2017-present The Hugo Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package output
-
-import (
-	"testing"
-
-	"github.com/spf13/hugo/media"
-	"github.com/stretchr/testify/require"
-)
-
-func TestDefaultTypes(t *testing.T) {
-	require.Equal(t, "HTML", HTMLType.Name)
-	require.Equal(t, media.HTMLType, HTMLType.MediaType)
-	require.Empty(t, HTMLType.Path)
-	require.False(t, HTMLType.IsPlainText)
-
-	require.Equal(t, "RSS", RSSType.Name)
-	require.Equal(t, media.RSSType, RSSType.MediaType)
-	require.Empty(t, RSSType.Path)
-	require.False(t, RSSType.IsPlainText)
-	require.True(t, RSSType.NoUgly)
-}
-
-func TestGetType(t *testing.T) {
-	tp, _ := GetType("html")
-	require.Equal(t, HTMLType, tp)
-	tp, _ = GetType("HTML")
-	require.Equal(t, HTMLType, tp)
-	_, found := GetType("FOO")
-	require.False(t, found)
-}