class Asciidoctor::HTML5::InlineAnchorTemplate

Public Instance Methods

anchor(target, text, type, document, window = nil) click to toggle source
# File lib/asciidoctor/backends/html5.rb, line 623
def anchor(target, text, type, document, window = nil)
  case type
  when :xref
    text = document.references[:ids].fetch(target, "[#{target}]") if text.nil?
    %Q(<a href="##{target}">#{text}</a>)
  when :ref
    %Q(<a id="#{target}"></a>)
  when :bibref
    %Q(<a id="#{target}"></a>[#{target}])
  when :link
    %Q(<a href="#{target}"#{window && " target=\"#{window}\""}>#{text}</a>)
  end
end
template() click to toggle source
# File lib/asciidoctor/backends/html5.rb, line 637
  def template
    # hot piece of code, optimized for speed
    @template ||= @eruby.new "<%#encoding:UTF-8%><%= template.anchor(@target, @text, @type, @document, @type == :link ? attr('window') : nil) %>
"
  end