From 1c58230ad69bfc7b96390da4843cfb55f69fbe35 Mon Sep 17 00:00:00 2001 From: Ashwin Maroli Date: Tue, 18 Sep 2018 19:08:51 +0530 Subject: [PATCH] print warning only if excerpt has been modified --- lib/jekyll/excerpt.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/excerpt.rb b/lib/jekyll/excerpt.rb index 76c0c2d927b..c3ad47c5cd6 100644 --- a/lib/jekyll/excerpt.rb +++ b/lib/jekyll/excerpt.rb @@ -142,14 +142,15 @@ def extract_excerpt(doc_content) if head.include?("{%") tag_names = head.scan(LIQUID_TAG_REGEX) tag_names.flatten! - print_build_warning unless tag_names.empty? - + modified = false tag_names.reverse_each do |tag_name| next unless liquid_block?(tag_name) next if head =~ endtag_regex_stash(tag_name) + modified = true head << "\n{% end#{tag_name} %}" end + print_build_warning if modified end return head if tail.empty?