node to page: Make Nodes into Pages

* `.Site.Pages` now contains all page types, including sections etc.
* `.Data.Pages` will also contain "node type" pages where relevant.

Updates #2297
This commit is contained in:
Bjørn Erik Pedersen
2016-11-11 09:01:47 +01:00
parent 88972b0d5b
commit 063b78d2ec
15 changed files with 135 additions and 156 deletions

View File

@@ -630,9 +630,9 @@ func testAllMarkdownEnginesForPages(t *testing.T,
t.Fatalf("Failed to build site: %s", err)
}
require.Len(t, s.Pages, len(pageSources))
require.Len(t, s.regularPages, len(pageSources))
assertFunc(t, e.ext, s.Pages)
assertFunc(t, e.ext, s.regularPages)
}
@@ -740,9 +740,9 @@ func TestPageWithDelimiterForMarkdownThatCrossesBorder(t *testing.T) {
t.Fatalf("Failed to build site: %s", err)
}
require.Len(t, s.Pages, 1)
require.Len(t, s.regularPages, 1)
p := s.Pages[0]
p := s.regularPages[0]
if p.Summary != template.HTML("<p>The <a href=\"http://gohugo.io/\">best static site generator</a>.<sup class=\"footnote-ref\" id=\"fnref:1\"><a rel=\"footnote\" href=\"#fn:1\">1</a></sup>\n</p>") {
t.Fatalf("Got summary:\n%q", p.Summary)
@@ -788,9 +788,9 @@ func TestPageWithAdditionalExtension(t *testing.T) {
t.Fatalf("Failed to build site: %s", err)
}
require.Len(t, s.Pages, 1)
require.Len(t, s.regularPages, 1)
p := s.Pages[0]
p := s.regularPages[0]
checkPageContent(t, p, "<p>first line.<br />\nsecond line.</p>\n\n<p>fourth line.</p>\n")
}
@@ -802,9 +802,9 @@ func TestTableOfContents(t *testing.T) {
t.Fatalf("Failed to build site: %s", err)
}
require.Len(t, s.Pages, 1)
require.Len(t, s.regularPages, 1)
p := s.Pages[0]
p := s.regularPages[0]
checkPageContent(t, p, "\n\n<p>For some moments the old man did not reply. He stood with bowed head, buried in deep thought. But at last he spoke.</p>\n\n<h2 id=\"aa\">AA</h2>\n\n<p>I have no idea, of course, how long it took me to reach the limit of the plain,\nbut at last I entered the foothills, following a pretty little canyon upward\ntoward the mountains. Beside me frolicked a laughing brooklet, hurrying upon\nits noisy way down to the silent sea. In its quieter pools I discovered many\nsmall fish, of four-or five-pound weight I should imagine. In appearance,\nexcept as to size and color, they were not unlike the whale of our own seas. As\nI watched them playing about I discovered, not only that they suckled their\nyoung, but that at intervals they rose to the surface to breathe as well as to\nfeed upon certain grasses and a strange, scarlet lichen which grew upon the\nrocks just above the water line.</p>\n\n<h3 id=\"aaa\">AAA</h3>\n\n<p>I remember I felt an extraordinary persuasion that I was being played with,\nthat presently, when I was upon the very verge of safety, this mysterious\ndeath&ndash;as swift as the passage of light&ndash;would leap after me from the pit about\nthe cylinder and strike me down. ## BB</p>\n\n<h3 id=\"bbb\">BBB</h3>\n\n<p>&ldquo;You&rsquo;re a great Granser,&rdquo; he cried delightedly, &ldquo;always making believe them little marks mean something.&rdquo;</p>\n")
checkPageTOC(t, p, "<nav id=\"TableOfContents\">\n<ul>\n<li>\n<ul>\n<li><a href=\"#aa\">AA</a>\n<ul>\n<li><a href=\"#aaa\">AAA</a></li>\n<li><a href=\"#bbb\">BBB</a></li>\n</ul></li>\n</ul></li>\n</ul>\n</nav>")
@@ -832,9 +832,9 @@ func TestPageWithDate(t *testing.T) {
t.Fatalf("Failed to build site: %s", err)
}
require.Len(t, s.Pages, 1)
require.Len(t, s.regularPages, 1)
p := s.Pages[0]
p := s.regularPages[0]
d, _ := time.Parse(time.RFC3339, "2013-05-17T16:59:30Z")
checkPageDate(t, p, d)
@@ -1266,9 +1266,9 @@ func TestChompBOM(t *testing.T) {
t.Fatalf("Failed to build site: %s", err)
}
require.Len(t, s.Pages, 1)
require.Len(t, s.regularPages, 1)
p := s.Pages[0]
p := s.regularPages[0]
checkPageTitle(t, p, "Simple")
}