Commit graph

38 commits

Author SHA1 Message Date
Stegmujo 372bf72acd Render MathML for mathchoice for mhchem
* defaults mathchoice to displaystyle
* adds several tests and introduces new Fun4 element for mathchoice in
  grammar

Bug: T340024
Change-Id: I37c8fd35303e3b8a00faad18a3a131a716c7bb47
2023-10-04 11:23:02 +00:00
Stegmujo 6514c9d24e
Implement mhchemParser in PHP
* mhchemParser v4.2.2 in Typescript was used as blueprint for this:
* https://github.com/mhchem/mhchemParser
* The mhchemParserPHP component tests can be run locally on a machine with PHP without MediaWiki-Environment with the MMLmhchemTestLocal.php
* For the tests it is probably only necessary to review the json files (Mhchemv4mml.json, Mhchemv4tex.json).
* src/TexVC/MHChem/MhchemParser.php contains the basic functionality, Patterns, StateMachines, Texify functions are located in dedicated classes
* added extracted mhchem commands which have intermediately have been introduced to the
  texVC(PHP) grammar

Change-Id: I8cc3d04937b93339e352adc95c85a8a178b8825f
Bug: T329620
2023-09-16 09:40:14 +02:00
Stegmujo 8c5a694656 Implement mhchemParser maintenance in PHP
Change-Id: I4c97d493a35b2ae536422c0121eec6a33c3ce7ec
2023-09-16 07:13:48 +00:00
Stegmujo be8725c1d2
Add New TexUtil-Reference which also has Chem
* Update maintanance script with Chem-Fallback
* delete obsolete MML Lookup (was from mathjax-full)
* TexUtil-Ref is created without chem fallback

Bug: T327388
Change-Id: Id603d66feccf3716828c2aac57acac7d23131ddf
2023-02-06 16:30:25 +01:00
Stegmujo 8d522c4022 New lookups for tests enabling reference MathML
* For the existing MMLGeneration...Tests, reference MathML has been generated
for mathoid and latexml within reference files in json.
* The creation of json files was done with JsonToMathML script
* The test-classes have been adapted a bit, so they can read the new reference files.
* MMLGenerationTexUtil test has export function for input
for maintenance-script for

Bug: T327388
Change-Id: I05a8c7bb5e37cf75faf09ec43e9ce2acc7bf2040
2023-01-27 20:52:10 +00:00
Stegmujo 5ea78bc306
Add script to export json with Mathoid/latexml-MML reference
Bug: T327388
Change-Id: I647f586b4710faccd6bab31be7bab5e6fa1056d4
2023-01-27 21:51:18 +01:00
jenkins-bot 347dcbd3fe Merge "Fix significant typo in grammar" 2023-01-03 16:02:27 +00:00
Moritz Schubotz (physikerwelt) 0aecf2ab10
Expand texvcjs comparison test
* Currently the regression test only tests if all formulae that passed the test before still pass the test

* This change also compares the output

Change-Id: Ib667de2e7e512cf7d045e28a19c6a5f7d994dfc6
2022-12-30 19:53:31 +01:00
Moritz Schubotz (physikerwelt) 81fa5b0c97
Fix significant typo in grammar
* Uq and Dq was mixed
* Simplify regeneration of grammar for node developers
* Speed up npm test by ignoring local test json files

Change-Id: Iec273dcc967be46d3df52260fc56f1969667e497
2022-12-30 16:58:39 +01:00
Moritz Schubotz (physikerwelt) 52442e0ef1
Add commandline script for texvc
Change-Id: If817216fc804a14ce1f2f8dea5b15adde722a39e
2022-12-28 14:22:29 +01:00
Moritz Schubotz (physikerwelt) cbd67195f5
Update positive regression tests
Adapt test running structure to the new structure for good tests
coming from texvcjs.

Change-Id: I330bb3f8f0c6f379d624986827f96946af1d4c12
2022-12-06 10:59:39 +01:00
Stegmujo d2bd2f4554
Add Tests and Downloader for Chem Input Types
Bug: T321262

Change-Id: I4e0af8ab0eaa02829dffb7ff5fccc4564ed5c1ba
2022-10-25 16:55:58 +02:00
Stegmujo caf3a1e26b
Add All Wikipedia Tests and Fixes
These tests are skipped in CI, but are ran locally.
Contains also preliminary fixes to make the assertions not crash
locally and a shellscript for downloading the json-file with tests locally.

Bug: T315223

