test/links_test.rb in asciidoctor-1.5.3 vs test/links_test.rb in asciidoctor-1.5.4
- old
+ new
@@ -36,10 +36,20 @@
test 'qualified url using macro syntax with multi-line label inline with text' do
assert_xpath %{//a[@href='http://asciidoc.org'][text() = 'AsciiDoc\nmarkup']}, render_string("We're parsing link:http://asciidoc.org[AsciiDoc\nmarkup]")
end
+ test 'qualified url with label containing square brackets using link macro' do
+ str = 'http://example.com[[bracket1\]]'
+ doc = document_from_string str, :header_footer => false, :doctype => 'inline'
+ assert_match '<a href="http://example.com">[bracket1]</a>', doc.convert, 1
+ doc = document_from_string str, :header_footer => false, :backend => 'docbook', :doctype => 'inline'
+ assert_match '<link xl:href="http://example.com">[bracket1]</link>', doc.convert, 1
+ doc = document_from_string str, :header_footer => false, :backend => 'docbook45', :doctype => 'inline'
+ assert_match '<ulink url="http://example.com">[bracket1]</ulink>', doc.convert, 1
+ end
+
test 'qualified url surrounded by angled brackets' do
assert_xpath '//a[@href="http://asciidoc.org"][text()="http://asciidoc.org"]', render_string('<http://asciidoc.org> is the project page for AsciiDoc.'), 1
end
test 'qualified url surrounded by round brackets' do
@@ -73,11 +83,11 @@
test 'qualified url adjacent to text in round brackets' do
assert_xpath '//a[@href="http://asciidoc.org"][text()="AsciiDoc"]', render_string(')http://asciidoc.org[AsciiDoc] project page.'), 1
end
test 'qualified url following smart apostrophe' do
- output = render_embedded_string("l’http://www.irit.fr[IRIT]")
+ output = render_embedded_string("l’http://www.irit.fr[IRIT]")
assert_match(/l’<a href=/, output)
end
test 'qualified url using invalid link macro should not create link' do
assert_xpath '//a', render_string('link:http://asciidoc.org is the project page for AsciiDoc.'), 0
@@ -202,11 +212,11 @@
assert_xpath '//a[@href="tigers.html"][text() = "[tigers]"]', doc.render, 1
end
test 'xref using angled bracket syntax with path sans extension using docbook backend' do
doc = document_from_string '<<tigers#>>', :header_footer => false, :backend => 'docbook'
- assert_match '<link xlink:href="tigers.xml">tigers.xml</link>', doc.render, 1
+ assert_match '<link xl:href="tigers.xml">tigers.xml</link>', doc.render, 1
doc = document_from_string '<<tigers#>>', :header_footer => false, :backend => 'docbook45'
assert_match '<ulink url="tigers.xml">tigers.xml</ulink>', doc.render, 1
end
test 'xref using angled bracket syntax with ancestor path sans extension' do
@@ -305,10 +315,10 @@
== Section B
<\<_section_a>>
EOS
-
+
output = render_embedded_string input
assert_xpath '//h2[@id="_section_a"][text()="Section A"]', output, 1
assert_xpath '//a[@href="#_section_a"][text()="Section A"]', output, 1
assert_xpath '//h2[@id="_section_b"][text()="Section B"]', output, 1
assert_xpath '//a[@href="#_section_b"][text()="Section B"]', output, 1