lib/metanorma/standoc/inline.rb in metanorma-standoc-2.9.0 vs lib/metanorma/standoc/inline.rb in metanorma-standoc-2.9.1
- old
+ new
@@ -41,24 +41,24 @@
def stem_parse(text, xml, style, block)
if /<([^:>&]+:)?math(\s+[^>&]+)?> |
<([^:>&]+:)?math(\s+[^>&]+)?>/x.match? text
math = xml_encode(text)
- xml.stem type: "MathML", block: block do |s|
+ xml.stem(type: "MathML", block:) do |s|
s << math
end
elsif style == :latexmath then latex_parse(text, xml, block)
else
- xml.stem text&.gsub("&#", "&#"), type: "AsciiMath", block: block
+ xml.stem text&.gsub("&#", "&#"), type: "AsciiMath", block:
end
end
def latex_parse(text, xml, block)
latex = latex_parse1(text, block) or
- return xml.stem type: "MathML", block: block
- xml.stem type: "MathML", block: block do |s|
+ return xml.stem(type: "MathML", block:)
+ xml.stem(type: "MathML", block:) do |s|
math = Nokogiri::XML.fragment(latex.sub(/<\?[^>]+>/, ""))
- .elements[0]
+ .elements[0]
math.delete("alttext")
s.parent.children = math
s << "<latexmath>#{text}</latexmath>"
end
end