Change-Id: If5da7e2a29d9179eabecbb4707ed244f5d445d39
2022-10-25 15:32:53 +02:00
Stegmujo d4b9edc87e Add Builder for creating Parser.php
This is the first commit in a series of commits that convert texvcjs to PHP (called TexVC-PHP).
Please refer to the Gerrit history of this commit, which includes early versions of a full TexVC-PHP grammar, tests, and related files.

Bug: T312528
Change-Id: Id96a4b1b55e3959aab81f4ba436c5ac125f2a1bb
2022-10-18 13:39:10 +00:00
Umherirrender 44f7c7821a schema: Move all sql files to sql folder
It is good practice to have a folder in the root for all sql files.
Also use the engine folder to store the patches

Change-Id: Ic26c042f0a5a8ca6e0568b38c4b4b2b4f0686efb
2022-06-22 18:11:51 +00:00
Moritz Schubotz (physikerwelt) 2e0276c7f9 Remove mathoids coverage test
Before the HTTP tests were blocked T265628, the Math extension did
test all examples from w:Help:TeX and additional regression test
against the configured mathoid/restbase instance. Effectively, those
tests did only verify the hashes returned from mathoid/restbase.
We now drop this kind of integration test.

Bug: T265646

Change-Id: Iffe5105457297fdc2222af9f11ff56e78c479f32
2021-02-02 19:16:21 +00:00
Moritz Schubotz (physikerwelt) 50a8fe1079 Convert Math to abstract schema
Bug: T268561
Change-Id: I0c7c1fec8cc4d2b7eb6e14db03b1b753ba95193b
2021-01-30 19:28:21 +01:00
DannyS712 4868d632c1 MathGenerateTests: Remove use of $wgUser
Being written to, but not read from, so shouldn't be
needed anymore - set the User of the main RequestContext
instead.

Bug: T248550
Change-Id: I32d50e7bcd81ed77646d625e1a10b0e91e5d6c21
2020-12-09 01:03:32 +00:00
Reedy 2c220ddabc Fix PSR12.Properties.ConstantVisibility.NotFound
Bug: T253169
Change-Id: I816b6d26471527137cbddd313cd432f0a37db891
2020-06-05 00:17:18 +00:00
Thiemo Kreuz a429c8cc35 Fix escaping issues and a series of unrelated code cleanups
Actual changes:
* Let the special page accept the subpage parameter, e.g.
  [[Special:MathWikibase/Q6203]].
* Fix some of the message escaping issues in SpecialMathWikibase.
  Messages that are just plain text and not supposed to contain any
  parameters, wikitext, HTML, or something like this should be
  properly escaped, either via Html::rawElement( $msg->escaped() ) or
  better Html::element( $msg->plain ). The later approach is cheaper.

Other code cleanups that don't affect production:
* Reduce the amount of duplicate code in SpecialMathWikibase.
* Make use of the preg_match() return value.
* Remove default parameters from parent::__construct() call.
* Remove some auto-generated comments.
* Remove some comments that don't add new information, but just repeat
  what the code already says.
* Make use of PHPUnit's assertCount().

We can split this patch into smaller patches, if you prefer. This
should especially be done if one of the changes is controversial, to
not block the other changes. Please tell me.

Change-Id: I8c20014435af3d2ac9c7381fe5fd00b9fe49b2c2
2020-03-21 14:53:15 +00:00
peter-ovchyn 90b26c0878 parser: Replace 'new Parser' in favour of using ParserFactory/MediaWikiServices
Bug: T244055
Change-Id: I4049f155d066b165f0d5ec634da54b0bfed89188
2020-02-18 12:55:14 +02:00
libraryupgrader 863794c1dd build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Change-Id: Id4f976b7ec94e1d2be0421725733804f24dec2c5
2019-12-29 17:56:56 +00:00
Umherirrender a72741e313 Use Maintenance::addDescription
It is better to use a setter function than setting a property

Change-Id: I1df2d03cfaede53867daf9db8e26af5931c77ef9
2019-08-19 19:59:17 +02:00
Umherirrender adddfee59f Fix title comparision in maintenance script
Change-Id: I1ddba0fd5fc5ee1c060732026b1699a44b6bf220
2019-05-27 21:20:36 +02:00
Thiemo Kreuz 5648b8e2c3 Make use of the …::class feature whenever possible
Note that a class is not resolved this was. …::class is not a function
call. It's more like a named string constant. Technically still a
string. The advantage is that IDEs and tools like linters can much easier
understand that these strings refer to a class, and list them in usage
reports, renames, and such.

Change-Id: I5225543dbb837685a1840837cb2772dd576cca38
2018-06-06 12:13:04 +02:00
Moritz Schubotz (physikerwelt) b5cf0e0b77
Serve png mode from mathoid
* Use the exactly same routines to deliver png images that are used in
  mathml mode.
