Combine two gsubs into one
This commit is contained in:
parent
9f3da7e6fe
commit
b6f096372d
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue