class Asciidoctor::DocBook5::InlineAnchorTemplate

Public Instance Methods

anchor(target, text, type, node) click to toggle source
# File lib/asciidoctor/backends/docbook5.rb, line 79
def anchor(target, text, type, node)
  case type
  when :ref
    %Q(<anchor#{common_attrs target, nil, text}/>)
  when :xref
    if node.attr? 'path', nil
      linkend = (node.attr 'fragment') || target
      text.nil? ? %Q(<xref linkend="#{linkend}"/>) : %Q(<link linkend="#{linkend}">#{text}</link>)
    else
      text = text || (node.attr 'path')
      %Q(<link xlink:href="#{target}">#{text}</link>)
    end
  when :link
    %Q(<link xlink:href="#{target}">#{text}</link>)
  when :bibref
    %Q(<anchor#{common_attrs target, nil, "[#{target}]"}/>[#{target}])
  end
end