Method: Metanorma::Standoc::Utils.adoc2xml

Defined in:
lib/metanorma/standoc/utils.rb

.adoc2xml(text, flavour) ⇒ Object

wrapped in <sections>



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/metanorma/standoc/utils.rb', line 129

def adoc2xml(text, flavour)
  Nokogiri::XML(text).root and return text
  f = @flush_caches ? ":flush-caches:\n" : ""
  doc = <<~ADOC
    = X
    A
    :semantic-metadata-headless: true
    :no-isobib:
    #{f}:novalid:
    :!sectids:

    #{text}
  ADOC
  c = Asciidoctor.convert(doc, backend: flavour, header_footer: true)
  Nokogiri::XML(c).at("//xmlns:sections")
end