Sha256: 78d41e58dc7091644985e173895f285499172315c4679b1d1200cbb51ddd4dad
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
module Asciidoctor module ISO module InlineAnchor def is_refid?(x) @refids.include? x end def inline_anchor(node) case node.type when :xref inline_anchor_xref node when :link inline_anchor_link node when :bibref inline_anchor_bibref node else warning(node, "unknown anchor type", node.type.inspect) end end def inline_anchor_xref(node) f = "inline" c = node.text matched = /^fn(: (?<text>.*))?$/.match node.text unless matched.nil? f = "footnote" c = matched[:text] end t = node.target.gsub(/^#/, "").gsub(%r{(.)(\.xml)?#.*$}, "\\1") noko { |xml| xml.xref c, **attr_code(target: t, type: f) }.join end def inline_anchor_link(node) contents = node.text contents = nil if node.target.gsub(%r{^mailto:}, "") == node.text attributes = { "target": node.target } noko do |xml| xml.link contents, **attr_code(attributes) end.join end def inline_anchor_bibref(node) eref_contents = node.target == node.text ? nil : node.text eref_attributes = { id: node.target } @refids << node.target noko do |xml| xml.ref eref_contents, **attr_code(eref_attributes) end.join end def inline_callout(node) noko do |xml| xml.callout node.text end.join end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
asciidoctor-iso-0.6.0 | lib/asciidoctor/iso/inline_anchor.rb |