Method: Metanorma::Standoc::Utils#asciimath_key

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

#asciimath_key(sym) ⇒ Object



146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/metanorma/standoc/utils.rb', line 146

def asciimath_key(sym)
  key = sym.dup
  key.traverse do |n|
    if n.name == "stem" && a = n.at(".//asciimath")
      n.children = @c.encode(
        @c.decode(grkletters(a.text)), :basic
      )
    end
  end
  key.xpath(".//asciimath").each(&:remove)
  Nokogiri::XML(key.to_xml)
end