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



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

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