Yaml frontmatter (#1217)

Render YAML frontmatter

* Fix tests on 5.x

* Update README

* Refactor Page view #table

* Minor refactor

* Refactor
This commit is contained in:
Dawa Ometto
2017-04-09 19:26:04 +02:00
committed by GitHub
parent c1f94d2deb
commit 8aa10fe400
9 changed files with 70 additions and 13 deletions
+4 -4
View File
@@ -636,11 +636,11 @@ context "Frontend with lotr" do
body = last_response.body
assert body.include?("Bilbo Baggins"), "/pages should include the page 'Bilbo Baggins'"
assert body.include?("Bilbo-Baggins"), "/pages should include the page 'Bilbo Baggins'"
assert body.include?("Gondor"), "/pages should include the folder 'Gondor'"
assert !body.include?("Boromir"), "/pages should NOT include the page 'Boromir'"
assert body.include?("Mordor"), "/pages should include the folder 'Mordor'"
assert !body.include?("Eye Of Sauron"), "/pages should NOT include the page 'Eye Of Sauron'"
assert !body.include?("Eye-Of-Sauron"), "/pages should NOT include the page 'Eye Of Sauron'"
assert !body.match(/(Zamin).+(roast\-mutton)/m), "/pages should be sorted alphabetically"
end
@@ -650,8 +650,8 @@ context "Frontend with lotr" do
body = last_response.body
assert !body.include?("Bilbo Baggins"), "/pages/Mordor/ should NOT include the page 'Bilbo Baggins'"
assert body.include?("Eye Of Sauron"), "/pages/Mordor/ should include the page 'Eye Of Sauron'"
assert !body.include?("Bilbo-Baggins"), "/pages/Mordor/ should NOT include the page 'Bilbo Baggins'"
assert body.include?("Eye-Of-Sauron"), "/pages/Mordor/ should include the page 'Eye Of Sauron'"
end
test "symbolic link pages" do
+22
View File
@@ -29,6 +29,28 @@ context "Precious::Views::Page" do
assert_equal '1 & 2', actual
end
test "metadata is rendered into a table" do
title = 'metadata test'
@wiki.write_page(title, :markdown, "---\nsome: metadata\nhere: for you\n---\n# Some markdown\nIn this doc")
page = @wiki.page(title)
@view = Precious::Views::Page.new
@view.instance_variable_set :@page, page
assert_equal @view.rendered_metadata, <<-EOS
<table>
<tr>
<th>some</th>
<th>here</th>
</tr>
<tr>
<td>metadata</td>
<td>for you</td>
</tr>
</table>
EOS
end
test "h1 title can be disabled" do
title = 'H1'
@wiki.write_page(title, :markdown, '# 1 & 2 <script>alert("js")</script>' + "\n # 3", commit_details)