ref: 7c84e6b3e32bdb61a6a11d34545f4177db8e92fa
parent: 3e77886aadf4fbddc20fb12fe35e69d46d399eef
author: Bjørn Erik Pedersen <[email protected]>
date: Thu Mar 24 10:42:03 EDT 2016
hugolib: Even more Golint fixes
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
@@ -29,17 +29,17 @@
"github.com/stretchr/testify/assert"
)
-var EMPTY_PAGE = ""
+var emptyPage = ""
const (
- SIMPLE_PAGE = "---\ntitle: Simple\n---\nSimple Page\n"
- INVALID_FRONT_MATTER_MISSING = "This is a test"
- RENDER_NO_FRONT_MATTER = "<!doctype><html><head></head><body>This is a test</body></html>"
- CONTENT_WITH_COMMENTED_FM = "<!--\n+++\ntitle = \"Network configuration\"\ndescription = \"Docker networking\"\nkeywords = [\"network\"]\n[menu.main]\nparent= \"smn_administrate\"\n+++\n-->\n\n# Network configuration\n\n##\nSummary"
- CONTENT_WITH_COMMENTED_TEXT_FM = "<!--[metaData]>\n+++\ntitle = \"Network configuration\"\ndescription = \"Docker networking\"\nkeywords = [\"network\"]\n[menu.main]\nparent= \"smn_administrate\"\n+++\n<![end-metadata]-->\n\n# Network configuration\n\n##\nSummary"
- CONTENT_WITH_COMMENTED_LONG_FM = "<!--[metaData123456789012345678901234567890]>\n+++\ntitle = \"Network configuration\"\ndescription = \"Docker networking\"\nkeywords = [\"network\"]\n[menu.main]\nparent= \"smn_administrate\"\n+++\n<![end-metadata]-->\n\n# Network configuration\n\n##\nSummary"
- CONTENT_WITH_COMMENTED_LONG2_FM = "<!--[metaData]>\n+++\ntitle = \"Network configuration\"\ndescription = \"Docker networking\"\nkeywords = [\"network\"]\n[menu.main]\nparent= \"smn_administrate\"\n+++\n<![end-metadata123456789012345678901234567890]-->\n\n# Network configuration\n\n##\nSummary"
- INVALID_FRONT_MATTER_SHORT_DELIM = `
+ simplePage = "---\ntitle: Simple\n---\nSimple Page\n"
+ invalidFrontMatterMissing = "This is a test"
+ renderNoFrontmatter = "<!doctype><html><head></head><body>This is a test</body></html>"
+ contentWithCommentedFrontmatter = "<!--\n+++\ntitle = \"Network configuration\"\ndescription = \"Docker networking\"\nkeywords = [\"network\"]\n[menu.main]\nparent= \"smn_administrate\"\n+++\n-->\n\n# Network configuration\n\n##\nSummary"
+ contentWithCommentedTextFrontmatter = "<!--[metaData]>\n+++\ntitle = \"Network configuration\"\ndescription = \"Docker networking\"\nkeywords = [\"network\"]\n[menu.main]\nparent= \"smn_administrate\"\n+++\n<![end-metadata]-->\n\n# Network configuration\n\n##\nSummary"
+ contentWithCommentedLongFrontmatter = "<!--[metaData123456789012345678901234567890]>\n+++\ntitle = \"Network configuration\"\ndescription = \"Docker networking\"\nkeywords = [\"network\"]\n[menu.main]\nparent= \"smn_administrate\"\n+++\n<![end-metadata]-->\n\n# Network configuration\n\n##\nSummary"
+ contentWithCommentedLong2Frontmatter = "<!--[metaData]>\n+++\ntitle = \"Network configuration\"\ndescription = \"Docker networking\"\nkeywords = [\"network\"]\n[menu.main]\nparent= \"smn_administrate\"\n+++\n<![end-metadata123456789012345678901234567890]-->\n\n# Network configuration\n\n##\nSummary"
+ invalidFrontmatterShortDelim = `
--
title: Short delim start
---
@@ -46,7 +46,7 @@
Short Delim
`
- INVALID_FRONT_MATTER_SHORT_DELIM_ENDING = `
+ invalidFrontmatterShortDelimEnding = `
---
title: Short delim ending
--
@@ -53,7 +53,7 @@
Short Delim
`
- INVALID_FRONT_MATTER_LEADING_WS = `
+ invalidFrontmatterLadingWs = `
---
title: Leading WS
@@ -61,7 +61,7 @@
Leading
`
- SIMPLE_PAGE_JSON = `
+ simplePageJSON = `
{
"title": "spf13-vim 3.0 release and new website",
"description": "spf13-vim is a cross platform distribution of vim plugins and resources for Vim.",
@@ -76,7 +76,7 @@
Content of the file goes Here
`
- SIMPLE_PAGE_JSON_LOOSE = `
+ simplePageJSONLoose = `
{
"title": "spf13-vim 3.0 release and new website"
"description": "spf13-vim is a cross platform distribution of vim plugins and resources for Vim."
@@ -91,8 +91,8 @@
Content of the file goes Here
`
- SIMPLE_PAGE_RFC3339_DATE = "---\ntitle: RFC3339 Date\ndate: \"2013-05-17T16:59:30Z\"\n---\nrfc3339 content"
- SIMPLE_PAGE_JSON_MULTIPLE = `
+ simplePageRFC3339Date = "---\ntitle: RFC3339 Date\ndate: \"2013-05-17T16:59:30Z\"\n---\nrfc3339 content"
+ simplePageJSONMultiple = `
{
"title": "foobar",
"customData": { "foo": "bar" },
@@ -101,29 +101,29 @@
Some text
`
- SIMPLE_PAGE_NOLAYOUT = `---
+ simplePageNoLayout = `---
title: simple_no_layout
---
No Layout called out`
- SIMPLE_PAGE_LAYOUT_FOOBAR = `---
+ simplePageLayoutFoobar = `---
title: simple layout foobar
layout: foobar
---
Layout foobar`
- SIMPLE_PAGE_TYPE_FOOBAR = `---
+ simplePageTypeFoobar = `---
type: foobar
---
type foobar`
- SIMPLE_PAGE_TYPE_LAYOUT = `---
+ simplePageTypeLayout = `---
type: barfoo
layout: buzfoo
---
type and layout set`
- SIMPLE_PAGE_WITH_SUMMARY_DELIMITER = `---
+ simplePageWithSummaryDelimiter = `---
title: Simple
---
Summary Next Line
@@ -131,7 +131,7 @@
<!--more-->
Some more text
`
- SIMPLE_PAGE_WITH_SHORTCODE_IN_SUMMARY = `---
+ simplePageWithShortcodeInSummary = `---
title: Simple
---
Summary Next Line. {{<figure src="/not/real" >}}.
@@ -140,13 +140,13 @@
Some more text
`
- SIMPLE_PAGE_WITH_EMBEDDED_SCRIPT = `---
+ simplePageWithEmbeddedScript = `---
title: Simple
---
<script type='text/javascript'>alert('the script tags are still there, right?');</script>
`
- SIMPLE_PAGE_WITH_SUMMARY_DELIMITER_SAME_LINE = `---
+ simplePageWithSummaryDelimiterSameLine = `---
title: Simple
---
Summary Same Line<!--more-->
@@ -154,7 +154,7 @@
Some more text
`
- SIMPLE_PAGE_WITH_ALL_CJK_RUNES = `---
+ simplePageWithAllCJKRunes = `---
title: Simple
---
@@ -167,7 +167,7 @@
`
- SIMPLE_PAGE_WITH_MAIN_ENGLISH_WITH_CJK_RUNES = `---
+ simplePageWithMainEnglishWithCJKRunes = `---
title: Simple
---
@@ -183,7 +183,7 @@
`
- SIMPLE_PAGE_WITH_MAIN_ENGLISH_WITH_CJK_RUNES_SUMMARY = "In Chinese, 好 means good. In Chinese, 好 means good. " +
+ simplePageWithMainEnglishWithCJKRunesSummary = "In Chinese, 好 means good. In Chinese, 好 means good. " +
"In Chinese, 好 means good. In Chinese, 好 means good. " +
"In Chinese, 好 means good. In Chinese, 好 means good. " +
"In Chinese, 好 means good. In Chinese, 好 means good. " +
@@ -191,7 +191,7 @@
"In Chinese, 好 means good. In Chinese, 好 means good. " +
"In Chinese, 好 means good. In Chinese, 好 means good."
- SIMPLE_PAGE_WITH_ISCJKLANGUAGE_FALSE = `---
+ simplePageWithIsCJKLanguageFalse = `---
title: Simple
isCJKLanguage: false
---
@@ -207,7 +207,7 @@
`
- SIMPLE_PAGE_WITH_ISCJKLANGUAGE_FALSE_SUMMARY = "In Chinese, 好的啊 means good. In Chinese, 好的呀 means good. " +
+ simplePageWithIsCJKLanguageFalseSummary = "In Chinese, 好的啊 means good. In Chinese, 好的呀 means good. " +
"In Chinese, 好的啊 means good. In Chinese, 好的呀 means good. " +
"In Chinese, 好的啊 means good. In Chinese, 好的呀 means good. " +
"In Chinese, 好的啊 means good. In Chinese, 好的呀 means good. " +
@@ -215,7 +215,7 @@
"In Chinese, 好的啊 means good. In Chinese, 好的呀 means good. " +
"In Chinese, 好的啊 means good. In Chinese, 好的呀呀 means good enough."
- SIMPLE_PAGE_WITH_LONG_CONTENT = `---
+ simplePageWithLongContent = `---
title: Simple
---
@@ -261,7 +261,7 @@
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum.`
- PAGE_WITH_TOC = `---
+ pageWithToC = `---
title: TOC
---
For some moments the old man did not reply. He stood with bowed head, buried in deep thought. But at last he spoke.
@@ -291,7 +291,7 @@
"You're a great Granser," he cried delightedly, "always making believe them little marks mean something."
`
- SIMPLE_PAGE_WITH_ADDITIONAL_EXTENSION = `+++
+ simplePageWithAdditionalExtension = `+++
[blackfriday]
extensions = ["hardLineBreak"]
+++
@@ -301,42 +301,42 @@
fourth line.
`
- SIMPLE_PAGE_WITH_URL = `---
+ simplePageWithURL = `---
title: Simple
url: simple/url/
---
Simple Page With URL`
- SIMPLE_PAGE_WITH_SLUG = `---
+ simplePageWithSlug = `---
title: Simple
slug: simple-slug
---
Simple Page With Slug`
- SIMPLE_PAGE_WITH_DATE = `---
+ simplePageWithDate = `---
title: Simple
date: '2013-10-15T06:16:13'
---
Simple Page With Date`
- UTF8_PAGE = `---
+ UTF8Page = `---
title: ラーメン
---
UTF8 Page`
- UTF8_PAGE_WITH_URL = `---
+ UTF8PageWithURL = `---
title: ラーメン
url: ラーメン/url/
---
UTF8 Page With URL`
- UTF8_PAGE_WITH_SLUG = `---
+ UTF8PageWithSlug = `---
title: ラーメン
slug: ラーメン-slug
---
UTF8 Page With Slug`
- UTF8_PAGE_WITH_DATE = `---
+ UTF8PageWithDate = `---
title: ラーメン
date: '2013-10-15T06:16:13'
---
@@ -343,7 +343,7 @@
UTF8 Page With Date`
)
-var PAGE_WITH_VARIOUS_FRONTMATTER_TYPES = `+++
+var pageWithVariousFrontmatterTypes = `+++
a_string = "bar"
an_integer = 1
a_float = 1.3
@@ -355,7 +355,7 @@
+++
Front Matter with various frontmatter types`
-var PAGE_WITH_CALENDAR_YAML_FRONTMATTER = `---
+var pageWithCalendarYAMLFrontmatter = `---
type: calendar
weeks:
-
@@ -380,7 +380,7 @@
Hi.
`
-var PAGE_WITH_CALENDAR_JSON_FRONTMATTER = `{
+var pageWithCalendarJSONFrontmatter = `{
"type": "calendar",
"weeks": [
{
@@ -409,7 +409,7 @@
Hi.
`
-var PAGE_WITH_CALENDAR_TOML_FRONTMATTER = `+++
+var pageWithCalendarTOMLFrontmatter = `+++
type = "calendar"
[[weeks]]
@@ -473,7 +473,7 @@
}
func TestDegenerateEmptyPage(t *testing.T) {
- _, err := NewPageFrom(strings.NewReader(EMPTY_PAGE), "test")
+ _, err := NewPageFrom(strings.NewReader(emptyPage), "test")
if err != nil {
t.Fatalf("Empty files should not trigger an error. Should be able to touch a file while watching without erroring out.")
}
@@ -536,7 +536,7 @@
func TestCreateNewPage(t *testing.T) {
p, _ := NewPage("simple.md")
- _, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE))
+ _, err := p.ReadFrom(strings.NewReader(simplePage))
p.Convert()
if err != nil {
@@ -554,7 +554,7 @@
func TestPageWithDelimiter(t *testing.T) {
p, _ := NewPage("simple.md")
- _, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE_WITH_SUMMARY_DELIMITER))
+ _, err := p.ReadFrom(strings.NewReader(simplePageWithSummaryDelimiter))
p.Convert()
if err != nil {
t.Fatalf("Unable to create a page with frontmatter and body content: %s", err)
@@ -571,7 +571,7 @@
s := new(Site)
s.prepTemplates()
p, _ := NewPage("simple.md")
- _, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE_WITH_SHORTCODE_IN_SUMMARY))
+ _, err := p.ReadFrom(strings.NewReader(simplePageWithShortcodeInSummary))
if err != nil {
t.Fatalf("Unable to create a page with frontmatter and body content: %s", err)
}
@@ -586,7 +586,7 @@
func TestPageWithEmbeddedScriptTag(t *testing.T) {
p, _ := NewPage("simple.md")
- _, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE_WITH_EMBEDDED_SCRIPT))
+ _, err := p.ReadFrom(strings.NewReader(simplePageWithEmbeddedScript))
p.Convert()
if err != nil {
t.Fatalf("Unable to create a page with frontmatter and body content: %s", err)
@@ -596,7 +596,7 @@
func TestPageWithAdditionalExtension(t *testing.T) {
p, _ := NewPage("simple.md")
- _, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE_WITH_ADDITIONAL_EXTENSION))
+ _, err := p.ReadFrom(strings.NewReader(simplePageWithAdditionalExtension))
p.Convert()
if err != nil {
t.Fatalf("Unable to create a page with frontmatter and body content: %s", err)
@@ -606,7 +606,7 @@
func TestTableOfContents(t *testing.T) {
p, _ := NewPage("tocpage.md")
- _, err := p.ReadFrom(strings.NewReader(PAGE_WITH_TOC))
+ _, err := p.ReadFrom(strings.NewReader(pageWithToC))
p.Convert()
if err != nil {
t.Fatalf("Unable to create a page with frontmatter and body content: %s", err)
@@ -617,7 +617,7 @@
func TestPageWithMoreTag(t *testing.T) {
p, _ := NewPage("simple.md")
- _, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE_WITH_SUMMARY_DELIMITER_SAME_LINE))
+ _, err := p.ReadFrom(strings.NewReader(simplePageWithSummaryDelimiterSameLine))
p.Convert()
if err != nil {
t.Fatalf("Unable to create a page with frontmatter and body content: %s", err)
@@ -631,7 +631,7 @@
func TestPageWithDate(t *testing.T) {
p, _ := NewPage("simple.md")
- _, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE_RFC3339_DATE))
+ _, err := p.ReadFrom(strings.NewReader(simplePageRFC3339Date))
p.Convert()
if err != nil {
t.Fatalf("Unable to create a page with frontmatter and body content: %s", err)
@@ -647,7 +647,7 @@
viper.Reset()
p, _ := NewPage("simple.md")
- _, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE_WITH_ALL_CJK_RUNES))
+ _, err := p.ReadFrom(strings.NewReader(simplePageWithAllCJKRunes))
p.Convert()
p.analyzePage()
if err != nil {
@@ -666,7 +666,7 @@
viper.Set("HasCJKLanguage", true)
p, _ := NewPage("simple.md")
- _, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE_WITH_ALL_CJK_RUNES))
+ _, err := p.ReadFrom(strings.NewReader(simplePageWithAllCJKRunes))
p.Convert()
p.analyzePage()
if err != nil {
@@ -685,7 +685,7 @@
viper.Set("HasCJKLanguage", true)
p, _ := NewPage("simple.md")
- _, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE_WITH_MAIN_ENGLISH_WITH_CJK_RUNES))
+ _, err := p.ReadFrom(strings.NewReader(simplePageWithMainEnglishWithCJKRunes))
p.Convert()
p.analyzePage()
if err != nil {
@@ -696,9 +696,9 @@
t.Fatalf("incorrect word count for content '%s'. expected %v, got %v", p.plain, 74, p.WordCount)
}
- if p.Summary != SIMPLE_PAGE_WITH_MAIN_ENGLISH_WITH_CJK_RUNES_SUMMARY {
+ if p.Summary != simplePageWithMainEnglishWithCJKRunesSummary {
t.Fatalf("incorrect Summary for content '%s'. expected %v, got %v", p.plain,
- SIMPLE_PAGE_WITH_MAIN_ENGLISH_WITH_CJK_RUNES_SUMMARY, p.Summary)
+ simplePageWithMainEnglishWithCJKRunesSummary, p.Summary)
}
}
@@ -709,7 +709,7 @@
viper.Set("HasCJKLanguage", true)
p, _ := NewPage("simple.md")
- _, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE_WITH_ISCJKLANGUAGE_FALSE))
+ _, err := p.ReadFrom(strings.NewReader(simplePageWithIsCJKLanguageFalse))
p.Convert()
p.analyzePage()
if err != nil {
@@ -720,15 +720,15 @@
t.Fatalf("incorrect word count for content '%s'. expected %v, got %v", p.plain, 75, p.WordCount)
}
- if p.Summary != SIMPLE_PAGE_WITH_ISCJKLANGUAGE_FALSE_SUMMARY {
+ if p.Summary != simplePageWithIsCJKLanguageFalseSummary {
t.Fatalf("incorrect Summary for content '%s'. expected %v, got %v", p.plain,
- SIMPLE_PAGE_WITH_ISCJKLANGUAGE_FALSE_SUMMARY, p.Summary)
+ simplePageWithIsCJKLanguageFalseSummary, p.Summary)
}
}
func TestWordCount(t *testing.T) {
p, _ := NewPage("simple.md")
- _, err := p.ReadFrom(strings.NewReader(SIMPLE_PAGE_WITH_LONG_CONTENT))
+ _, err := p.ReadFrom(strings.NewReader(simplePageWithLongContent))
p.Convert()
p.analyzePage()
if err != nil {
@@ -754,9 +754,9 @@
var tests = []struct {
r string
}{
- {SIMPLE_PAGE_JSON},
- {SIMPLE_PAGE_JSON_LOOSE},
- {SIMPLE_PAGE_JSON_MULTIPLE},
+ {simplePageJSON},
+ {simplePageJSONLoose},
+ {simplePageJSONMultiple},
//{strings.NewReader(SIMPLE_PAGE_JSON_COMPACT)},
}
@@ -773,7 +773,7 @@
r string
err string
}{
- {INVALID_FRONT_MATTER_SHORT_DELIM_ENDING, "unable to read frontmatter at filepos 45: EOF"},
+ {invalidFrontmatterShortDelimEnding, "unable to read frontmatter at filepos 45: EOF"},
}
for _, test := range tests {
@@ -788,14 +788,14 @@
text string
render bool
}{
- {INVALID_FRONT_MATTER_MISSING, true},
+ {invalidFrontMatterMissing, true},
// TODO how to deal with malformed frontmatter. In this case it'll be rendered as markdown.
- {INVALID_FRONT_MATTER_SHORT_DELIM, true},
- {RENDER_NO_FRONT_MATTER, false},
- {CONTENT_WITH_COMMENTED_FM, true},
- {CONTENT_WITH_COMMENTED_TEXT_FM, true},
- {CONTENT_WITH_COMMENTED_LONG_FM, false},
- {CONTENT_WITH_COMMENTED_LONG2_FM, true},
+ {invalidFrontmatterShortDelim, true},
+ {renderNoFrontmatter, false},
+ {contentWithCommentedFrontmatter, true},
+ {contentWithCommentedTextFrontmatter, true},
+ {contentWithCommentedLongFrontmatter, false},
+ {contentWithCommentedLong2Frontmatter, true},
}
for _, test := range tests {
@@ -812,13 +812,13 @@
// Issue #768
func TestCalendarParamsVariants(t *testing.T) {
pageJSON, _ := NewPage("test/fileJSON.md")
- _, _ = pageJSON.ReadFrom(strings.NewReader(PAGE_WITH_CALENDAR_JSON_FRONTMATTER))
+ _, _ = pageJSON.ReadFrom(strings.NewReader(pageWithCalendarJSONFrontmatter))
pageYAML, _ := NewPage("test/fileYAML.md")
- _, _ = pageYAML.ReadFrom(strings.NewReader(PAGE_WITH_CALENDAR_YAML_FRONTMATTER))
+ _, _ = pageYAML.ReadFrom(strings.NewReader(pageWithCalendarYAMLFrontmatter))
pageTOML, _ := NewPage("test/fileTOML.md")
- _, _ = pageTOML.ReadFrom(strings.NewReader(PAGE_WITH_CALENDAR_TOML_FRONTMATTER))
+ _, _ = pageTOML.ReadFrom(strings.NewReader(pageWithCalendarTOMLFrontmatter))
assert.True(t, compareObjects(pageJSON.Params, pageYAML.Params))
assert.True(t, compareObjects(pageJSON.Params, pageTOML.Params))
@@ -827,7 +827,7 @@
func TestDifferentFrontMatterVarTypes(t *testing.T) {
page, _ := NewPage("test/file1.md")
- _, _ = page.ReadFrom(strings.NewReader(PAGE_WITH_VARIOUS_FRONTMATTER_TYPES))
+ _, _ = page.ReadFrom(strings.NewReader(pageWithVariousFrontmatterTypes))
dateval, _ := time.Parse(time.RFC3339, "1979-05-27T07:32:00Z")
if page.GetParam("a_string") != "bar" {
@@ -856,7 +856,7 @@
func TestDegenerateInvalidFrontMatterLeadingWhitespace(t *testing.T) {
p, _ := NewPage("invalid/front/matter/leading/ws")
- _, err := p.ReadFrom(strings.NewReader(INVALID_FRONT_MATTER_LEADING_WS))
+ _, err := p.ReadFrom(strings.NewReader(invalidFrontmatterLadingWs))
if err != nil {
t.Fatalf("Unable to parse front matter given leading whitespace: %s", err)
}
@@ -864,7 +864,7 @@
func TestSectionEvaluation(t *testing.T) {
page, _ := NewPage(filepath.FromSlash("blue/file1.md"))
- page.ReadFrom(strings.NewReader(SIMPLE_PAGE))
+ page.ReadFrom(strings.NewReader(simplePage))
if page.Section() != "blue" {
t.Errorf("Section should be %s, got: %s", "blue", page.Section())
}
@@ -876,11 +876,11 @@
func TestLayoutOverride(t *testing.T) {
var (
- path_content_two_dir = filepath.Join("content", "dub", "sub", "file1.md")
- path_content_one_dir = filepath.Join("content", "gub", "file1.md")
- path_content_no_dir = filepath.Join("content", "file1")
- path_one_directory = filepath.Join("fub", "file1.md")
- path_no_directory = filepath.Join("file1.md")
+ pathContentTwoDir = filepath.Join("content", "dub", "sub", "file1.md")
+ pathContentOneDir = filepath.Join("content", "gub", "file1.md")
+ pathContentNoDir = filepath.Join("content", "file1")
+ pathOneDirectory = filepath.Join("fub", "file1.md")
+ pathNoDirectory = filepath.Join("file1.md")
)
tests := []struct {
content string
@@ -887,25 +887,25 @@
path string
expectedLayout []string
}{
- {SIMPLE_PAGE_NOLAYOUT, path_content_two_dir, L("dub/single.html", "_default/single.html")},
- {SIMPLE_PAGE_NOLAYOUT, path_content_one_dir, L("gub/single.html", "_default/single.html")},
- {SIMPLE_PAGE_NOLAYOUT, path_content_no_dir, L("page/single.html", "_default/single.html")},
- {SIMPLE_PAGE_NOLAYOUT, path_one_directory, L("fub/single.html", "_default/single.html")},
- {SIMPLE_PAGE_NOLAYOUT, path_no_directory, L("page/single.html", "_default/single.html")},
- {SIMPLE_PAGE_LAYOUT_FOOBAR, path_content_two_dir, L("dub/foobar.html", "_default/foobar.html")},
- {SIMPLE_PAGE_LAYOUT_FOOBAR, path_content_one_dir, L("gub/foobar.html", "_default/foobar.html")},
- {SIMPLE_PAGE_LAYOUT_FOOBAR, path_one_directory, L("fub/foobar.html", "_default/foobar.html")},
- {SIMPLE_PAGE_LAYOUT_FOOBAR, path_no_directory, L("page/foobar.html", "_default/foobar.html")},
- {SIMPLE_PAGE_TYPE_FOOBAR, path_content_two_dir, L("foobar/single.html", "_default/single.html")},
- {SIMPLE_PAGE_TYPE_FOOBAR, path_content_one_dir, L("foobar/single.html", "_default/single.html")},
- {SIMPLE_PAGE_TYPE_FOOBAR, path_content_no_dir, L("foobar/single.html", "_default/single.html")},
- {SIMPLE_PAGE_TYPE_FOOBAR, path_one_directory, L("foobar/single.html", "_default/single.html")},
- {SIMPLE_PAGE_TYPE_FOOBAR, path_no_directory, L("foobar/single.html", "_default/single.html")},
- {SIMPLE_PAGE_TYPE_LAYOUT, path_content_two_dir, L("barfoo/buzfoo.html", "_default/buzfoo.html")},
- {SIMPLE_PAGE_TYPE_LAYOUT, path_content_one_dir, L("barfoo/buzfoo.html", "_default/buzfoo.html")},
- {SIMPLE_PAGE_TYPE_LAYOUT, path_content_no_dir, L("barfoo/buzfoo.html", "_default/buzfoo.html")},
- {SIMPLE_PAGE_TYPE_LAYOUT, path_one_directory, L("barfoo/buzfoo.html", "_default/buzfoo.html")},
- {SIMPLE_PAGE_TYPE_LAYOUT, path_no_directory, L("barfoo/buzfoo.html", "_default/buzfoo.html")},
+ {simplePageNoLayout, pathContentTwoDir, L("dub/single.html", "_default/single.html")},
+ {simplePageNoLayout, pathContentOneDir, L("gub/single.html", "_default/single.html")},
+ {simplePageNoLayout, pathContentNoDir, L("page/single.html", "_default/single.html")},
+ {simplePageNoLayout, pathOneDirectory, L("fub/single.html", "_default/single.html")},
+ {simplePageNoLayout, pathNoDirectory, L("page/single.html", "_default/single.html")},
+ {simplePageLayoutFoobar, pathContentTwoDir, L("dub/foobar.html", "_default/foobar.html")},
+ {simplePageLayoutFoobar, pathContentOneDir, L("gub/foobar.html", "_default/foobar.html")},
+ {simplePageLayoutFoobar, pathOneDirectory, L("fub/foobar.html", "_default/foobar.html")},
+ {simplePageLayoutFoobar, pathNoDirectory, L("page/foobar.html", "_default/foobar.html")},
+ {simplePageTypeFoobar, pathContentTwoDir, L("foobar/single.html", "_default/single.html")},
+ {simplePageTypeFoobar, pathContentOneDir, L("foobar/single.html", "_default/single.html")},
+ {simplePageTypeFoobar, pathContentNoDir, L("foobar/single.html", "_default/single.html")},
+ {simplePageTypeFoobar, pathOneDirectory, L("foobar/single.html", "_default/single.html")},
+ {simplePageTypeFoobar, pathNoDirectory, L("foobar/single.html", "_default/single.html")},
+ {simplePageTypeLayout, pathContentTwoDir, L("barfoo/buzfoo.html", "_default/buzfoo.html")},
+ {simplePageTypeLayout, pathContentOneDir, L("barfoo/buzfoo.html", "_default/buzfoo.html")},
+ {simplePageTypeLayout, pathContentNoDir, L("barfoo/buzfoo.html", "_default/buzfoo.html")},
+ {simplePageTypeLayout, pathOneDirectory, L("barfoo/buzfoo.html", "_default/buzfoo.html")},
+ {simplePageTypeLayout, pathNoDirectory, L("barfoo/buzfoo.html", "_default/buzfoo.html")},
}
for _, test := range tests {
p, _ := NewPage(test.path)
@@ -948,7 +948,7 @@
defer viper.Reset()
viper.Set("DefaultExtension", "html")
- site_permalinks_setting := PermalinkOverrides{
+ siteParmalinksSetting := PermalinkOverrides{
"post": ":year/:month/:day/:title/",
}
@@ -958,14 +958,14 @@
hasPermalink bool
expected string
}{
- {SIMPLE_PAGE, "content/post/x.md", false, "content/post/x.html"},
- {SIMPLE_PAGE_WITH_URL, "content/post/x.md", false, "simple/url/index.html"},
- {SIMPLE_PAGE_WITH_SLUG, "content/post/x.md", false, "content/post/simple-slug.html"},
- {SIMPLE_PAGE_WITH_DATE, "content/post/x.md", true, "2013/10/15/simple/index.html"},
- {UTF8_PAGE, "content/post/x.md", false, "content/post/x.html"},
- {UTF8_PAGE_WITH_URL, "content/post/x.md", false, "ラーメン/url/index.html"},
- {UTF8_PAGE_WITH_SLUG, "content/post/x.md", false, "content/post/ラーメン-slug.html"},
- {UTF8_PAGE_WITH_DATE, "content/post/x.md", true, "2013/10/15/ラーメン/index.html"},
+ {simplePage, "content/post/x.md", false, "content/post/x.html"},
+ {simplePageWithURL, "content/post/x.md", false, "simple/url/index.html"},
+ {simplePageWithSlug, "content/post/x.md", false, "content/post/simple-slug.html"},
+ {simplePageWithDate, "content/post/x.md", true, "2013/10/15/simple/index.html"},
+ {UTF8Page, "content/post/x.md", false, "content/post/x.html"},
+ {UTF8PageWithURL, "content/post/x.md", false, "ラーメン/url/index.html"},
+ {UTF8PageWithSlug, "content/post/x.md", false, "content/post/ラーメン-slug.html"},
+ {UTF8PageWithDate, "content/post/x.md", true, "2013/10/15/ラーメン/index.html"},
}
for _, test := range tests {
@@ -973,7 +973,7 @@
p.Node.Site = &SiteInfo{}
if test.hasPermalink {
- p.Node.Site.Permalinks = site_permalinks_setting
+ p.Node.Site.Permalinks = siteParmalinksSetting
}
expectedTargetPath := filepath.FromSlash(test.expected)
@@ -989,7 +989,7 @@
}
}
-var PAGE_WITH_DRAFT_AND_PUBLISHED = `---
+var pageWithDraftAndPublished = `---
title: broken
published: false
draft: true
@@ -998,19 +998,19 @@
`
func TestDraftAndPublishedFrontMatterError(t *testing.T) {
- _, err := NewPageFrom(strings.NewReader(PAGE_WITH_DRAFT_AND_PUBLISHED), "content/post/broken.md")
+ _, err := NewPageFrom(strings.NewReader(pageWithDraftAndPublished), "content/post/broken.md")
if err != ErrHasDraftAndPublished {
t.Errorf("expected ErrHasDraftAndPublished, was %#v", err)
}
}
-var PAGE_WITH_PUBLISHED_FALSE = `---
+var pageWithPublishedFalse = `---
title: okay
published: false
---
some content
`
-var PAGE_WITH_PUBLISHED_TRUE = `---
+var pageWithPublishedTrue = `---
title: okay
published: true
---
@@ -1018,7 +1018,7 @@
`
func TestPublishedFrontMatter(t *testing.T) {
- p, err := NewPageFrom(strings.NewReader(PAGE_WITH_PUBLISHED_FALSE), "content/post/broken.md")
+ p, err := NewPageFrom(strings.NewReader(pageWithPublishedFalse), "content/post/broken.md")
if err != nil {
t.Fatalf("err during parse: %s", err)
}
@@ -1025,7 +1025,7 @@
if !p.Draft {
t.Errorf("expected true, got %t", p.Draft)
}
- p, err = NewPageFrom(strings.NewReader(PAGE_WITH_PUBLISHED_TRUE), "content/post/broken.md")
+ p, err = NewPageFrom(strings.NewReader(pageWithPublishedTrue), "content/post/broken.md")
if err != nil {
t.Fatalf("err during parse: %s", err)
}
--- a/hugolib/permalinks_test.go
+++ b/hugolib/permalinks_test.go
@@ -69,7 +69,7 @@
}
func TestPermalinkExpansion(t *testing.T) {
- page, err := NewPageFrom(strings.NewReader(SIMPLE_PAGE_JSON), "blue/test-page.md")
+ page, err := NewPageFrom(strings.NewReader(simplePageJSON), "blue/test-page.md")
if err != nil {
t.Fatalf("failed before we began, could not parse SIMPLE_PAGE_JSON: %s", err)
}
--- a/hugolib/shortcode_test.go
+++ b/hugolib/shortcode_test.go
@@ -40,7 +40,7 @@
func CheckShortCodeMatchAndError(t *testing.T, input, expected string, template tpl.Template, expectError bool) {
- p, _ := pageFromString(SIMPLE_PAGE, "simple.md")
+ p, _ := pageFromString(simplePage, "simple.md")
output, err := HandleShortcodes(input, p, template)
if err != nil && !expectError {
@@ -60,7 +60,7 @@
tem := tpl.New()
tem.AddInternalShortcode("sc.html", `foo`)
- p, _ := pageFromString(SIMPLE_PAGE, "simple.md")
+ p, _ := pageFromString(simplePage, "simple.md")
for i, this := range []struct {
data string
@@ -265,7 +265,7 @@
void do();
{{< /highlight >}}`
- p, _ := pageFromString(SIMPLE_PAGE, "simple.md")
+ p, _ := pageFromString(simplePage, "simple.md")
output, err := HandleShortcodes(code, p, templ)
if err != nil {
@@ -333,7 +333,7 @@
fmt.Sprintf("Hello %sworld%s. And that's it.", testScPlaceholderRegexp, testScPlaceholderRegexp), ""},
} {
- p, _ := pageFromString(SIMPLE_PAGE, "simple.md")
+ p, _ := pageFromString(simplePage, "simple.md")
tem := tpl.New()
tem.AddInternalShortcode("tag.html", `tag`)
tem.AddInternalShortcode("sc1.html", `sc1`)
--- a/hugolib/site_show_plan_test.go
+++ b/hugolib/site_show_plan_test.go
@@ -30,7 +30,7 @@
var fakeSource = []source.ByteSource{
{
Name: filepath.FromSlash("foo/bar/file.md"),
- Content: []byte(SIMPLE_PAGE),
+ Content: []byte(simplePage),
},
{
Name: filepath.FromSlash("alias/test/file1.md"),
@@ -38,7 +38,7 @@
},
{
Name: filepath.FromSlash("section/somecontent.html"),
- Content: []byte(RENDER_NO_FRONT_MATTER),
+ Content: []byte(renderNoFrontmatter),
},
}
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -151,7 +151,7 @@
{PAGE_SIMPLE_TITLE, TEMPLATE_TITLE, "simple template"},
{PAGE_SIMPLE_TITLE, TEMPLATE_FUNC, "simple-template"},
{PAGE_WITH_MD, TEMPLATE_CONTENT, "\n\n<h1 id=\"heading-1:91b5c4a22fc6103c73bb91e4a40568f8\">heading 1</h1>\n\n<p>text</p>\n\n<h2 id=\"heading-2:91b5c4a22fc6103c73bb91e4a40568f8\">heading 2</h2>\n\n<p>more text</p>\n"},
- {SIMPLE_PAGE_RFC3339_DATE, TEMPLATE_DATE, "2013-05-17 16:59:30 +0000 UTC"},
+ {simplePageRFC3339Date, TEMPLATE_DATE, "2013-05-17 16:59:30 +0000 UTC"},
}
for i, test := range tests {