File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -639,9 +639,10 @@ impl CanonicalizeContext {
639639 }
640640 if matches ! ( element_name, "mtd" | "mtr" | "mlabeledtr" ) {
641641 let parent_name = name ( get_parent ( mathml) ) ;
642+ debug ! ( "assure_mathml: {} is a child of {}" , element_name, parent_name) ;
642643 if ( element_name == "mtr" || element_name == "mlabeledtr" ) && parent_name != "mtable" {
643644 bail ! ( "Illegal MathML: {} is not a child of mtable. Parent is {}" , element_name, mml_to_string( get_parent( mathml) ) ) ;
644- } else if element_name == "mtd" && ( parent_name != "mtr" || parent_name ! = "mlabeledtr" ) {
645+ } else if element_name == "mtd" && ! ( parent_name == "mtr" || parent_name = = "mlabeledtr" ) {
645646 bail ! ( "Illegal MathML: mtd is not a child of {}. Parent is {}" , parent_name, mml_to_string( get_parent( mathml) ) ) ;
646647 }
647648 }
@@ -4760,27 +4761,27 @@ mod canonicalize_tests {
47604761 use crate :: interface:: * ;
47614762 let test_str = "<math>
47624763 <mtable>
4763- <mtr>
4764- <mtd>
4765- <mtext></mtext>
4766- </mtd>
4767- <mtd>
4768- <mrow>
4769- <mi>E</mi>
4770- <mo>=</mo>
4771- <mrow>
4772- <mi>m</mi>
4773- <mo><!--INVISIBLE TIMES--></mo>
4774- <msup>
4775- <mi>c</mi>
4776- <mn>2</mn>
4777- </msup>
4764+ <mtr>
4765+ <mtd>
4766+ <mtext></mtext>
4767+ </mtd>
4768+ <mrow>
4769+ <mi>E</mi>
4770+ <mo>=</mo>
4771+ <mrow>
4772+ <mtd>
4773+ <mi>m</mi>
4774+ <mo><!--INVISIBLE TIMES--></mo>
4775+ <msup>
4776+ <mi>c</mi>
4777+ <mn>2</mn>
4778+ </msup>
4779+ </mtd></mrow>
47784780 </mrow>
4779- </mrow>
4780- </mtd>
4781- </mtr>
4781+
4782+ </mtr>
47824783 </mtable>
4783- </math>" ;
4784+ </math>" ;
47844785 let package1 = & parser:: parse ( test_str) . expect ( "Failed to parse test input" ) ;
47854786 let mathml = get_element ( package1) ;
47864787 trim_element ( mathml, false ) ;
You can’t perform that action at this time.
0 commit comments