Commit graph

198 commits

Author SHA1 Message Date
jenkins-bot e4ece5aa8c Merge "Add MathJax rendering option" 2024-06-06 15:13:38 +00:00
Moritz Schubotz (physikerwelt) f534146597
Implement hline support for matrix
In MathML outer table boarders are represented with the
notation attribute of an menclose element. The inner
boarders are represented by the rowlines attribute
of the mtable element. The rowline element accepts
a space seperated list of row boarders. In LaTeX
the bottom line is represented by a new matrix row
that only contains \hline.

This change discover \hline elements in matrix cells
and then determines if it is in the first or last line.
When it is in the last line, the line is removed to avoid
an empty <mtr /> in the output.

Bug: T366417
Change-Id: I196e0d14a183a63696363f9e3006cf65571dc56c
2024-06-03 19:15:43 +02:00
Moritz Schubotz (physikerwelt) 5fa3d6bfe5 Clean matrix arguments
Originally the parse tree was a binary tree, from that
time matrix element were put into that data structure.
This was partially undone, but not full which leads to some artifacts
in matrix cells.

One of the problem is that due to the binary parse
tree structure the postprocessing did not correctly
identfy \limits.

This change changes reduces nesting from matrix, and regards
matrix instances as two-dimensional TexArrays.

Bug: T362344
Change-Id: I66a31a09f204709a51d6b5c9ecefc083f7ee2d6d
2024-06-03 09:25:15 +00:00
jenkins-bot 024cdbb00f Merge "Make TexArray iterable" 2024-05-27 13:18:29 +00:00
Moritz Schubotz (physikerwelt) 9c13fd1ccd
Make TexArray iterable
TexArray is an array of tex nodes. To improve
readability and type hinting we make TexArray
iterable.

Change-Id: I5b9b2ca63400400bc399c08445ff911f8e20a0d1
2024-05-27 09:54:44 +02:00
Moritz Schubotz (physikerwelt) c0ac8ee0e7
Extend BaseParsing test coverage
Change-Id: I4e8ff663e1516bcdeb6133bb12391ad48b056367
2024-05-26 22:37:07 +02:00
Moritz Schubotz (physikerwelt) 277663b822 Add MathJax rendering option
When collecting user feedback regarding the native
rendering option on the German Wikipedia (T346795)
it became apparent that some power users aim for bigger
and bolder fonts and a more LaTeX-like layout.
MathML, however, aims to format math as an integral part
of the text with uniform fonts and spacing.

To match both user needs, this patch adds a new rendering
option that uses client-side MathJax (without a need for
restbase or mathoid).

