diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2019-04-22 00:52:47 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2019-04-22 00:52:47 -0600 |
| commit | c00795f0f77faeb20456c5941342e96fdfcc85a5 (patch) | |
| tree | 3f8f9fa57732c2b4d7dd505b492cce3831b4eb3d | |
| parent | 39fd55d089863a2b16f099f1275a593a10663080 (diff) | |
add additional test for xreflabel on anchor in DocBook output
| -rw-r--r-- | lib/asciidoctor/converter/docbook5.rb | 2 | ||||
| -rw-r--r-- | test/links_test.rb | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/asciidoctor/converter/docbook5.rb b/lib/asciidoctor/converter/docbook5.rb index eaaddec7..db46175b 100644 --- a/lib/asciidoctor/converter/docbook5.rb +++ b/lib/asciidoctor/converter/docbook5.rb @@ -622,7 +622,7 @@ class Converter::DocBook5Converter < Converter::Base if (reftext.include? '<') && ((reftext = reftext.gsub XmlSanitizeRx, '').include? ' ') reftext = (reftext.squeeze ' ').strip end - reftext = (reftext.gsub '"', '"') if reftext.include? '"' + reftext = reftext.gsub '"', '"' if reftext.include? '"' %(#{attrs} xreflabel="#{reftext}") else attrs diff --git a/test/links_test.rb b/test/links_test.rb index 2418df11..56ddd1e5 100644 --- a/test/links_test.rb +++ b/test/links_test.rb @@ -366,9 +366,10 @@ context 'Links' do end test 'assigns xreflabel value for anchor macro without reftext in DocBook output' do - input = 'anchor:foo[]' - result = convert_inline_string input, backend: :docbook - assert_equal '<anchor xml:id="foo" xreflabel="[foo]"/>', result + ['anchor:foo[]bar', '[[foo]]bar'].each do |input| + result = convert_inline_string input, backend: :docbook + assert_equal '<anchor xml:id="foo" xreflabel="[foo]"/>bar', result + end end test 'unescapes square bracket in reftext of anchor macro' do |
