Skip to content

Commit

Permalink
avoid using regex unless necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmaroli committed Jan 31, 2018
1 parent 15103fb commit 1fb9ab1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/jekyll/excerpt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ def extract_excerpt(doc_content)
# append appropriate closing tag (to a Liquid block), to the "head" if the
# partitioning resulted in leaving the closing tag somewhere in the "tail"
# partition.
if head =~ %r!{%\s*(\w+).+\s*%}!
if head.include?("{%")
head.match %r!{%\s*(\w+).+\s*%}!
tag_name = Regexp.last_match(1)

if liquid_block?(tag_name) && head.match(%r!{%\s*end#{tag_name}.+\s*%}!).nil?
Expand Down

0 comments on commit 1fb9ab1

Please sign in to comment.