class Metanorma::Standoc::IndexXrefInlineMacro

Public Instance Methods

preprocess_attrs(attrs) click to toggle source
# File lib/metanorma/standoc/macros.rb, line 34
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) click to toggle source
# File lib/metanorma/standoc/macros.rb, line 43
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