* Change the output to use mathoids png image rather than the mathml
  and svg output.
* Locally tested on Firefox and Chrome: Depending on the mode either
  the SVG or the PNG path is used.

Bug: T74240
Change-Id: I4b1cac92eb9a02190f316faab6621940951603d5
2018-05-21 13:47:49 +02:00
Kunal Mehta fbd17b4fef build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.DuplicateReturn
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.Commenting.FunctionComment.WrongStyle
* MediaWiki.FunctionComment.Missing.Protected
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: I46c900a5652a6560d18be6cd67badc37ed7f8d97
2017-06-21 00:59:25 +00:00
IvanFon b4eb57f164 Updated maintenance scripts to use $this->requireExtension()
Added $this->requireExtension() in maintenance/MathGenerateTests.php

Bug: T152139

Change-Id: I79670c9102e1ea97390edc4c8408d269f3967547
2016-12-17 15:23:58 -05:00
physikerwelt 6699724d65 Convert all array() syntax to []
Per wikitech-l consensus: https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Change-Id: I1d2604e3f246ede58ff8245ba2b940f258d2d80c
2016-04-13 10:18:23 -04:00
paladox df8ad1c799 Add php code sniffer to composer
Add support for php code sniffer

Change-Id: I7dcdd88be4f1f8219f71ab770979284761e09bae
2015-09-23 10:46:14 +01:00
physikerwelt bc52c77d24 Use extension.json, empty PHP entry point
* Use string constants instead of integers
* Derive new names from old via conversion of constant
  naming convention to CamelCase.
* Replace old constant string e.g. 'MW_MATH_ABC_DEF'
  with new string 'abcDef'
* Replace old constant value with new string.
* Tests to demonstrates what is actually done.
* Rename constants

Bug: T106630
Bug: T106631
Bug: T87941
Change-Id: I6d1094ece79e912d9ddbef6681a25196c7a6e801
2015-07-30 22:01:20 +00:00
jenkins-bot 8477bdb059 Merge "Minor clean up, optimisations and documentation corrections" 2015-01-22 19:39:56 +00:00
Timo Tijhof 83da0338ec Minor clean up, optimisations and documentation corrections
* Handle-error-first approach for consistent function body
  termination at the root with the main intend, and less indention.

* __DIR__ instead of dirname( __FILE__ )

* Single quotes.

* Correct pickHost documentation: wgMathMathMLUrl is not an array,
  and is not used in this method, that's at a different level
  of abstraction (via the constructor).

* White spacing.

* require_once is not a function.

Change-Id: Id4bec8415893245e2569a39ab5406a0820238ae4
2015-01-22 10:56:16 -08:00
physikerwelt (Moritz Schubotz) b09107025b Improve Math test generation
* Use the wikitext parser and not regexp to extract math
  tags from the page.
* Extract the attributes from the math tags as well

In a follow up a pseudo attribute in the math tag could
be introduced to provide a bug description.

Change-Id: I0dec18d4e3f87e7b58b097b2a08c4897ceaf29ac
2015-01-19 21:38:58 +00:00
C. Scott Ananian 7914fbea61 MathCoverageTest: encode test file using JSON instead of PHP serialize.
This ensures that changes to the test inputs or outputs yield readable
diffs when reviewing.

Change-Id: I7b4ef8102ad7fbf7c289a27db60f304a140b93a5
2014-10-12 18:02:50 +00:00
C. Scott Ananian 5cc82325c2 Sanitize filesystem paths before emitting ParserTests.data.
Change-Id: Ic348aa040d3b0e64716a51f5681ef289842118f0
2014-07-24 17:55:02 -04:00
Moritz Schubotz (Physikerwelt) 3a36b25ee3 Fix: Allow <div /> as valid Math output
Some simple math tags such as the rendering result of
$\mathcal{ABC}$
are converted to an HTML-div tag by LaTeXML if inline-mode
is used. This change
* makes the $wgMathDefaultLaTeXMLSetting easier to read
* improves the XML validation of the LaTeXML output.

Change-Id: I807dbfa3a45930deec8eb5615133be9a39f3f101
2014-04-08 16:13:28 +00:00
physikerwelt 94b035b26a Coverage tests for the Math extension
* Include generated tests for a better test coverage
of the Math extension.
* Compiles texvc in testsuite (if required)
* Test generator now included
* Replaces the old parser tests
* Fixes whitspace issues

Bug: 61090
Change-Id: Iff7eeb5ee72137492c3f6659e4d4d106e5715586
2014-03-11 15:35:07 +00:00