Class: Metanorma::Standoc::PassInlineMacro

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

Overview

inject ZWNJ to prevent Asciidoctor from attempting regex substitutions

Instance Method Summary collapse

Instance Method Details

#process(parent, target, attrs) ⇒ Object



118
119
120
121
122
123
# File 'lib/metanorma/standoc/macros_inline.rb', line 118

def process(parent, target, attrs)
  format = target || "metanorma"
  out = Asciidoctor::Inline.new(parent, :quoted, attrs[1]).convert
    .gsub(/((?![<>&])[[:punct:]])/, "\\1&#x200c;")
  %{<passthrough-inline formats="#{format}">#{out}</passthrough-inline>}
end