diff --git a/jekyll-seo-tag.gemspec b/jekyll-seo-tag.gemspec index d525711..57f285e 100644 --- a/jekyll-seo-tag.gemspec +++ b/jekyll-seo-tag.gemspec @@ -28,4 +28,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency "bundler", "~> 1.10" spec.add_development_dependency "rake", "~> 10.0" spec.add_development_dependency "rspec", "~> 3.3" + spec.add_development_dependency "html-proofer", "~> 2.5" + end diff --git a/lib/template.html b/lib/template.html index 40fe508..1366740 100644 --- a/lib/template.html +++ b/lib/template.html @@ -18,7 +18,7 @@ {% endif %} {% endif %} {% if seo_title %} - {% assign seo_title = seo_title | escape | markdownify | strip_html | strip_newlines %} + {% assign seo_title = seo_title | markdownify | strip_html | strip_newlines | escape_once %} {% endif %} {% if page.description %} @@ -27,7 +27,7 @@ {% assign seo_description = site.description %} {% endif %} {% if seo_description %} - {% assign seo_description = seo_description | escape | markdownify | strip_html | strip_newlines %} + {% assign seo_description = seo_description | markdownify | strip_html | strip_newlines | escape_once %} {% endif %} {% if seo_title %} diff --git a/spec/fixtures/_layouts/default.html b/spec/fixtures/_layouts/default.html new file mode 100644 index 0000000..b7afb8d --- /dev/null +++ b/spec/fixtures/_layouts/default.html @@ -0,0 +1,8 @@ + +
+ {% seo %} + + + {{ content }} + + diff --git a/spec/fixtures/_posts/2015-01-01-post.md b/spec/fixtures/_posts/2015-01-01-post.md index e69de29..bd3048e 100644 --- a/spec/fixtures/_posts/2015-01-01-post.md +++ b/spec/fixtures/_posts/2015-01-01-post.md @@ -0,0 +1,5 @@ +--- +title: Some "post" & a test +description: A post +layout: default +--- diff --git a/spec/fixtures/_posts/2015-01-02-other-post.md b/spec/fixtures/_posts/2015-01-02-other-post.md index e69de29..0d6905d 100644 --- a/spec/fixtures/_posts/2015-01-02-other-post.md +++ b/spec/fixtures/_posts/2015-01-02-other-post.md @@ -0,0 +1,3 @@ +--- +layout: default +--- diff --git a/spec/fixtures/page.md b/spec/fixtures/page.md index ef355dc..ae4618b 100644 --- a/spec/fixtures/page.md +++ b/spec/fixtures/page.md @@ -1,4 +1,7 @@ --- +title: blah "blah" & blah +description: Some description +layout: default --- # Test diff --git a/spec/jekyll_seo_tag_spec.rb b/spec/jekyll_seo_tag_spec.rb index a4c5e7f..9f9d6fa 100644 --- a/spec/jekyll_seo_tag_spec.rb +++ b/spec/jekyll_seo_tag_spec.rb @@ -4,6 +4,10 @@ describe Jekyll::SeoTag do subject { Jekyll::SeoTag.new("seo", nil, nil) } + before do + Jekyll.logger.log_level = :error + end + it "builds" do expect(subject.render(context)).to match(/Jekyll SEO tag/i) end @@ -29,9 +33,9 @@ describe Jekyll::SeoTag do end it "escapes titles" do - site = site({"title" => "Jekyll & Hyde"}) + site = site({"title" => 'Jekyll & "Hyde"'}) context = context({ :site => site }) - expect(subject.render(context)).to match(/