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
30 31 32 33 34 35 36 |
# File 'lib/asciidoctor/standoc/macros.rb', line 30 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
38 39 40 41 42 43 44 |
# File 'lib/asciidoctor/standoc/macros.rb', line 38 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 |