class Asciidoctor::Converter::DocBook5Converter

def common_attributes id, role = nil, reftext = nil

def common_attributes id, role = nil, reftext = nil
  if id
    attrs = %( xml:id="#{id}"#{role ? %[ role="#{role}"] : ''})
  elsif role
    attrs = %( role="#{role}")
  else
    attrs = ''
  end
  if reftext
    if (reftext.include? '<') && ((reftext = reftext.gsub XmlSanitizeRx, '').include? ' ')
      reftext = (reftext.squeeze ' ').strip
    end
    reftext = reftext.gsub '"', '&quot;' if reftext.include? '"'
    %(#{attrs} xreflabel="#{reftext}")
  else
    attrs
  end
end