Skip to content

Commit

Permalink
print warning only if excerpt has been modified
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmaroli committed Sep 18, 2018
1 parent e1d6db0 commit 61831d4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/jekyll/excerpt.rb
Expand Up @@ -140,16 +140,17 @@ def extract_excerpt(doc_content)
# append appropriate closing tag(s) (for each Liquid block), to the `head` if the
# partitioning resulted in leaving the closing tag somewhere in the `tail` partition.
if head.include?("{%")
modified = false
tag_names = head.scan(LIQUID_TAG_REGEX)
tag_names.flatten!
print_build_warning unless tag_names.empty?

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?
Expand Down

0 comments on commit 61831d4

Please sign in to comment.