* Adjust MathJax`s loader to be compatible with the mw loader
* Add new rendering mode
* Copy MathJax source to resource module as foreign repo

Bug: T354136
Change-Id: I1ecf9c77fefc3b0f717107d81979276023f6cb84
2024-05-24 03:30:05 +00:00
Moritz Schubotz (physikerwelt) a102a4ed52
Remove curly
To reduce the complexity of the parse tree we remove the curly
element which is used for grouping in TeX. Instead, we use
use an attribute which defines if the group is put into curly
brackets or not. The functionality of the curly element
is transferred to the TexArray which was the only possible
child of the curly element before. To ease the transition,
we add a special constructor to TexArray.

We could not measure any performance implications of this change.

Bug: T333973
Change-Id: Idcb58694022831113bdc437576bb9f48658fff2f
2024-04-09 11:36:34 +02:00
Moritz Schubotz (physikerwelt) 5f4cfc47bc Update test references
The LaTeXML reference variant seems to be generated
with a slightly different version than before

Bug: T354057
Change-Id: I3d51dc06664120a1c7f9a933d7328210b7c6817f
2024-04-08 17:14:44 +00:00
Moritz Schubotz (physikerwelt) 0f11a20d8f
Conditionally skip tests that depend on Wikibase
While investigating the dependency between
Math and Wikibase, it turned out there was
a hard dependency in the test code.

This change makes the availability of the Wikibase
Extension optional and conditionally skips tests.

Bug: T362027
Change-Id: I9401d7d4a3277b6923dcd81f411ac5a08f1242d2
2024-04-08 14:46:09 +02:00
Moritz Schubotz (physikerwelt) f3acb95ed4 Enable more tests
Change-Id: Ic260221963a83ddd9208f00e170609a5be537898
2024-04-06 11:20:03 +00:00
Moritz Schubotz (physikerwelt) 69e111c91f
Skip tests if testfiles are missing
Instead of failing tests, we skip tests if the reuqired files
are not there

Change-Id: If107bea4efb35d08597f6274ffee45f6e951bc38
2024-04-03 20:45:20 +02:00
Moritz Schubotz (physikerwelt) 8c4a60f08f Replace _s with -s in i18n math mode strings
Bug: T360176
Change-Id: Ibcadd60428d61afb34700455d4c2550f7e24cc43
2024-03-15 17:27:56 +00:00
Reedy 9ad81e9471 Fix casing of MediaWiki
Change-Id: Iaf9d68db0889620303ee01b9460dcfa9b9016c0f
2024-03-12 15:38:20 +00:00
Umherirrender 555ed8e29f build: Fix line indents
Change-Id: If3be1b7575a1570e425847f559821e7408e5ec24
2024-03-10 22:46:31 +01:00
Umherirrender 457b953dd0 build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Excluded Generic.WhiteSpace.ScopeIndent as
it impact many lines in switch/case syntax

Also disable BraceNotOnOwnLine due to T347440

Change-Id: Ia0c8072da9b7bff6a4010d3fb70cb0e576cdf98a
2024-03-10 22:16:48 +01:00
Umherirrender 0cefcd5d77 tests: Mock LoggerInterface to expect that a warning is thrown
Expecting E_ERROR and E_USER_ERROR is deprecated and will no longer be
possible in PHPUnit 10.

Bug: T342110
Change-Id: I713460ef62f1dbdf1332916965e833e7f9074e3c
2024-02-24 20:16:31 +01:00
Moritz Schubotz (physikerwelt) f5b83c720c
Pass font options in underOver
Following the same argument as for accents,
font options should also be passed in underOver
constructs.

* Pass options
* Add test
* In I6924d712db6852f99d7896b1f11cfbd22851d757
  curly learned to encapsulate its output in a
  mrow. Thus, the if-clause is no longer needed.

Bug: T352609
Change-Id: I6dd3303d9b5ef9ae32ad33c91a4cc1bbdad46109
2024-01-29 17:11:10 +01:00
Moritz Schubotz (physikerwelt) d270a9aa80
Pass font options in accents
Accents such as \widetilde did not pass
their font options to their child element.

* Pass options
* Add test
* In I6924d712db6852f99d7896b1f11cfbd22851d757
  curly learned to encapsulate its output in a
  mrow. Thus, the if-clause is no longer needed.

Bug: T352609
Change-Id: I81ecda09d017c73a4593ae36c630426229c7559f
2024-01-27 18:12:03 +01:00
Moritz Schubotz (physikerwelt) 57dbaeda39
Add over_operators group
instead of testing if an operator starts
with the letter \o we keep an explicit
dictonary of operators which should
be rendered using mover instead of
msub.

Bug: T352699
Change-Id: I916acf2f71d747a31a882fecfccac832436ea991
2024-01-24 16:49:29 +01:00
ni1313 fbe057dc55 Add test for \overarc
Manually add test for \overarc to TexUtil-Ref.json

Bug: T354057
Change-Id: I249c89f9f7a2f336268393f61d428fbc09ee82f2
2024-01-17 16:29:36 +00:00
jenkins-bot 3a2011c3b7 Merge "Fix missing argument passing in DQ and FQ" 2024-01-06 21:43:41 +00:00
jenkins-bot 6ca717d31d Merge "Improve operator recognition heuristic" 2024-01-06 21:24:06 +00:00
Umherirrender b97ef597e0 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I8fad94b215664fb77acf8cd8140232271d2c2837
2024-01-06 16:30:26 +01:00
Moritz Schubotz (physikerwelt) a512710cf0
Improve operator recognition heuristic
In TeX display math mode \sum_a^b is rendered as
munderover, however \alpha_a^b is redndered as
msubsup.

This changes improves the heuristics to differentiate
between munderover operators such as sum prod and
other macros such as alpha, beta ...

Bug: T352697
Change-Id: I5a993e379791edeb3623171265e5be2651ee1359
2024-01-03 00:17:47 +01:00
Moritz Schubotz (physikerwelt) d25acea9c7
Fix missing argument passing in DQ and FQ
When rendering subscripts font arguments such as upright
font were not passed to the child nodes.

This changes passes the parameters.

Bug: T353340
Change-Id: I487bb01afa0d64c809affc4b8a466337d71a1c76
2024-01-02 20:36:49 +01:00
Stegmujo 4b30c9701a Add Intent to WikiTexVC
* make intent annotations possible in TeX math items
* introduce a new command to annotate as well as node and translation
* Adds a parser expression grammar to validate intent attributes for
* it basically adds the previous, now abandoned changeset: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Math/+/949964

Bug: T327098

Change-Id: I21adfac4c3580e238f059721fdf0c1566cb4e857
2023-12-21 14:28:18 +00:00
Stegmujo c27bc62ee7
Add export function for RTED
* for evaluation
* formats to bracket format as used in RTED java application

Change-Id: Ia85b7fdac55a9acfbc48e266a189e733634752f9
2023-12-07 17:27:19 +01:00
Stegmujo 3d0dfe1e43
Fix mathcal in chrome
* map to unicode chars

Bug: T352536
Change-Id: Iab04043df5cc04484d348b0c896a50c94ef79c16
2023-12-01 21:08:31 +01:00
Stegmujo 001e11bd7a
Fix double-struck letters in chrome
* map to literals to corresponding unicode characters when a double-struck state is recognized

Bug: T352196
Change-Id: I9b9e1d87c10858789751cd14f23d2feea3b928dd
2023-12-01 15:16:41 +01:00
Stegmujo c8fe00bd59
Fix closing bracket size too big
* fixes a glitch that attributes are not merged in closing tags

Bug: T351907
Change-Id: I1cc52c7726b12e12aea6cb56849721ae14229245
2023-11-30 15:58:22 +01:00
Stegmujo 79a2bf7e9f
Activate all FullCoverage Tests
Bug: T327392
Change-Id: I3af0c3c3aec83b8e0666318bdacbc1b639f8cd99
2023-11-30 12:21:50 +01:00
Stegmujo 3f5ba225ed Fix issue with nolimits
* nolimits is now also translated

Bug: T351850
Change-Id: I57d4bb4db117be667a5104876bfbd84a72e6bc34
2023-11-30 09:21:10 +00:00
Stegmujo a82727f61f
Rename TexVC in PHP to WikiTexVC
Change-Id: Idd98205ea291640b01946374f15c807da7fc26e5
2023-11-24 16:41:30 +01:00
Stegmujo 9abb258422
Fix genFrac bracket sizes
* genFrac renderMML function with bracket can produce false stretching
  on Chrome
* fixed for the cases with brackets (dbinom, tbinom, binom)

Bug: T350735
Change-Id: I0939de86963fa9c226346ce15e7edf7fc4e83c68
2023-11-20 16:32:44 +01:00
Stegmujo a4c3a365af Make distinction of bracket sizes
* \bigl( \Bigl( \biggl( \Biggl(

Bug: T350738
Change-Id: I557e6ff78255d0de28df1d6f6b6e78b76f9d8388
2023-11-17 15:54:10 +00:00
Stegmujo 7b03a170db
Fix liminf and limsup spacing
* and injlim projlim spacing

Bug: T350491
Change-Id: I7e4491fbdd461a4583f5418ba1924c647bb2df94
2023-11-03 18:37:27 +01:00
Stegmujo ac1d7a9a7b
Fix calls to trim null
Bug: T348936
Change-Id: I6e3fca041fb81975b175977b9a18d69fbf58620b
2023-11-03 17:02:22 +01:00
jenkins-bot 606f4347d1 Merge "Append invisible apply character" 2023-10-31 19:22:01 +00:00
Stegmujo 2c81f052c7
Append invisible apply character
* to named functions and named operators
* You can consider using that invisible apply character (U+2061) after other function names with known arguments (such as \sin, \cos...). Some accessibility tools take advantage of it, I am told, but it may also be used to provide correct spacing from the MathML operator dictionary. In Chrome <mi>sin</mi><mi>a</mi> will show up with no added spacing as sina, which is not ideal.

* namedFct with any succeeding macros/characters have an apply function

Bug : T350021

Change-Id: I7ee5fdd580fb018bc108a32500c17914dd5dc05f
2023-10-31 16:33:15 +01:00
jenkins-bot 83835f19e7 Merge "Add a possibility for creating a test wikipage for chemical formulas" 2023-10-30 16:22:48 +00:00
jenkins-bot 9ba97826f4 Merge "Fix incorrect child count of some element" 2023-10-27 14:00:30 +00:00
Stegmujo 9e9ba0241a Fix incorrect child count of some element
- munder: if only one child munder is not added as wrapping mml tag
- msup: renders an empty mi if there is no content for the superscript

This prevents some warnings in firefox browser dev-console.

Bug: T349825
Change-Id: Ia5efc1f33e3368e71527153d56160eee4ba3a46d
2023-10-27 13:17:55 +00:00
jenkins-bot 413b21d3be Merge "Remove too many rows in smallmatrix" 2023-10-27 10:53:49 +00:00
Stegmujo a53a5d58c8
Remove too many rows in smallmatrix
* From Feedback: The {smallmatrix} example has its fences wrapped in too many mrows I think, so it renders without stretching them in both Firefox and Chrome. Ideally you should be able to emit the <mo>(</mo> followed directly by an <mtable>, and trailed by <mo>)</mo>, and only wrap those 3 into a parent <mrow>.
* removes mrows and adds OPEN / CLOSE attributes
* tests MMLFullcoverage 194 to ~196 which cover the bigXYZ macros look
  ok

Bug: T348971
Change-Id: Ie444e5bb3e3f87fac915d2692b69e976d721582e
2023-10-27 11:19:06 +02:00
Stegmujo 8112c65a5d
Remove mstyle around spacing elements
* From Feedback: There is a curious use of <mstyle> around spacing elements, as in <mstyle scriptlevel="0"><mspace width="-0.167em"></mspace></mstyle>. I am not sure that wrapper element is needed? The mspace ought to be successful standalone.
* this is in the 'bmod' case

Bug: T349822
Change-Id: I9229ad73891d5000679761d3d4b2028d4a51ddf1
2023-10-27 10:35:59 +02:00
jenkins-bot 30c156a0a8 Merge "Make dataProvider in EnWikiFormulaeTest static" 2023-10-22 13:24:30 +00:00
jenkins-bot 9706ed33ba Merge "Make dataProvider in PopupTest static" 2023-10-22 05:02:42 +00:00
Moritz Schubotz (physikerwelt) de2913d960
Make dataProvider in EnWikiFormulaeTest static
Bug: T337160
Change-Id: I71205d564a3063e834a3cd0fc0075a3a6b7a19d2
2023-10-22 06:59:38 +02:00
Moritz Schubotz (physikerwelt) 7965a91ae5 Make dataProvider in PopupTest static
Bug: T337160
Change-Id: I1c5384d319d9e34397ed4d94b4d9888d46722b91
2023-10-21 21:06:06 +00:00