Adds ability to link to all files
Fixes request made in #4624 and bug found in #5182
This commit is contained in:
parent
6d2b344c0e
commit
82d6657ae8
|
@ -16,8 +16,8 @@ module Jekyll
|
|||
def render(context)
|
||||
site = context.registers[:site]
|
||||
|
||||
site.docs_to_write.each do |document|
|
||||
return document.url if document.relative_path == @relative_path
|
||||
site.each_site_file do |item|
|
||||
return item.url if item.relative_path == @relative_path
|
||||
end
|
||||
|
||||
raise ArgumentError, <<eos
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
title: Information
|
||||
---
|
||||
|
||||
# Information
|
||||
|
||||
Very important information is here
|
|
@ -12,6 +12,7 @@ class TestTags < JekyllUnitTest
|
|||
|
||||
site.posts.docs.concat(PostReader.new(site).read_posts("")) if override["read_posts"]
|
||||
CollectionReader.new(site).read if override["read_collections"]
|
||||
site.read if override["read_all"]
|
||||
|
||||
info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
|
||||
@converter = site.converters.find { |c| c.class == converter_class }
|
||||
|
@ -627,6 +628,36 @@ CONTENT
|
|||
end
|
||||
end
|
||||
|
||||
context "simple page with linking to a page" do
|
||||
setup do
|
||||
content = <<CONTENT
|
||||
---
|
||||
title: linking
|
||||
---
|
||||
|
||||
{% link contacts.html %}
|
||||
{% link info.md %}
|
||||
CONTENT
|
||||
create_post(content, {
|
||||
"source" => source_dir,
|
||||
"destination" => dest_dir,
|
||||
"read_all" => true
|
||||
})
|
||||
end
|
||||
|
||||
should "not cause an error" do
|
||||
refute_match(%r!markdown\-html\-error!, @result)
|
||||
end
|
||||
|
||||
should "have the URL to the \"contacts\" item" do
|
||||
assert_match(%r!/contacts\.html!, @result)
|
||||
end
|
||||
|
||||
should "have the URL to the \"info\" item" do
|
||||
assert_match(%r!/info\.html!, @result)
|
||||
end
|
||||
end
|
||||
|
||||
context "simple page with linking" do
|
||||
setup do
|
||||
content = <<CONTENT
|
||||
|
|
Loading…
Reference in New Issue