Class: Asciidoctor::Standoc::IndexXrefInlineMacro
- Inherits:
-
Extensions::InlineMacroProcessor
- Object
- Extensions::InlineMacroProcessor
- Asciidoctor::Standoc::IndexXrefInlineMacro
- Defined in:
- lib/asciidoctor/standoc/macros.rb
Instance Method Summary collapse
Instance Method Details
#preprocess_attrs(attrs) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/asciidoctor/standoc/macros.rb', line 33 def preprocess_attrs(attrs) return unless attrs.size > 1 && attrs.size < 5 ret = { primary: attrs[1], target: attrs[attrs.size] } ret[:secondary] = attrs[2] if attrs.size > 2 ret[:tertiary] = attrs[3] if attrs.size > 3 ret end |
#process(_parent, target, attr) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/asciidoctor/standoc/macros.rb', line 42 def process(_parent, target, attr) args = preprocess_attrs(attr) or return ret = "<index-xref also='#{target == 'also'}'>"\ "<primary>#{args[:primary]}</primary>" ret += "<secondary>#{args[:secondary]}</secondary>" if args[:secondary] ret += "<tertiary>#{args[:tertiary]}</tertiary>" if args[:tertiary] ret + "<target>#{args[:target]}</target></index-xref>" end |