summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
authorNoah Campbell <noahcampbell@gmail.com>2013-09-18 10:27:56 -0700
committerNoah Campbell <noahcampbell@gmail.com>2013-09-18 10:27:56 -0700
commitc510140c0c55394d5b699c62f60df53ef8a164c7 (patch)
treeb1f979a2e947c95ffa03fa47153ed3163b7983b1 /hugolib
parent67b2abaf098af8391013cb06a623df8c1a8e0f73 (diff)
Add renderer information to --check
Now reports if the page will be rendered or not and by which render engine.
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/planner.go6
-rw-r--r--hugolib/site_show_plan_test.go17
-rw-r--r--hugolib/site_test.go23
3 files changed, 25 insertions, 21 deletions
diff --git a/hugolib/planner.go b/hugolib/planner.go
index 160479c4c..96962350e 100644
--- a/hugolib/planner.go
+++ b/hugolib/planner.go
@@ -11,7 +11,11 @@ func (s *Site) ShowPlan(out io.Writer) (err error) {
}
for _, p := range s.Pages {
- fmt.Fprintf(out, "%s\n", p.FileName)
+ fmt.Fprintf(out, "%s", p.FileName)
+ if p.IsRenderable() {
+ fmt.Fprintf(out, " (renderer: markdown)")
+ }
+ fmt.Fprintf(out, "\n")
fmt.Fprintf(out, " canonical => ")
if s.Target == nil {
fmt.Fprintf(out, "%s\n", "!no target specified!")
diff --git a/hugolib/site_show_plan_test.go b/hugolib/site_show_plan_test.go
index 2d11af8aa..6d0083e68 100644
--- a/hugolib/site_show_plan_test.go
+++ b/hugolib/site_show_plan_test.go
@@ -17,7 +17,6 @@ type byteSource struct {
var fakeSource = []byteSource{
{"foo/bar/file.md", []byte(SIMPLE_PAGE)},
{"alias/test/file1.md", []byte(ALIAS_DOC_1)},
- //{"slug/test/file1.md", []byte(SLUG_DOC_1)},
}
type inMemorySource struct {
@@ -55,8 +54,8 @@ func TestDegenerateNoTarget(t *testing.T) {
Source: &inMemorySource{fakeSource},
}
must(s.CreatePages())
- expected := "foo/bar/file.md\n canonical => !no target specified!\n" +
- "alias/test/file1.md\n canonical => !no target specified!\n"
+ expected := "foo/bar/file.md (renderer: markdown)\n canonical => !no target specified!\n" +
+ "alias/test/file1.md (renderer: markdown)\n canonical => !no target specified!\n"
checkShowPlanExpected(t, s, expected)
}
@@ -67,8 +66,8 @@ func TestFileTarget(t *testing.T) {
Alias: new(target.HTMLRedirectAlias),
}
must(s.CreatePages())
- expected := "foo/bar/file.md\n canonical => foo/bar/file/index.html\n" +
- "alias/test/file1.md\n" +
+ expected := "foo/bar/file.md (renderer: markdown)\n canonical => foo/bar/file/index.html\n" +
+ "alias/test/file1.md (renderer: markdown)\n" +
" canonical => alias/test/file1/index.html\n" +
" alias1/ => alias1/index.html\n" +
" alias-2/ => alias-2/index.html\n"
@@ -82,8 +81,8 @@ func TestFileTargetUgly(t *testing.T) {
Alias: new(target.HTMLRedirectAlias),
}
s.CreatePages()
- expected := "foo/bar/file.md\n canonical => foo/bar/file.html\n" +
- "alias/test/file1.md\n" +
+ expected := "foo/bar/file.md (renderer: markdown)\n canonical => foo/bar/file.html\n" +
+ "alias/test/file1.md (renderer: markdown)\n" +
" canonical => alias/test/file1.html\n" +
" alias1/ => alias1/index.html\n" +
" alias-2/ => alias-2/index.html\n"
@@ -98,8 +97,8 @@ func TestFileTargetPublishDir(t *testing.T) {
}
must(s.CreatePages())
- expected := "foo/bar/file.md\n canonical => ../public/foo/bar/file/index.html\n" +
- "alias/test/file1.md\n" +
+ expected := "foo/bar/file.md (renderer: markdown)\n canonical => ../public/foo/bar/file/index.html\n" +
+ "alias/test/file1.md (renderer: markdown)\n" +
" canonical => ../public/alias/test/file1/index.html\n" +
" alias1/ => ../public/alias1/index.html\n" +
" alias-2/ => ../public/alias-2/index.html\n"
diff --git a/hugolib/site_test.go b/hugolib/site_test.go
index 38b384064..6ae76e7c0 100644
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -8,26 +8,26 @@ import (
"testing"
)
-var TEMPLATE_TITLE = "{{ .Title }}"
-var PAGE_SIMPLE_TITLE = `---
+const (
+ TEMPLATE_TITLE = "{{ .Title }}"
+ PAGE_SIMPLE_TITLE = `---
title: simple template
---
content`
-var TEMPLATE_MISSING_FUNC = "{{ .Title | funcdoesnotexists }}"
-var TEMPLATE_FUNC = "{{ .Title | urlize }}"
-var TEMPLATE_CONTENT = "{{ .Content }}"
-var TEMPLATE_DATE = "{{ .Date }}"
-var INVALID_TEMPLATE_FORMAT_DATE = "{{ .Date.Format time.RFC3339 }}"
-var TEMPLATE_WITH_URL = "<a href=\"foobar.jpg\">Going</a>"
-
-var PAGE_URL_SPECIFIED = `---
+ 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 = "<a href=\"foobar.jpg\">Going</a>"
+ PAGE_URL_SPECIFIED = `---
title: simple template
url: "mycategory/my-whatever-content/"
---
content`
-var PAGE_WITH_MD = `---
+ PAGE_WITH_MD = `---
title: page with md
---
# heading 1
@@ -35,6 +35,7 @@ text
## heading 2
more text
`
+)
func pageMust(p *Page, err error) *Page {
if err != nil {