Adds ability to link to all files

Fixes request made in #4624 and bug found in #5182
This commit is contained in:
Jeff Kolesky 2016-08-03 15:08:26 -07:00
parent 6d2b344c0e
commit 82d6657ae8
3 changed files with 40 additions and 2 deletions

View File

@ -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

7
test/source/info.md Normal file
View File

@ -0,0 +1,7 @@
---
title: Information
---
# Information
Very important information is here

View File

@ -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