summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2017-05-07 23:48:22 -0600
committerGitHub <noreply@github.com>2017-05-07 23:48:22 -0600
commit8ae0ce27d43b0cb91077b26b7c8d1075a258239c (patch)
treedadffb5d6b6285568ec381891fa2402ebd4fdacf /test
parent83aaa4dbe6c04c251b1ca2ca892ac001563e3545 (diff)
resolves #2112 sanitize content of authors meta tag in HTML output (PR #2181)
- sanitize content of authors meta tag in HTML output - sanitize value of author and authors attribute before partitioning - consolidate author metadata assignment - add tests
Diffstat (limited to 'test')
-rw-r--r--test/document_test.rb12
-rw-r--r--test/parser_test.rb13
2 files changed, 25 insertions, 0 deletions
diff --git a/test/document_test.rb b/test/document_test.rb
index 0ba136dc..4317cd7d 100644
--- a/test/document_test.rb
+++ b/test/document_test.rb
@@ -1494,6 +1494,18 @@ content
assert_xpath '//articleinfo/authorinitials[text() = "DW"]', output, 1
end
+ test 'should sanitize content of HTML meta authors tag' do
+ input = <<-EOS
+= Document Title
+:author: pass:n[http://example.org/community/team.html[Ze *Product* team]]
+
+content
+ EOS
+
+ output = render_string input
+ assert_xpath '//meta[@name="author"][@content="Ze Product team"]', output, 1
+ end
+
test 'should include multiple authors in HTML output' do
input = <<-EOS
= Document Title
diff --git a/test/parser_test.rb b/test/parser_test.rb
index 89108043..fecf5436 100644
--- a/test/parser_test.rb
+++ b/test/parser_test.rb
@@ -492,6 +492,19 @@ Kismet Chameleon; Johnny Bravo; Lazarus het_Draeke
assert_equal 'het Draeke', doc.attributes['lastname_3']
end
+ test 'removes formatting before partitioning author defined using author attribute' do
+ input = <<-EOS
+:author: pass:n[http://example.org/community/team.html[Ze_**Project** team]]
+ EOS
+
+ doc = empty_document
+ parse_header_metadata input, doc
+ assert_equal 1, doc.attributes['authorcount']
+ assert_equal '<a href="http://example.org/community/team.html">Ze <strong>Project</strong> team</a>', doc.attributes['authors']
+ assert_equal 'Ze Project', doc.attributes['firstname']
+ assert_equal 'team', doc.attributes['lastname']
+ end
+
test "parse rev number date remark" do
input = <<-EOS
Ryan Waldron