shithub: hugo

Download patch

ref: dea185aa9b62e1660cb5c6e79e90f2078db7fe6f
parent: c21dc16dbe9d9cf44b341f1f995ed7776d6a1b62
author: Bjørn Erik Pedersen <[email protected]>
date: Mon Mar 14 11:41:03 EDT 2016

hugolib: Remove unused code

--- a/hugolib/menu_test.go
+++ b/hugolib/menu_test.go
@@ -182,12 +182,6 @@
 Front Matter with Menu with Identifier`, title, menu, identifier))
 }
 
-type testMenuState struct {
-	site       *Site
-	oldMenu    interface{}
-	oldBaseURL interface{}
-}
-
 // Issue 817 - identifier should trump everything
 func TestPageMenuWithIdentifier(t *testing.T) {
 
--- a/hugolib/page.go
+++ b/hugolib/page.go
@@ -73,7 +73,6 @@
 	plain               string // TODO should be []byte
 	plainWords          []string
 	plainInit           sync.Once
-	plainSecondaryInit  sync.Once
 	renderingConfig     *helpers.Blackfriday
 	renderingConfigInit sync.Once
 	pageMenus           PageMenus
@@ -811,10 +810,6 @@
 	}
 
 	return helpers.GuessType(p.Source.Ext())
-}
-
-func (p *Page) detectFrontMatter() (f *parser.FrontmatterType) {
-	return parser.DetectFrontMatter(rune(p.frontmatter[0]))
 }
 
 func (p *Page) parse(reader io.Reader) error {
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
@@ -101,11 +101,6 @@
 Some text
 `
 
-	SIMPLE_PAGE_JSON_COMPACT = `
-{"title":"foobar","customData":{"foo":"bar"},"date":"2012-08-06"}
-Text
-`
-
 	SIMPLE_PAGE_NOLAYOUT = `---
 title: simple_no_layout
 ---
--- a/hugolib/pagesPrevNext_test.go
+++ b/hugolib/pagesPrevNext_test.go
@@ -34,21 +34,6 @@
 	{"/section2/testpage5.md", 1, "2012-04-06"},
 }
 
-func preparePagePNTestPages(t *testing.T) Pages {
-	var pages Pages
-	for _, s := range pagePNTestSources {
-		p, err := NewPage(s.path)
-		if err != nil {
-			t.Fatalf("failed to prepare test page %s", s.path)
-		}
-		p.Weight = s.weight
-		p.Date = cast.ToTime(s.date)
-		p.PublishDate = cast.ToTime(s.date)
-		pages = append(pages, p)
-	}
-	return pages
-}
-
 func TestPrev(t *testing.T) {
 	pages := preparePageGroupTestPages(t)
 	assert.Equal(t, pages.Prev(pages[0]), pages[4])
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -87,7 +87,6 @@
 	targets        targetList
 	targetListInit sync.Once
 	RunMode        runmode
-	params         map[string]interface{}
 	draftCount     int
 	futureCount    int
 	Data           map[string]interface{}
@@ -769,14 +768,6 @@
 	return
 }
 
-func (s *Site) checkDescriptions() {
-	for _, p := range s.Pages {
-		if len(p.Description) < 60 {
-			jww.FEEDBACK.Println(p.Source.Path() + " ")
-		}
-	}
-}
-
 func (s *Site) Initialise() (err error) {
 	return s.initialize()
 }
@@ -859,11 +850,6 @@
 		return fmt.Errorf("No source directory found, expecting to find it at " + s.absContentDir())
 	}
 	return
-}
-
-type pageResult struct {
-	page *Page
-	err  error
 }
 
 // ReReadFile resets file to be read from disk again
--- a/hugolib/site_show_plan_test.go
+++ b/hugolib/site_show_plan_test.go
@@ -42,15 +42,6 @@
 	},
 }
 
-func stringInSlice(a string, list []string) bool {
-	for _, b := range list {
-		if b == a {
-			return true
-		}
-	}
-	return false
-}
-
 func checkShowPlanExpected(t *testing.T, s *Site, expected string) {
 
 	out := new(bytes.Buffer)
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -41,18 +41,11 @@
 ---
 content`
 
-	TEMPLATE_MISSING_FUNC        = "{{ .Title | funcdoesnotexists }}"
-	TEMPLATE_FUNC                = "{{ .Title | urlize }}"
-	TEMPLATE_CONTENT             = "{{ .Content }}"
-	TEMPLATE_DATE                = "{{ .Date }}"
-	INVALID_TEMPLATE_FORMAT_DATE = "{{ .Date.Format time.RFC3339 }}"
-	TEMPLATE_WITH_URL_REL        = "<a href=\"foobar.jpg\">Going</a>"
-	TEMPLATE_WITH_URL_ABS        = "<a href=\"/foobar.jpg\">Going</a>"
-	PAGE_URL_SPECIFIED           = `---
-title: simple template
-url: "mycategory/my-whatever-content/"
----
-content`
+	TEMPLATE_MISSING_FUNC = "{{ .Title | funcdoesnotexists }}"
+	TEMPLATE_FUNC         = "{{ .Title | urlize }}"
+	TEMPLATE_CONTENT      = "{{ .Content }}"
+	TEMPLATE_DATE         = "{{ .Date }}"
+	TEMPLATE_WITH_URL_ABS = "<a href=\"/foobar.jpg\">Going</a>"
 
 	PAGE_WITH_MD = `---
 title: page with md
@@ -149,18 +142,6 @@
 	return nopCloser{w}
 }
 
-func matchRender(t *testing.T, s *Site, p *Page, tmplName string, expected string) {
-	content := new(bytes.Buffer)
-	err := s.renderThing(p, tmplName, NopCloser(content))
-	if err != nil {
-		t.Fatalf("Unable to render template.")
-	}
-
-	if string(content.Bytes()) != expected {
-		t.Fatalf("Content did not match expected: %s. got: %s", expected, content)
-	}
-}
-
 func TestRenderThing(t *testing.T) {
 	tests := []struct {
 		content  string
@@ -209,15 +190,14 @@
 
 func TestRenderThingOrDefault(t *testing.T) {
 	tests := []struct {
-		content  string
 		missing  bool
 		template string
 		expected string
 	}{
-		{PAGE_SIMPLE_TITLE, true, TEMPLATE_TITLE, HTML("simple template")},
-		{PAGE_SIMPLE_TITLE, true, TEMPLATE_FUNC, HTML("simple-template")},
-		{PAGE_SIMPLE_TITLE, false, TEMPLATE_TITLE, HTML("simple template")},
-		{PAGE_SIMPLE_TITLE, false, TEMPLATE_FUNC, HTML("simple-template")},
+		{true, TEMPLATE_TITLE, HTML("simple template")},
+		{true, TEMPLATE_FUNC, HTML("simple-template")},
+		{false, TEMPLATE_TITLE, HTML("simple template")},
+		{false, TEMPLATE_FUNC, HTML("simple-template")},
 	}
 
 	hugofs.DestinationFS = new(afero.MemMapFs)
--- a/hugolib/site_url_test.go
+++ b/hugolib/site_url_test.go
@@ -43,13 +43,6 @@
 	}
 }
 
-func mustReturn(ret *Page, err error) *Page {
-	if err != nil {
-		panic(err)
-	}
-	return ret
-}
-
 type InMemoryAliasTarget struct {
 	target.HTMLRedirectAlias
 	files map[string][]byte