Merge pull request #5199 from jeffkole/adds-linking-to-all-files
Merge pull request 5199
This commit is contained in:
commit
4888b84b44
|
@ -16,8 +16,10 @@ 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
|
||||
# This takes care of the case for static files that have a leading /
|
||||
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
|
|
@ -475,7 +475,7 @@ class TestFilters < JekyllUnitTest
|
|||
g["items"].is_a?(Array),
|
||||
"The list of grouped items for '' is not an Array."
|
||||
)
|
||||
assert_equal 13, g["items"].size
|
||||
assert_equal 14, g["items"].size
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -191,6 +191,7 @@ class TestSite < JekyllUnitTest
|
|||
humans.txt
|
||||
index.html
|
||||
index.html
|
||||
info.md
|
||||
main.scss
|
||||
main.scss
|
||||
properties.html
|
||||
|
|
|
@ -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,41 @@ CONTENT
|
|||
end
|
||||
end
|
||||
|
||||
context "simple page with linking to a page" do
|
||||
setup do
|
||||
content = <<CONTENT
|
||||
---
|
||||
title: linking
|
||||
---
|
||||
|
||||
{% link contacts.html %}
|
||||
{% link info.md %}
|
||||
{% link /css/screen.css %}
|
||||
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
|
||||
|
||||
should "have the URL to the \"screen.css\" item" do
|
||||
assert_match(%r!/css/screen\.css!, @result)
|
||||
end
|
||||
end
|
||||
|
||||
context "simple page with linking" do
|
||||
setup do
|
||||
content = <<CONTENT
|
||||
|
|
Loading…
Reference in New Issue