Class: Metanorma::Standoc::VariantInlineMacro

Inherits:
Asciidoctor::Extensions::InlineMacroProcessor
  • Object
show all
Defined in:
lib/metanorma/standoc/macros_inline.rb

Instance Method Summary collapse

Instance Method Details

#process(parent, target, attrs) ⇒ Object



66
67
68
69
70
71
72
73
74
# File 'lib/metanorma/standoc/macros_inline.rb', line 66

def process(parent, target, attrs)
  /^(?<lang>[^-]*)(?:-(?<script>.*))?$/ =~ target
  out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
  if script
    %{<variant lang='#{lang}' script='#{script}'>#{out}</variant>}
  else
    %{<variant lang='#{lang}'>#{out}</variant>}
  end
end