diff --git a/rnc/mathml4-core.rnc b/rnc/mathml4-core.rnc index 253deb3..5926024 100644 --- a/rnc/mathml4-core.rnc +++ b/rnc/mathml4-core.rnc @@ -12,7 +12,7 @@ namespace h = "http://www.w3.org/1999/xhtml" start |= math -math = element math {math.attributes,MathExpression*} +math = element math {math.attributes,ImpliedMrow} MathMLoneventAttributes = attribute onabort {text}?, @@ -179,7 +179,9 @@ MathExpression = TokenExpression| mmultiscripts|mtable|maction| semantics -ImpliedMrow = MathExpression* +MathMalignExpression = MathExpression + +ImpliedMrow = MathMalignExpression* TableRowExpression = mtr @@ -244,7 +246,7 @@ mprescripts = element mprescripts {mprescripts.attributes,empty} mprescripts.attributes = MathMLPGlobalAttributes -mrow = element mrow {mrow.attributes, MathExpression*} +mrow = element mrow {mrow.attributes, ImpliedMrow} mrow.attributes = MathMLPGlobalAttributes @@ -337,7 +339,7 @@ mtd.attributes = attribute columnspan {xsd:positiveInteger}? -maction = element maction {maction.attributes, MathExpression+} +maction = element maction {maction.attributes, ImpliedMrow} maction.attributes = MathMLPGlobalAttributes, attribute actiontype {text}?, diff --git a/rnc/mathml4-legacy.rnc b/rnc/mathml4-legacy.rnc index c2aa767..ae95edf 100644 --- a/rnc/mathml4-legacy.rnc +++ b/rnc/mathml4-legacy.rnc @@ -81,3 +81,33 @@ mspace.attributes &= DeprecatedTokenAtt ms.attributes &= DeprecatedTokenAtt semantics.attributes &= DefEncAtt + + +# malignmark in tokens +token.content |= malignmark +# malignmark in mfrac etc +MathExpression |= MalignExpression + +maligngroup.attributes |= + attribute groupalign {"left" | "center" | "right" | "decimalpoint"}? + +malignmark.attributes |= + attribute edge {"left" | "right"}? + +# groupalign +group-alignment = "left" | "center" | "right" | "decimalpoint" +group-alignment-list = list {group-alignment+} +group-alignment-list-list = xsd:string { + pattern = '(\s*\{\s*(left|center|right|decimalpoint)(\s+(left|center|right|decimalpoint))*\})*\s*' } + +mstyle.generalattributes &= + attribute groupalign {group-alignment-list-list}? + +mtable.attributes &= + attribute groupalign {group-alignment-list-list}? + +mtr.attributes &= + attribute groupalign {group-alignment-list-list}? + +mtd.attributes &= + attribute groupalign {group-alignment-list}? diff --git a/rnc/mathml4-presentation.rnc b/rnc/mathml4-presentation.rnc index 8c9bef5..7465abe 100644 --- a/rnc/mathml4-presentation.rnc +++ b/rnc/mathml4-presentation.rnc @@ -34,14 +34,16 @@ MathMLPGlobalAttributes &= attribute href {xsd:anyURI}?, attribute other {text}? +MathMalignExpression |= MalignExpression + MathExpression |= PresentationExpression TableRowExpression |= mlabeledtr -MstackExpression = MathExpression|mscarries|msline|msrow|msgroup +MstackExpression = MathMalignExpression|mscarries|msline|msrow|msgroup -MsrowExpression = MathExpression|none +MsrowExpression = MathMalignExpression|none linestyle = "none" | "solid" | "dashed" @@ -81,14 +83,10 @@ character = xsd:string { pattern = '\s*\S\s*'} -group-alignment = "left" | "center" | "right" | "decimalpoint" -group-alignment-list = list {group-alignment+} -group-alignment-list-list = xsd:string { - pattern = '(\s*\{\s*(left|center|right|decimalpoint)(\s+(left|center|right|decimalpoint))*\})*\s*' } positive-integer = xsd:positiveInteger -token.content |= mglyph|malignmark|text +token.content |= mglyph|text @@ -142,23 +140,17 @@ msline.attributes = attribute rightoverhang {length-percentage}?, attribute mslinethickness {length-percentage | "thin" | "medium" | "thick"}? - - MalignExpression = maligngroup|malignmark malignmark = element malignmark {malignmark.attributes, empty} -malignmark.attributes = - MathMLPGlobalAttributes, - attribute edge {"left" | "right"}? +malignmark.attributes = MathMLPGlobalAttributes maligngroup = element maligngroup {maligngroup.attributes, empty} -maligngroup.attributes = - MathMLPGlobalAttributes, - attribute groupalign {"left" | "center" | "right" | "decimalpoint"}? +maligngroup.attributes = MathMLPGlobalAttributes + - -PresentationExpression = TokenExpression|MalignExpression| +PresentationExpression = TokenExpression| mrow|mfrac|msqrt|mroot|mstyle|merror|mpadded|mphantom| mfenced|menclose|msub|msup|msubsup|munder|mover|munderover| mmultiscripts|mtable|mstack|mlongdiv|maction @@ -179,8 +171,8 @@ mstyle.attributes &= mstyle.generalattributes mstyle.specificattributes = - attribute scriptlevel {integer}?, - attribute displaystyle {"true" | "false"}?, + attribute Xscriptlevel {integer}?, + attribute Xdisplaystyle {"true" | "false"}?, attribute scriptsizemultiplier {number}?, attribute scriptminsize {length-percentage}?, attribute infixlinebreakstyle {"before" | "after" | "duplicate"}?, @@ -211,7 +203,6 @@ mstyle.generalattributes = attribute form {"prefix" | "infix" | "postfix"}?, attribute frame {linestyle}?, attribute framespacing {list {length-percentage, length-percentage}}?, - attribute groupalign {group-alignment-list-list}?, attribute height {length-percentage}?, attribute indentalign {"left" | "center" | "right" | "auto" | "id"}?, attribute indentalignfirst {"left" | "center" | "right" | "auto" | "id" | "indentalign"}?, @@ -267,7 +258,7 @@ math.attributes &= mstyle.specificattributes math.attributes &= mstyle.generalattributes math.attributes &= attribute overflow {"linebreak" | "scroll" | "elide" | "truncate" | "scale"}? -mfenced = element mfenced {mfenced.attributes, MathExpression*} +mfenced = element mfenced {mfenced.attributes, ImpliedMrow} mfenced.attributes = MathMLPGlobalAttributes, attribute open {text}?, @@ -306,7 +297,6 @@ mtable.attributes &= pattern ='\s*(top|bottom|center|baseline|axis)(\s+-?[0-9]+)?\s*'}}?, attribute rowalign {list {verticalalign+} }?, attribute columnalign {list {columnalignstyle+} }?, - attribute groupalign {group-alignment-list-list}?, attribute alignmentscope {list {("true" | "false") +}}?, attribute columnwidth {list {("auto" | length-percentage | "fit") +}}?, attribute width {"auto" | length-percentage}?, @@ -332,15 +322,12 @@ mlabeledtr.attributes = mtr.attributes &= attribute rowalign {"top" | "bottom" | "center" | "baseline" | "axis"}?, - attribute columnalign {list {columnalignstyle+} }?, - attribute groupalign {group-alignment-list-list}? - + attribute columnalign {list {columnalignstyle+} }? mtd.attributes &= attribute rowalign {"top" | "bottom" | "center" | "baseline" | "axis"}?, - attribute columnalign {columnalignstyle}?, - attribute groupalign {group-alignment-list}? + attribute columnalign {columnalignstyle}? mstack = element mstack {mstack.attributes, MstackExpression*} diff --git a/rng/mathml4-content.rng b/rng/mathml4-content.rng index 33e7326..97f20d2 100644 --- a/rng/mathml4-content.rng +++ b/rng/mathml4-content.rng @@ -133,10 +133,31 @@ - + + + + + + + + + + + + + + + + + + + + + + @@ -1244,10 +1265,10 @@ - - + + @@ -1260,29 +1281,29 @@ - - + + - - + + - - + + - - + + diff --git a/rng/mathml4-core.rng b/rng/mathml4-core.rng index 1659f4e..266d108 100644 --- a/rng/mathml4-core.rng +++ b/rng/mathml4-core.rng @@ -17,12 +17,10 @@ - - - + - + @@ -285,7 +283,38 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -293,7 +322,7 @@ - + @@ -301,14 +330,6 @@ - - - - - - - - @@ -319,10 +340,7 @@ - - - transparent - + @@ -352,9 +370,6 @@ - - - @@ -363,10 +378,16 @@ - + + + + + + + - + @@ -375,10 +396,14 @@ + + + + - + @@ -413,7 +438,7 @@ - + @@ -427,7 +452,7 @@ - + @@ -437,6 +462,9 @@ + + + \s*([Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee])\s* @@ -444,7 +472,7 @@ - \s*((-?[0-9]*([0-9]\.?|\.[0-9])[0-9]*(e[mx]|in|cm|mm|p[xtc]|%))|0)\s* + \s*((-?[0-9]*([0-9]\.?|\.[0-9])[0-9]*(r?em|ex|in|cm|mm|p[xtc]|Q|v[hw]|vmin|vmax|%))|0)\s* @@ -470,9 +498,12 @@ + + + - + @@ -529,7 +560,7 @@ - + @@ -538,7 +569,7 @@ - + @@ -547,7 +578,7 @@ - + @@ -589,7 +620,7 @@ - + @@ -608,9 +639,6 @@ - - - @@ -618,7 +646,7 @@ - + @@ -627,7 +655,7 @@ - + @@ -651,7 +679,7 @@ - + @@ -660,7 +688,7 @@ - + @@ -669,18 +697,16 @@ - + - - - + - + @@ -690,7 +716,7 @@ - + @@ -704,7 +730,7 @@ - + @@ -714,7 +740,7 @@ - + @@ -723,7 +749,7 @@ - + @@ -732,7 +758,7 @@ - + @@ -741,7 +767,7 @@ - + @@ -762,6 +788,11 @@ + + + + + @@ -778,7 +809,7 @@ - + @@ -788,7 +819,7 @@ - + @@ -798,7 +829,7 @@ - + @@ -809,7 +840,7 @@ - + @@ -819,7 +850,7 @@ - + @@ -834,7 +865,7 @@ - + @@ -850,7 +881,7 @@ - + @@ -889,7 +920,7 @@ - + @@ -900,7 +931,7 @@ - + @@ -909,7 +940,7 @@ - + @@ -924,13 +955,11 @@ - - - + - + diff --git a/rng/mathml4-legacy.rng b/rng/mathml4-legacy.rng index 7b6ebfe..bcb5956 100644 --- a/rng/mathml4-legacy.rng +++ b/rng/mathml4-legacy.rng @@ -207,9 +207,15 @@ + + + + + - - transparent + small + normal + big @@ -238,4 +244,86 @@ + + + + + + + + + + + + + + + + left + center + right + decimalpoint + + + + + + + + + left + right + + + + + + + + left + center + right + decimalpoint + + + + + + + + + + + + (\s*\{\s*(left|center|right|decimalpoint)(\s+(left|center|right|decimalpoint))*\})*\s* + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rng/mathml4-presentation.rng b/rng/mathml4-presentation.rng index 56dc540..620ff01 100644 --- a/rng/mathml4-presentation.rng +++ b/rng/mathml4-presentation.rng @@ -16,17 +16,12 @@ - \s*((-?[0-9]*([0-9]\.?|\.[0-9])[0-9]*(e[mx]|in|cm|mm|p[xtc]|%))|0|(negative)?((very){0,2}thi(n|ck)|medium)mathspace)\s* + \s*((-?[0-9]*([0-9]\.?|\.[0-9])[0-9]*(r?em|ex|in|cm|mm|p[xtc]|Q|v[hw]|vmin|vmax|%))|0|(negative)?((very){0,2}thi(n|ck)|medium)mathspace)\s* - \s*([\+\-]?[0-9]*([0-9]\.?|\.[0-9])[0-9]*\s*((%?\s*(height|depth|width)?)|e[mx]|in|cm|mm|p[xtc]|((negative)?((very){0,2}thi(n|ck)|medium)mathspace))?)\s* - - - - - \s*((-?[0-9]*([0-9]\.?|\.[0-9])[0-9]*(e[mx]|in|cm|mm|p[xtc]|%))|0|(negative)?((very){0,2}thi(n|ck)|medium)mathspace|infinity)\s* + \s*([\+\-]?[0-9]*([0-9]\.?|\.[0-9])[0-9]*\s*((%?\s*(height|depth|width)?)|r?em|ex|in|cm|mm|p[xtc]|Q|v[hw]|vmin|vmax|%|((negative)?((very){0,2}thi(n|ck)|medium)mathspace))?)\s* @@ -41,7 +36,7 @@ - + @@ -57,6 +52,9 @@ + + + @@ -65,7 +63,7 @@ - + @@ -74,7 +72,7 @@ - + @@ -137,33 +135,12 @@ \s*\S\s* - - - left - center - right - decimalpoint - - - - - - - - - - - - (\s*\{\s*(left|center|right|decimalpoint)(\s+(left|center|right|decimalpoint))*\})*\s* - - - @@ -359,7 +336,7 @@ - + @@ -391,7 +368,7 @@ - + @@ -436,15 +413,7 @@ - - - - - left - right - - - + @@ -453,22 +422,11 @@ - - - - - left - center - right - decimalpoint - - - + - @@ -526,12 +484,12 @@ - + - + true false @@ -767,11 +725,6 @@ - - - - - @@ -967,14 +920,6 @@ - - - - - infinity - - - @@ -1168,13 +1113,11 @@ - - - + - + @@ -1192,7 +1135,7 @@ - + @@ -1282,11 +1225,6 @@ - - - - - @@ -1441,11 +1379,6 @@ - - - - - @@ -1464,11 +1397,6 @@ - - - - - @@ -1479,7 +1407,7 @@ - + @@ -1555,7 +1483,7 @@ - + @@ -1576,7 +1504,7 @@ - + @@ -1595,7 +1523,7 @@ - + @@ -1645,7 +1573,7 @@ - + diff --git a/rng/mathml4.rng b/rng/mathml4.rng index 11b3ddc..c484a17 100644 --- a/rng/mathml4.rng +++ b/rng/mathml4.rng @@ -1,18 +1,37 @@ - - - + + + - + + + + + + + + + + + + + + + + + + + + diff --git a/test/test-core-10.xml b/test/test-core-10.xml new file mode 100644 index 0000000..54b6925 --- /dev/null +++ b/test/test-core-10.xml @@ -0,0 +1,3 @@ + +1x + diff --git a/test/test-full-10.xml b/test/test-full-10.xml new file mode 100644 index 0000000..9b94359 --- /dev/null +++ b/test/test-full-10.xml @@ -0,0 +1,10 @@ + + + + + x + x + + + + diff --git a/test/test-legacy-09.xml b/test/test-legacy-09.xml new file mode 100644 index 0000000..f3b9c3b --- /dev/null +++ b/test/test-legacy-09.xml @@ -0,0 +1,21 @@ + + + 1 + + 1 + + + + + + 1 + 1 + + + + + + + + + diff --git a/test/test-presentation-06.xml b/test/test-presentation-06.xml index 74d7207..4f6c52b 100644 --- a/test/test-presentation-06.xml +++ b/test/test-presentation-06.xml @@ -42,8 +42,6 @@ - - diff --git a/test/test-presentation-08.xml b/test/test-presentation-08.xml index c13f3e4..7f5f51a 100644 --- a/test/test-presentation-08.xml +++ b/test/test-presentation-08.xml @@ -1,3 +1,3 @@ - + diff --git a/test/test-presentation-15.xml b/test/test-presentation-15.xml new file mode 100644 index 0000000..1caf050 --- /dev/null +++ b/test/test-presentation-15.xml @@ -0,0 +1,14 @@ + + + 1 + + 1 + + + + + 1 + + + +