diff --git a/lib/docbookrx/docbook_visitor.rb b/lib/docbookrx/docbook_visitor.rb index f056644..b6b55f3 100644 --- a/lib/docbookrx/docbook_visitor.rb +++ b/lib/docbookrx/docbook_visitor.rb @@ -1244,6 +1244,7 @@ def visit_uri node if (ref = @attributes.key(url)) url = %({#{ref}}) end + label = %("#{label.gsub '"', '\\"'}") if label.include? '=' append_text %(#{prefix}#{url}[#{label}]) end false diff --git a/spec/lib/docbookrx/docbookrx_spec.rb b/spec/lib/docbookrx/docbookrx_spec.rb index b8545fd..f5c4b90 100644 --- a/spec/lib/docbookrx/docbookrx_spec.rb +++ b/spec/lib/docbookrx/docbookrx_spec.rb @@ -76,6 +76,18 @@ expect(output).to include(expected) end + it 'should handle equal signs in link element' do + input = <<-EOS +Read about ORM = Object RM on Wikipedia. + EOS + + expected = 'Read about http://en.wikipedia.org/wiki/Object-relational_mapping["ORM = Object RM"] on Wikipedia.' + + output = Docbookrx.convert input + + expect(output).to include(expected) + end + it 'should convert uri element to uri macro' do input = <<-EOS