This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-docs.git

commit addd0789d8bed2259d1ff7305500b852a8cda949
Author: Alex Heneveld <[email protected]>
AuthorDate: Sat Sep 4 01:16:41 2021 +0100

    remove spurious link warnings in jekyll
---
 _plugins/jekyll_relative_links.rb | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/_plugins/jekyll_relative_links.rb 
b/_plugins/jekyll_relative_links.rb
index 5af7dd1..b70ea8d 100644
--- a/_plugins/jekyll_relative_links.rb
+++ b/_plugins/jekyll_relative_links.rb
@@ -55,6 +55,10 @@ module JekyllRelativeLinks
     safe true
     priority :lowest
 
+    # warnings can be misleading e.g. if the link is in an excluded liquid 
tag; but might be useful in places
+    # for most things, use eg htmlproofer on the output site
+    @warn = false
+
     def initialize(config)
       @config = config
     end
@@ -65,6 +69,10 @@ module JekyllRelativeLinks
       @context = context
     end
 
+    def warn_missing_links(warn)
+      @warn = warn
+    end
+
     def generate(site)
       return if disabled?
 
@@ -139,7 +147,7 @@ module JekyllRelativeLinks
         url = url_for_path_internal(path.sub(%r!/\z!.freeze, "") + 
"/index.md") unless url
         url = url_for_path_internal(path.sub(%r!\z!.freeze, "") + "/index.md") 
unless url
         url = url_for_path_internal(path.sub(%r!\z!.freeze, ".md")) unless url
-        puts "WARN: unresolved link in #{src}:  #{path}" if !url
+        puts "WARN: unresolved link in #{src}:  #{path}" unless url if @warn
 
       else
         url = url_for_path(pathWithText[1], src) if pathWithText

Reply via email to