ref: c510140c0c55394d5b699c62f60df53ef8a164c7
parent: 67b2abaf098af8391013cb06a623df8c1a8e0f73
author: Noah Campbell <[email protected]>
date: Wed Sep 18 06:27:56 EDT 2013
Add renderer information to --check Now reports if the page will be rendered or not and by which render engine.
--- a/hugolib/planner.go
+++ b/hugolib/planner.go
@@ -11,7 +11,11 @@
}
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!")
--- a/hugolib/site_show_plan_test.go
+++ b/hugolib/site_show_plan_test.go
@@ -17,7 +17,6 @@
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 @@
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 @@
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 @@
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 @@
}
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"
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -8,26 +8,26 @@
"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 @@
## heading 2
more text
`
+)
func pageMust(p *Page, err error) *Page {
if err != nil {