Merge pull request #4389 from zsyed91/refactor_page_permalink
Merge pull request 4389
This commit is contained in:
commit
c42d27e428
|
@ -63,8 +63,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns the String permalink or nil if none has been set.
|
# Returns the String permalink or nil if none has been set.
|
||||||
def permalink
|
def permalink
|
||||||
return nil if data.nil? || data['permalink'].nil?
|
data.nil? ? nil : data['permalink']
|
||||||
data['permalink']
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# The template of the permalink.
|
# The template of the permalink.
|
||||||
|
|
|
@ -8,7 +8,9 @@ class TestPage < JekyllUnitTest
|
||||||
end
|
end
|
||||||
|
|
||||||
def do_render(page)
|
def do_render(page)
|
||||||
layouts = { "default" => Layout.new(@site, source_dir('_layouts'), "simple.html")}
|
layouts = {
|
||||||
|
"default" => Layout.new(@site, source_dir('_layouts'), "simple.html")
|
||||||
|
}
|
||||||
page.render(layouts, @site.site_payload)
|
page.render(layouts, @site.site_payload)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -206,6 +208,11 @@ class TestPage < JekyllUnitTest
|
||||||
assert_equal "/about/", @page.dir
|
assert_equal "/about/", @page.dir
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "return nil permalink if no permalink exists" do
|
||||||
|
@page = setup_page('')
|
||||||
|
assert_equal nil, @page.permalink
|
||||||
|
end
|
||||||
|
|
||||||
should "not be writable outside of destination" do
|
should "not be writable outside of destination" do
|
||||||
unexpected = File.expand_path("../../../baddie.html", dest_dir)
|
unexpected = File.expand_path("../../../baddie.html", dest_dir)
|
||||||
File.delete unexpected if File.exist?(unexpected)
|
File.delete unexpected if File.exist?(unexpected)
|
||||||
|
|
Loading…
Reference in New Issue