mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-23 15:16:56 +00:00
Ignore length specifications after linebreaks
In LaTeX line breaks in matrix elements have an optional argument that controls the vertical spacing between the current and the next line. For example, {\begin{aligned}a\\[6pt] b\end{aligned}} generates a 6pt space. This was never implemented and ignored by mathoid. The native MathML implementation is unaware of the optional argument and just prints it to the next line. * This commit ignores the input on the grammar side. Bug: T375295 Change-Id: I08996129beca9ad852d23f28d7136c982707aea1
This commit is contained in:
parent
5489d8d693
commit
ff1536d1f9
File diff suppressed because it is too large
Load diff
|
@ -384,8 +384,33 @@ FUN_AR1opt
|
|||
NEXT_CELL
|
||||
= "&" _
|
||||
|
||||
LATEX_LENGTH
|
||||
= LATEX_SIGN? LATEX_NUMBER LATEX_UNIT
|
||||
|
||||
LATEX_SIGN
|
||||
= [+-]
|
||||
|
||||
LATEX_NUMBER
|
||||
= literal_mn+ "."? literal_mn*
|
||||
/ "." literal_mn+
|
||||
|
||||
LATEX_UNIT
|
||||
= "pt"
|
||||
/ "cm"
|
||||
/ "mm"
|
||||
/ "in"
|
||||
/ "em"
|
||||
/ "ex"
|
||||
/ "bp"
|
||||
/ "pc"
|
||||
/ "dd"
|
||||
/ "cc"
|
||||
/ "sp"
|
||||
/ "nd"
|
||||
/ "nc"
|
||||
|
||||
NEXT_ROW
|
||||
= "\\\\" _
|
||||
= "\\\\" ("[" LATEX_LENGTH "]")? _
|
||||
|
||||
BEGIN
|
||||
= "\\begin" _
|
||||
|
|
|
@ -124,6 +124,20 @@ class ApiTest extends MediaWikiUnitTestCase {
|
|||
'mhchem_required' => true,
|
||||
'status' => 'C'
|
||||
],
|
||||
[
|
||||
'in' => '{\\begin{aligned}a\\\\b\\end{aligned}}',
|
||||
'ams_required' => true,
|
||||
],
|
||||
[
|
||||
'in' => '{\\begin{aligned}a\\\\[6pt] b\\end{aligned}}',
|
||||
'output' => '{\\begin{aligned}a\\\\b\\end{aligned}}',
|
||||
'ams_required' => true,
|
||||
],
|
||||
[
|
||||
'in' => '{\\begin{aligned}a\\\\[-3.4mm] b\\end{aligned}}',
|
||||
'output' => '{\\begin{aligned}a\\\\b\\end{aligned}}',
|
||||
'ams_required' => true,
|
||||
],
|
||||
];
|
||||
foreach ( $testCases as $case ) {
|
||||
yield $case['in'] => [ $case ];
|
||||
|
|
Loading…
Reference in a new issue