Skip to content

Commit 999ae86

Browse files
committed
refactor whitespace handling in indented conditionals
1 parent 4671fea commit 999ae86

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/jekyll-theme-cs50.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,10 @@ def relative_url(input)
389389
end
390390

391391
# Trim whitespace from indented conditionals, so that LI tags aren't wrapped with P tags
392-
page.content.gsub!(/^(\s+){%\s*(if .*?[^\-])\s*%}(\s*)$/, '\1{% \2 -%}\3')
393-
page.content.gsub!(/^(\s+){%\s*(elsif .*?[^\-])\s*%}(\s*)$/, '\1{%- \2 -%}\3')
394-
page.content.gsub!(/^(\s+){%\s*(else)\s*%}(\s*)$/, '\1{%- \2 -%}\3')
395-
page.content.gsub!(/^(\s+){%\s*(endif)\s*%}(\s*)$/, '\1{%- \2 %}\3')
392+
page.content = page.content.gsub(/^(\s+){%\s*(if .*?[^\-])\s*%}(\s*)$/, '\1{% \2 -%}\3')
393+
page.content = page.content.gsub(/^(\s+){%\s*(elsif .*?[^\-])\s*%}(\s*)$/, '\1{%- \2 -%}\3')
394+
page.content = page.content.gsub(/^(\s+){%\s*(else)\s*%}(\s*)$/, '\1{%- \2 -%}\3')
395+
page.content = page.content.gsub(/^(\s+){%\s*(endif)\s*%}(\s*)$/, '\1{%- \2 %}\3')
396396

397397
end
398398

0 commit comments

Comments
 (0)