)
const (
- CONF_MENU1 = `
+ confMenu1 = `
[[menu.main]]
name = "Go Home"
url = "/"
url = "/новости-проекта"` // Russian => "news-project"
)
-var MENU_PAGE_1 = []byte(`+++
+var menuPage1 = []byte(`+++
title = "One"
[menu]
[menu.p_one]
+++
Front Matter with Menu Pages`)
-var MENU_PAGE_2 = []byte(`+++
+var menuPage2 = []byte(`+++
title = "Two"
weight = 2
[menu]
+++
Front Matter with Menu Pages`)
-var MENU_PAGE_3 = []byte(`+++
+var menuPage3 = []byte(`+++
title = "Three"
weight = 3
[menu]
+++
Front Matter with Menu Pages`)
-var MENU_PAGE_4 = []byte(`+++
+var menuPage4 = []byte(`+++
title = "Four"
weight = 4
[menu]
+++
Front Matter with Menu Pages`)
-var MENU_PAGE_SOURCES = []source.ByteSource{
- {filepath.FromSlash("sect/doc1.md"), MENU_PAGE_1},
- {filepath.FromSlash("sect/doc2.md"), MENU_PAGE_2},
- {filepath.FromSlash("sect/doc3.md"), MENU_PAGE_3},
+var menuPageSources = []source.ByteSource{
+ {filepath.FromSlash("sect/doc1.md"), menuPage1},
+ {filepath.FromSlash("sect/doc2.md"), menuPage2},
+ {filepath.FromSlash("sect/doc3.md"), menuPage3},
}
-var MENU_PAGE_SECTIONS_SOURCES = []source.ByteSource{
- {filepath.FromSlash("first/doc1.md"), MENU_PAGE_1},
- {filepath.FromSlash("first/doc2.md"), MENU_PAGE_2},
- {filepath.FromSlash("second-section/doc3.md"), MENU_PAGE_3},
- {filepath.FromSlash("Fish and Chips/doc4.md"), MENU_PAGE_4},
+var menuPageSectionsSources = []source.ByteSource{
+ {filepath.FromSlash("first/doc1.md"), menuPage1},
+ {filepath.FromSlash("first/doc2.md"), menuPage2},
+ {filepath.FromSlash("second-section/doc3.md"), menuPage3},
+ {filepath.FromSlash("Fish and Chips/doc4.md"), menuPage4},
}
func tstCreateMenuPageWithNameTOML(title, menu, name string) []byte {
viper.Reset()
defer viper.Reset()
- s := setupMenuTests(t, MENU_PAGE_SOURCES)
+ s := setupMenuTests(t, menuPageSources)
if len(s.Pages) != 3 {
t.Fatalf("Posts not created, expected 3 got %d", len(s.Pages))
viper.Reset()
defer viper.Reset()
- s := setupMenuTests(t, MENU_PAGE_SOURCES)
+ s := setupMenuTests(t, menuPageSources)
for i, this := range []struct {
me *MenuEntry
viper.Set("CanonifyURLs", canonifyURLs)
- s := setupMenuTests(t, MENU_PAGE_SOURCES)
+ s := setupMenuTests(t, menuPageSources)
unicodeRussian := findTestMenuEntryByID(s, "unicode", "unicode-russian")
viper.Set("SectionPagesMenu", "spm")
viper.Set("CanonifyURLs", canonifyUrls)
- s := setupMenuTests(t, MENU_PAGE_SECTIONS_SOURCES)
+ s := setupMenuTests(t, menuPageSectionsSources)
assert.Equal(t, 3, len(s.Sections))
defer viper.Reset()
viper.Set("CanonifyURLs", true)
- s := setupMenuTests(t, MENU_PAGE_SOURCES)
+ s := setupMenuTests(t, menuPageSources)
for i, this := range []struct {
menu string
viper.Reset()
defer viper.Reset()
- s := setupMenuTests(t, MENU_PAGE_SOURCES)
+ s := setupMenuTests(t, menuPageSources)
m := *s.Menus["main"]
// main menu has 4 entries
viper.Set("CanonifyURLs", true)
viper.Set("UglyURLs", true)
- s := setupMenuTests(t, MENU_PAGE_SOURCES)
+ s := setupMenuTests(t, menuPageSources)
home := s.newHomeNode()
homeMenuEntry := &MenuEntry{Name: home.Title, URL: home.URL}
}
func setupTestMenuState(s *Site, t *testing.T) {
- menus, err := tomlToMap(CONF_MENU1)
+ menus, err := tomlToMap(confMenu1)
if err != nil {
t.Fatalf("Unable to Read menus: %v", err)
"github.com/spf13/viper"
)
-const SLUG_DOC_1 = "---\ntitle: slug doc 1\nslug: slug-doc-1\naliases:\n - sd1/foo/\n - sd2\n - sd3/\n - sd4.html\n---\nslug doc 1 content\n"
+const slugDoc1 = "---\ntitle: slug doc 1\nslug: slug-doc-1\naliases:\n - sd1/foo/\n - sd2\n - sd3/\n - sd4.html\n---\nslug doc 1 content\n"
-const SLUG_DOC_2 = `---
+const slugDoc2 = `---
title: slug doc 2
slug: slug-doc-2
---
slug doc 2 content
`
-const INDEX_TEMPLATE = "{{ range .Data.Pages }}.{{ end }}"
+const indexTemplate = "{{ range .Data.Pages }}.{{ end }}"
func must(err error) {
if err != nil {
}
var urlFakeSource = []source.ByteSource{
- {filepath.FromSlash("content/blue/doc1.md"), []byte(SLUG_DOC_1)},
- {filepath.FromSlash("content/blue/doc2.md"), []byte(SLUG_DOC_2)},
+ {filepath.FromSlash("content/blue/doc1.md"), []byte(slugDoc1)},
+ {filepath.FromSlash("content/blue/doc2.md"), []byte(slugDoc2)},
}
// Issue #1105
Source: &source.InMemorySource{ByteSource: urlFakeSource},
}
s.initializeSiteInfo()
- s.prepTemplates("indexes/blue.html", INDEX_TEMPLATE)
+ s.prepTemplates("indexes/blue.html", indexTemplate)
if err := s.CreatePages(); err != nil {
t.Errorf("Unable to create pages: %s", err)