From 82d6657ae8658584c714cd0f5afed5195d41b65d Mon Sep 17 00:00:00 2001 From: Jeff Kolesky Date: Wed, 3 Aug 2016 15:08:26 -0700 Subject: [PATCH] Adds ability to link to all files Fixes request made in #4624 and bug found in #5182 --- lib/jekyll/tags/link.rb | 4 ++-- test/source/info.md | 7 +++++++ test/test_tags.rb | 31 +++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 test/source/info.md diff --git a/lib/jekyll/tags/link.rb b/lib/jekyll/tags/link.rb index 6ffd4726..03e2e52b 100644 --- a/lib/jekyll/tags/link.rb +++ b/lib/jekyll/tags/link.rb @@ -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, < [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 = < 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 = <