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.
|
||||
def permalink
|
||||
return nil if data.nil? || data['permalink'].nil?
|
||||
data['permalink']
|
||||
data.nil? ? nil : data['permalink']
|
||||
end
|
||||
|
||||
# The template of the permalink.
|
||||
|
|
|
@ -8,7 +8,9 @@ class TestPage < JekyllUnitTest
|
|||
end
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
|
@ -206,6 +208,11 @@ class TestPage < JekyllUnitTest
|
|||
assert_equal "/about/", @page.dir
|
||||
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
|
||||
unexpected = File.expand_path("../../../baddie.html", dest_dir)
|
||||
File.delete unexpected if File.exist?(unexpected)
|
||||
|
|
Loading…
Reference in New Issue