class Metanorma::Standoc::RelatedTermInlineMacro
Possibilities: related:relation[<<id>>, term] related:relation[<<termbase:id>>, term] related:relation equivalent to a crossreference to term:
Public Instance Methods
preprocess_attrs(target)
click to toggle source
# File lib/metanorma/standoc/macros_terms.rb, line 174 def preprocess_attrs(target) m = /^(?<id><<.+?>>, ?)?(?<rest>.*)$/.match(target) { id: m[:id]&.sub(/^<</, "")&.sub(/>>, ?$/, ""), term: m[:rest] } end
process(parent, target, attrs)
click to toggle source
# File lib/metanorma/standoc/macros_terms.rb, line 180 def process(parent, target, attrs) out = preprocess_attrs(attrs["text"]) term = Asciidoctor::Inline.new(parent, :quoted, out[:term]).convert if out[:id] then "<related type='#{target}' key='#{out[:id]}'>"\ "<refterm>#{term}</refterm></related>" else "<related type='#{target}'><termxref>#{term}</termxref>"\ "<xrefrender>#{term}</xrefrender></related>" end rescue StandardError => e raise("processing related:#{target}[#{attrs['text']}]: #{e.message}") end