Merge pull request #16 from pathawks/gsub

Combine two gsubs into one
This commit is contained in:
Ben Balter 2016-01-06 10:35:16 -05:00
commit c4bac39745
1 changed files with 7 additions and 2 deletions

View File

@ -3,6 +3,12 @@ module Jekyll
attr_accessor :context
HTML_ESCAPE = {
"\u201c".freeze => '“'.freeze,
"\u201d".freeze => '”'.freeze
}
HTML_ESCAPE_REGEX = Regexp.union(HTML_ESCAPE.keys).freeze
def render(context)
@context = context
output = Liquid::Template.parse(template_contents).render!(payload, info)
@ -11,8 +17,7 @@ module Jekyll
output.gsub!(/[\s]{2,}/, "\n")
# Encode smart quotes. See https://github.com/benbalter/jekyll-seo-tag/pull/6
output.gsub!("\u201c", "“")
output.gsub!("\u201d", "”")
output.gsub!(HTML_ESCAPE_REGEX, HTML_ESCAPE)
output
end