mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 22:51:32 -05:00
Add renderer information to --check
Now reports if the page will be rendered or not and by which render engine.
This commit is contained in:
parent
67b2abaf09
commit
c510140c0c
3 changed files with 25 additions and 21 deletions
|
@ -11,7 +11,11 @@ func (s *Site) ShowPlan(out io.Writer) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range s.Pages {
|
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 => ")
|
fmt.Fprintf(out, " canonical => ")
|
||||||
if s.Target == nil {
|
if s.Target == nil {
|
||||||
fmt.Fprintf(out, "%s\n", "!no target specified!")
|
fmt.Fprintf(out, "%s\n", "!no target specified!")
|
||||||
|
|
|
@ -17,7 +17,6 @@ type byteSource struct {
|
||||||
var fakeSource = []byteSource{
|
var fakeSource = []byteSource{
|
||||||
{"foo/bar/file.md", []byte(SIMPLE_PAGE)},
|
{"foo/bar/file.md", []byte(SIMPLE_PAGE)},
|
||||||
{"alias/test/file1.md", []byte(ALIAS_DOC_1)},
|
{"alias/test/file1.md", []byte(ALIAS_DOC_1)},
|
||||||
//{"slug/test/file1.md", []byte(SLUG_DOC_1)},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type inMemorySource struct {
|
type inMemorySource struct {
|
||||||
|
@ -55,8 +54,8 @@ func TestDegenerateNoTarget(t *testing.T) {
|
||||||
Source: &inMemorySource{fakeSource},
|
Source: &inMemorySource{fakeSource},
|
||||||
}
|
}
|
||||||
must(s.CreatePages())
|
must(s.CreatePages())
|
||||||
expected := "foo/bar/file.md\n canonical => !no target specified!\n" +
|
expected := "foo/bar/file.md (renderer: markdown)\n canonical => !no target specified!\n" +
|
||||||
"alias/test/file1.md\n canonical => !no target specified!\n"
|
"alias/test/file1.md (renderer: markdown)\n canonical => !no target specified!\n"
|
||||||
checkShowPlanExpected(t, s, expected)
|
checkShowPlanExpected(t, s, expected)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,8 +66,8 @@ func TestFileTarget(t *testing.T) {
|
||||||
Alias: new(target.HTMLRedirectAlias),
|
Alias: new(target.HTMLRedirectAlias),
|
||||||
}
|
}
|
||||||
must(s.CreatePages())
|
must(s.CreatePages())
|
||||||
expected := "foo/bar/file.md\n canonical => foo/bar/file/index.html\n" +
|
expected := "foo/bar/file.md (renderer: markdown)\n canonical => foo/bar/file/index.html\n" +
|
||||||
"alias/test/file1.md\n" +
|
"alias/test/file1.md (renderer: markdown)\n" +
|
||||||
" canonical => alias/test/file1/index.html\n" +
|
" canonical => alias/test/file1/index.html\n" +
|
||||||
" alias1/ => alias1/index.html\n" +
|
" alias1/ => alias1/index.html\n" +
|
||||||
" alias-2/ => alias-2/index.html\n"
|
" alias-2/ => alias-2/index.html\n"
|
||||||
|
@ -82,8 +81,8 @@ func TestFileTargetUgly(t *testing.T) {
|
||||||
Alias: new(target.HTMLRedirectAlias),
|
Alias: new(target.HTMLRedirectAlias),
|
||||||
}
|
}
|
||||||
s.CreatePages()
|
s.CreatePages()
|
||||||
expected := "foo/bar/file.md\n canonical => foo/bar/file.html\n" +
|
expected := "foo/bar/file.md (renderer: markdown)\n canonical => foo/bar/file.html\n" +
|
||||||
"alias/test/file1.md\n" +
|
"alias/test/file1.md (renderer: markdown)\n" +
|
||||||
" canonical => alias/test/file1.html\n" +
|
" canonical => alias/test/file1.html\n" +
|
||||||
" alias1/ => alias1/index.html\n" +
|
" alias1/ => alias1/index.html\n" +
|
||||||
" alias-2/ => alias-2/index.html\n"
|
" alias-2/ => alias-2/index.html\n"
|
||||||
|
@ -98,8 +97,8 @@ func TestFileTargetPublishDir(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
must(s.CreatePages())
|
must(s.CreatePages())
|
||||||
expected := "foo/bar/file.md\n canonical => ../public/foo/bar/file/index.html\n" +
|
expected := "foo/bar/file.md (renderer: markdown)\n canonical => ../public/foo/bar/file/index.html\n" +
|
||||||
"alias/test/file1.md\n" +
|
"alias/test/file1.md (renderer: markdown)\n" +
|
||||||
" canonical => ../public/alias/test/file1/index.html\n" +
|
" canonical => ../public/alias/test/file1/index.html\n" +
|
||||||
" alias1/ => ../public/alias1/index.html\n" +
|
" alias1/ => ../public/alias1/index.html\n" +
|
||||||
" alias-2/ => ../public/alias-2/index.html\n"
|
" alias-2/ => ../public/alias-2/index.html\n"
|
||||||
|
|
|
@ -8,26 +8,26 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var TEMPLATE_TITLE = "{{ .Title }}"
|
const (
|
||||||
var PAGE_SIMPLE_TITLE = `---
|
TEMPLATE_TITLE = "{{ .Title }}"
|
||||||
|
PAGE_SIMPLE_TITLE = `---
|
||||||
title: simple template
|
title: simple template
|
||||||
---
|
---
|
||||||
content`
|
content`
|
||||||
|
|
||||||
var TEMPLATE_MISSING_FUNC = "{{ .Title | funcdoesnotexists }}"
|
TEMPLATE_MISSING_FUNC = "{{ .Title | funcdoesnotexists }}"
|
||||||
var TEMPLATE_FUNC = "{{ .Title | urlize }}"
|
TEMPLATE_FUNC = "{{ .Title | urlize }}"
|
||||||
var TEMPLATE_CONTENT = "{{ .Content }}"
|
TEMPLATE_CONTENT = "{{ .Content }}"
|
||||||
var TEMPLATE_DATE = "{{ .Date }}"
|
TEMPLATE_DATE = "{{ .Date }}"
|
||||||
var INVALID_TEMPLATE_FORMAT_DATE = "{{ .Date.Format time.RFC3339 }}"
|
INVALID_TEMPLATE_FORMAT_DATE = "{{ .Date.Format time.RFC3339 }}"
|
||||||
var TEMPLATE_WITH_URL = "<a href=\"foobar.jpg\">Going</a>"
|
TEMPLATE_WITH_URL = "<a href=\"foobar.jpg\">Going</a>"
|
||||||
|
PAGE_URL_SPECIFIED = `---
|
||||||
var PAGE_URL_SPECIFIED = `---
|
|
||||||
title: simple template
|
title: simple template
|
||||||
url: "mycategory/my-whatever-content/"
|
url: "mycategory/my-whatever-content/"
|
||||||
---
|
---
|
||||||
content`
|
content`
|
||||||
|
|
||||||
var PAGE_WITH_MD = `---
|
PAGE_WITH_MD = `---
|
||||||
title: page with md
|
title: page with md
|
||||||
---
|
---
|
||||||
# heading 1
|
# heading 1
|
||||||
|
@ -35,6 +35,7 @@ text
|
||||||
## heading 2
|
## heading 2
|
||||||
more text
|
more text
|
||||||
`
|
`
|
||||||
|
)
|
||||||
|
|
||||||
func pageMust(p *Page, err error) *Page {
|
func pageMust(p *Page, err error) *Page {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue