git.iko.soy/typeable/pandoc
on master help sign in
Fix DocBook reader mathml regression...
56ce1fcJohn MacFarlane
src/Text/Pandoc/Readers/DocBook.hs+2−1
@@ -1239,7 +1239,8 @@ equation e constructor =
1239 where
1239 where
1240 mathMLEquations :: [Text]
1240 mathMLEquations :: [Text]
1241 mathMLEquations = map writeTeX $ rights $ readMath
1241 mathMLEquations = map writeTeX $ rights $ readMath
1242− (\x -> qName (elName x) == "math" && qPrefix (elName x) == Just "mml")
1242+ (\x -> qName (elName x) == "math" &&
1243+ qURI (elName x) == Just "http://www.w3.org/1998/Math/MathML")
1243 (readMathML . showElement)
1244 (readMathML . showElement)
1244
1245
1245 latexEquations :: [Text]
1246 latexEquations :: [Text]
src/Text/Pandoc/Readers/JATS.hs+5−3
@@ -491,7 +491,8 @@ parseInline (Elem e) =
491
491
492 "disp-formula" -> formula displayMath
492 "disp-formula" -> formula displayMath
493 "inline-formula" -> formula math
493 "inline-formula" -> formula math
494+ "math" | qURI (elName e) == Just "http://www.w3.org/1998/Math/MathML"
494− "math" | qPrefix (elName e) == Just "mml" -> return . math $ mathML e
495+ -> return . math $ mathML e
495 "tex-math" -> return . math $ textContent e
496 "tex-math" -> return . math $ textContent e
496
497
497 "email" -> return $ link ("mailto:" <> textContent e) ""
498 "email" -> return $ link ("mailto:" <> textContent e) ""
@@ -514,8 +515,9 @@ parseInline (Elem e) =
514 filterChildren isMathML whereToLook
515 filterChildren isMathML whereToLook
515 return . mconcat . take 1 . map constructor $ texMaths ++ mathMLs
516 return . mconcat . take 1 . map constructor $ texMaths ++ mathMLs
516
517
517− isMathML x = qName (elName x) == "math" &&
518+ isMathML x = qName (elName x) == "math" &&
518− qPrefix (elName x) == Just "mml"
519+ qURI (elName x) ==
520+ Just "http://www.w3.org/1998/Math/MathML"
519 removePrefix elname = elname { qPrefix = Nothing }
521 removePrefix elname = elname { qPrefix = Nothing }
520 codeWithLang = do
522 codeWithLang = do
521 let classes' = case attrValue "language" e of
523 let classes' = case attrValue "language" e of
test/command/7173.mdnew file+137
@@ -0,0 +1,137 @@
1+```
2+% pandoc -f docbook -t latex
3+<?xml version="1.0" encoding="UTF-8"?>
4+<!DOCTYPE article PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
5+<?xml-model href="http://www.oxygenxml.com/docbook/xml/5.0/rng/dbmathml.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
6+<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
7+<article xmlns="http://docbook.org/ns/docbook"
8+ xmlns:xlink="http://www.w3.org/1999/xlink"
9+ version="5.1">
10+ <title>Untitled Document</title>
11+ <para>Word</para>
12+ <informalequation>
13+ <alt role='tex'>1+2</alt>
14+ <m:math xmlns:m="http://www.w3.org/1998/Math/MathML">
15+ <m:mrow>
16+ <m:mrow><m:mn>1</m:mn><m:mo>+</m:mo><m:mn>2</m:mn>
17+ </m:mrow>
18+ </m:mrow>
19+ </m:math>
20+ </informalequation>
21+</article>
22+^D
23+Word
24+
25+\[1 + 2\]
26+```
27+
28+```
29+% pandoc -f docbook -t latex
30+<?xml version="1.0" encoding="UTF-8"?>
31+<!DOCTYPE article PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
32+<?xml-model href="http://www.oxygenxml.com/docbook/xml/5.0/rng/dbmathml.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
33+<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
34+<article xmlns="http://docbook.org/ns/docbook"
35+ xmlns:xlink="http://www.w3.org/1999/xlink"
36+ version="5.1">
37+ <title>Untitled Document</title>
38+ <para>Word</para>
39+ <informalequation>
40+ <alt role='tex'>1+2</alt>
41+ <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML">
42+ <mml:mrow>
43+ <mml:mrow><mml:mn>1</mml:mn><mml:mo>+</mml:mo><mml:mn>2</mml:mn>
44+ </mml:mrow>
45+ </mml:mrow>
46+ </mml:math>
47+ </informalequation>
48+</article>
49+^D
50+Word
51+
52+\[1 + 2\]
53+```
54+
55+```
56+% pandoc -f docbook -t latex
57+<?xml version="1.0" encoding="UTF-8"?>
58+<!DOCTYPE article PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
59+<?xml-model href="http://www.oxygenxml.com/docbook/xml/5.0/rng/dbmathml.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
60+<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
61+<article xmlns="http://docbook.org/ns/docbook"
62+ xmlns:xlink="http://www.w3.org/1999/xlink"
63+ version="5.1">
64+ <title>Untitled Document</title>
65+ <para>Word</para>
66+ <informalequation>
67+ <alt role='tex'>1+2</alt>
68+ <math xmlns="http://www.w3.org/1998/Math/MathML">
69+ <mrow>
70+ <mrow><mn>1</mn><mo>+</mo><mn>2</mn>
71+ </mrow>
72+ </mrow>
73+ </math>
74+ </informalequation>
75+</article>
76+^D
77+Word
78+
79+\[1 + 2\]
80+```
81+
82+```
83+% pandoc -f docbook -t latex
84+<?xml version="1.0" encoding="UTF-8"?>
85+<!DOCTYPE article PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
86+<?xml-model href="http://www.oxygenxml.com/docbook/xml/5.0/rng/dbmathml.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
87+<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
88+<article xmlns="http://docbook.org/ns/docbook"
89+ xmlns:xlink="http://www.w3.org/1999/xlink"
90+ xmlns:m="http://www.w3.org/1998/Math/MathML"
91+ version="5.1">
92+ <title>Untitled Document</title>
93+ <para>Word</para>
94+ <informalequation>
95+ <alt role='tex'>1+2</alt>
96+ <m:math>
97+ <m:mrow>
98+ <m:mrow><m:mn>1</m:mn><m:mo>+</m:mo><m:mn>2</m:mn>
99+ </m:mrow>
100+ </m:mrow>
101+ </m:math>
102+ </informalequation>
103+</article>
104+^D
105+Word
106+
107+\[1 + 2\]
108+```
109+
110+```
111+% pandoc -f docbook -t latex
112+<?xml version="1.0" encoding="UTF-8"?>
113+<!DOCTYPE article PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
114+<?xml-model href="http://www.oxygenxml.com/docbook/xml/5.0/rng/dbmathml.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
115+<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
116+<article xmlns="http://docbook.org/ns/docbook"
117+ xmlns:xlink="http://www.w3.org/1999/xlink"
118+ xmlns:mml="http://www.w3.org/1998/Math/MathML"
119+ version="5.1">
120+ <title>Untitled Document</title>
121+ <para>Word</para>
122+ <informalequation>
123+ <alt role='tex'>1+2</alt>
124+ <mml:math>
125+ <mml:mrow>
126+ <mml:mrow><mml:mn>1</mml:mn><mml:mo>+</mml:mo><mml:mn>2</mml:mn>
127+ </mml:mrow>
128+ </mml:mrow>
129+ </mml:math>
130+ </informalequation>
131+</article>
132+^D
133+Word
134+
135+\[1 + 2\]
136+```
137+
test/docbook-reader.docbook+3−1
@@ -6,7 +6,9 @@
6<!ENTITY let "LET" >
6<!ENTITY let "LET" >
7<!ENTITY case "CASE" >
7<!ENTITY case "CASE" >
8]>
8]>
9−<article>
9+<article xmlns="http://docbook.org/ns/docbook"
10+ xmlns:xlink="http://www.w3.org/1999/xlink"
11+ xmlns:mml="http://www.w3.org/1998/Math/MathML">
10 <articleinfo>
12 <articleinfo>
11 <title>Pandoc Test Suite</title>
13 <title>Pandoc Test Suite</title>
12 <authorgroup>
14 <authorgroup>