Do not escape characters

This commit is contained in:
Pat Hawks 2016-01-11 13:50:15 -08:00
parent 85934ae5de
commit fe4c5566fe
No known key found for this signature in database
GPG Key ID: F1746FF5F18B3D1B
2 changed files with 0 additions and 22 deletions

View File

@ -3,19 +3,10 @@ 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)
# Encode smart quotes. See https://github.com/benbalter/jekyll-seo-tag/pull/6
output.gsub!(HTML_ESCAPE_REGEX, HTML_ESCAPE)
output
end

View File

@ -32,19 +32,6 @@ describe Jekyll::SeoTag do
expect(subject.render(context)).to match(/<title>foo<\/title>/)
end
it "escapes titles" do
site = site({"title" => 'Jekyll & "Hyde"'})
context = context({ :site => site })
expect(subject.render(context)).to match(/<title>Jekyll &amp; &ldquo;Hyde&rdquo;<\/title>/)
end
it "escapes descriptions" do
site = site({"description" => 'Jekyll & "Hyde"'})
context = context({ :site => site })
expected = /<meta name="description" content="Jekyll &amp; &ldquo;Hyde&rdquo;" \/>/
expect(subject.render(context)).to match(expected)
end
it "uses the page description" do
page = page({"description" => "foo"})
context = context({ :page => page })