From 9d2dcee918a8b5dadeab96e97c0a9ceadeb8713e Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Sat, 5 Dec 2020 01:19:01 +1100 Subject: [PATCH] do not override existing font style in MathML italicisation localisation: https://github.com/metanorma/bipm-si-brochure/issues/40 --- lib/asciidoctor/standoc/cleanup.rb | 2 +- spec/asciidoctor-standoc/cleanup_spec.rb | 30 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/lib/asciidoctor/standoc/cleanup.rb b/lib/asciidoctor/standoc/cleanup.rb index fd8827bd..539775b8 100644 --- a/lib/asciidoctor/standoc/cleanup.rb +++ b/lib/asciidoctor/standoc/cleanup.rb @@ -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 diff --git a/spec/asciidoctor-standoc/cleanup_spec.rb b/spec/asciidoctor-standoc/cleanup_spec.rb index 53af477a..eb0b8095 100644 --- a/spec/asciidoctor-standoc/cleanup_spec.rb +++ b/spec/asciidoctor-standoc/cleanup_spec.rb @@ -1927,6 +1927,11 @@ α + AB + + + Α + + ++++ INPUT @@ -1946,6 +1951,11 @@ α + AB + + + Α + + @@ -1968,6 +1978,11 @@ α + AB + + + Α + + @@ -1990,6 +2005,11 @@ α + AB + + + Α + + @@ -2012,6 +2032,11 @@ α + AB + + + Α + + @@ -2034,6 +2059,11 @@ α + AB + + + Α + +