module Metanorma::Utils

def asciidoc_sub(text, flavour = :standoc)

def asciidoc_sub(text, flavour = :standoc)
  return nil if text.nil?
  return "" if text.empty?
  d = Asciidoctor::Document.new(
    text.lines.entries,
    { header_footer: false, backend: flavour },
  )
  b = d.parse.blocks.first
  b.apply_subs(b.source)
end