Skip to content

Commit

Permalink
do not override existing font style in MathML italicisation localisat…
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Dec 4, 2020
1 parent d65b72c commit 9d2dcee
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/asciidoctor/standoc/cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def mathml_mi_italics

# presuppose multichar mi upright, singlechar mi MathML default italic
def mathml_italicise(x)
x.xpath(".//m:mi", "m" => MATHML_NS).each do |i|
x.xpath(".//m:mi[not(ancestor::*[@mathvariant])]", "m" => MATHML_NS).each do |i|
char = HTMLEntities.new.decode(i.text)
i["mathvariant"] = "normal" if mi_italicise?(char)
end
Expand Down
30 changes: 30 additions & 0 deletions spec/asciidoctor-standoc/cleanup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,11 @@
<mi>α</mi>
<mo>+</mo>
<mi>AB</mi>
<mstyle mathvariant="italic">
<mrow>
<mi>Α</mi>
</mrow>
</mstyle>
</math>
++++
INPUT
Expand All @@ -1946,6 +1951,11 @@
<mi>α</mi>
<mo>+</mo>
<mi>AB</mi>
<mstyle mathvariant='italic'>
<mrow>
<mi>Α</mi>
</mrow>
</mstyle>
</math>
</stem>
</formula>
Expand All @@ -1968,6 +1978,11 @@
<mi>α</mi>
<mo>+</mo>
<mi>AB</mi>
<mstyle mathvariant='italic'>
<mrow>
<mi>Α</mi>
</mrow>
</mstyle>
</math>
</stem>
</formula>
Expand All @@ -1990,6 +2005,11 @@
<mi>α</mi>
<mo>+</mo>
<mi>AB</mi>
<mstyle mathvariant='italic'>
<mrow>
<mi>Α</mi>
</mrow>
</mstyle>
</math>
</stem>
</formula>
Expand All @@ -2012,6 +2032,11 @@
<mi mathvariant="normal">α</mi>
<mo>+</mo>
<mi>AB</mi>
<mstyle mathvariant='italic'>
<mrow>
<mi>Α</mi>
</mrow>
</mstyle>
</math>
</stem>
</formula>
Expand All @@ -2034,6 +2059,11 @@
<mi>α</mi>
<mo>+</mo>
<mi>AB</mi>
<mstyle mathvariant='italic'>
<mrow>
<mi>Α</mi>
</mrow>
</mstyle>
</math>
</stem>
</formula>
Expand Down

0 comments on commit 9d2dcee

Please sign in to comment.