Class: Metanorma::Standoc::LangVariantInlineMacro

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



90
91
92
93
94
95
96
97
98
# File 'lib/metanorma/standoc/macros_inline.rb', line 90

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