Commit graph

85 commits

Author SHA1 Message Date
Umherirrender 13d43ec6be Rename files to match classes
Change-Id: Iecf3ea2d0e7ec3dc0f743a3d1a8d85463939d19d
2017-12-10 12:42:41 +01:00
Kunal Mehta df1689c717 build: Updating mediawiki/mediawiki-codesniffer to 0.11.0
Change-Id: I8ce8155621fbfc5cb3dcf5dafbfa89796d0c1f11
2017-08-10 23:57:43 -04:00
Umherirrender 2bbb86b868 Improve some parameter docs
Change-Id: If7d52d77935b7dd6cddd583b9a6215735fa8b91e
2017-08-09 22:56:19 +02:00
Umherirrender 2f8cdd225c build: Updating mediawiki/mediawiki-codesniffer to 0.10.1
Change-Id: I99cebc85671b3e8670729cb725a6026f233b639b
2017-07-26 22:43:39 +02:00
Thiemo Mättig bdeec56d1f Fix and add missing documentation and fix minor code smell issues
Change-Id: Ifa2f8a47fbd0bdd20334f59dd06a21339b9a4292
2017-07-10 11:40:12 +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
Gabriel Wicke c3432c7af4 Better error handling for math render errors
So far, rare render errors caused by blips in the network or the mathoid
service produce a big red warning in the page, and cause a tracking
category to be added. The rendered content along with the error message
is cached normally, which means that temporary errors are persisted
indefinitely.

As a consequence, editors need to periodically perform null edits to
remove temporary render errors from caches. T136812 documents a history
of this.

This patch aims to improve error handling through two changes:

1) Limit caching of rendered content to 10 minutes. As a consequence,
   temporary render errors should clear themselves up fairly quickly,
   eliminating the need for manual follow-up. The 10 minute timeout was
   chose as a compromise between relatively timely cleanup, and limited
   load from re-renders after math trouble.

2) Track render errors in a dedicated category. This avoids mixing
   syntax errors with temporary render errors, which should make cleanup
   efforts a lot simpler.

Bug: T136812
Change-Id: If7537ed9117fb736a09f4396b7d55d774ce9674f
2017-05-10 14:38:50 +02:00
Moritz Schubotz 63082595d9 Change chemistry tag name from ce to chem
<ce> will still work, but it's deprecated.

Bug: T153606
Change-Id: Idef1078b188f2b945c9e1f8f66096779cc37133f
2017-01-11 11:55:01 -08:00
Reedy b8d6ba165b Remove 'UnitTestList' hook
No longer needed now that extension unittests are autodiscovered.

Bug: T142120
Bug: T142121
Change-Id: I08e3fdf24481a0404c2bf9822d5d02b815cb2e76
2016-08-05 19:00:28 +00:00
Moritz Schubotz 14ec229cf9 Add tracking category for math errors
Bug: T134872
Change-Id: I6d0bce34aacfba27bedda23f6395001dae9c6568
2016-06-06 12:06:22 +00:00
Frédéric Wang be7be3becb Remove woff fonts
1) Because enabling native MathML now requires special configuration steps
  from the users, they can as well just check their math font setup. Hence we
  remove the Web font fallback.
2) We then can actually just remove ext.math.desktop.css since no specific
  style is necessary any more on desktop.
3) We also no longer need to add the Web font to the list of font-family on
  the <math> element. We actually just remove the whole font-family rule so
  that it is up to web engines developers & users to decide the best math font
  to use (e.g. via the "Fonts for mathematics" option in the font preference
  menu of Firefox).

Change-Id: I1818d288b0f28715a460e3163590e4d0374c42b4
2016-05-23 14:52:59 +00:00
physikerwelt 0d55341ff9 Fix: Convert all array() syntax to []
The signature of the Hook function is not respected.
Thus parameters need to be passed by reference explicitly.
For syntax validation to pass, this requires
mediawiki-codesniffer to 0.6.0

Change-Id: I90b6501000200c1b462407b769113358eb5c762f
2016-04-19 21:41:42 +00: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
physikerwelt 31cd0d611a Insert MathML content after tidy
* BeforeTidy caused problems when math tags were used
  within links.

Bug: T130508
Change-Id: Icb9b88a7552d14231f96cbfd2b3cf3fa7e29276d
2016-03-24 13:31:15 +00:00
physikerwelt 8113aa03c0 Prevent modification of math markup after output
In the early rendering phase the output of the math
extension should not be treated as wiki markup.

Bug: T129032
Change-Id: Idaabd835f04de6133824ce8db53e590af91b626c
2016-03-06 15:37:24 +00:00
physikerwelt 585114270d Improve backwards compatibility for $wgMathDisableTexFilter
* Only rewrite true to the new format

Change-Id: I94e92599b08766521ab529934915eecd550a453b
2016-03-01 15:47:54 +01:00
physikerwelt 0be6cdb08d Use TeX representation for the editsection title
Bug: T103269
Change-Id: I9ccb6653048e8d3c4574776690fab5574cb7030b
2016-02-29 14:54:39 +01:00
physikerwelt ac59fdcefc Only use parallel rendering in MathML mode
* It turned out that parallel rendering causes problems
 in the PNG rendering mode.
* This change disables parallel rendering for all
 modes but MahtML for now.

Bug: T127738
Change-Id: Ie0f7b391e89f53bac3490203e060c10c21d5e312
2016-02-23 21:39:56 +01:00
physikerwelt 9e605e09cd Render all math tags in parallel
Bug: T125543
Change-Id: Ia2febf2c0309e5de514445ad2aad58b7e5ce6837
2016-02-18 02:25:38 +00:00
physikerwelt 47f530b355 Support for chemical formulae
* Add support for LaTeX package mhchem.
* Add hook <ce>
* Add format <math chem>

See bug description for the details.

Bug: T98306
Change-Id: I2ab80834edc5d071618bc52f133cfb2b7ece5016
2016-02-07 18:55:58 +00:00
Marko Obrovac a3072e273b Logging: adjust the log entry levels
Most info-level log entries are actually debug messages, which should
not end up in the production log by default, so adjust them.

Only the Mathoid-powered TeX check fail has been promoted to info so
that we can quickly identify such requests from pages.

Bug: T121445
Change-Id: I3736c59f6425d675befea9438182ee1cdebe5fc5
2015-12-15 00:14:15 +01:00
Marko Obrovac c3ebc54994 Minor: rename checkTex() to checkTeX()
Change-Id: I9b1860562b2f4f2112b68c0c3d6f0390f0405fbe
2015-12-14 23:58:08 +01:00
physikerwelt 6ef2e56439 Add Restbase interface
* Add a simple interface to Restbase that currently
  does not do anything.

Change-Id: I4c2ef329b3954fd35276a5e270d0dc3fcacabf7b
2015-12-01 21:10:09 +00:00
Siebrand Mazeland 9a07f022f9 Update mediawiki-codesniffer and parallel-lint settings
Fix remaining sniffer warnings and errors

Change-Id: I2a2ab037793df771be2abc4a4433726469f60ab0
2015-09-29 02:19:04 +02: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 866854b7ca Support for LaTeXML line break feature
* LaTeXML has a feature to add automatic line breaks
* This change adds a new integration test
* Sets a default line length of 90
* add the additional display attribute 'linebreak' which
  can be used to enable the feature
* mathoid support for line breaks will follow shortly

Bug: T106423
Change-Id: I029328849f05ec2afcabf38d2b79b337cb54cbd5
2015-08-02 11:55:25 +00: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
physikerwelt 1157896149 Remove client-side MathJax support
Bug: T99369
Change-Id: I767dd2720386221891f25b5c692b766b4708be15
2015-07-16 00:46:29 +00:00
Kunal Mehta 241800f80d Use namespaced \MediaWiki\Logger\LoggerFactory
Change-Id: I78fca87d87379a694662c1a4ecc42e9401fd4c2c
2015-04-16 07:33:29 +00:00
Bryan Davis 23ff28d71d PSR-3 logging cleanup
* Limit levels to MediaWiki recommended debug, info, warning, error
* Don't add trailing newlines
* Capitalize messages

Change-Id: I211357b1cc014d6bed1717f22e2bf8ebfc4f386f
2015-03-18 12:13:05 -06:00
physikerwelt 5e46586ada Update to PSR-3 logging
Change-Id: I8b61cec606e75a3cf2143b1fa54e5dff2cfa3c7f
2015-03-18 17:26:01 +00:00
physikerwelt 6742dedda4 Code style cleanup
Cleanup whitespace and quoting, mostly related to logging function
usage.

Change-Id: I82ff6a31cd191119ec0c71c32eeb9570afd629db
2015-03-18 15:41:04 +00:00
physikerwelt (Moritz Schubotz) c8edf95e80 New hook MathFormulaPostRender (replaces MathFormulaRendered)
* Update hook to new extension registration mechanism
* Expose full parser context

Change-Id: I201f80bbee16617ef88417a2430261167aaca4ae
2015-03-17 21:44:47 +00:00
Chad Horohoe 0404113641 Remove obvious function-level profiling
Change-Id: I41d48da124e38c46ce71aa9d3b756096a424df1c
2015-02-12 12:14:24 -08: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) c240a5c477 Remove unused global
Change-Id: I8f5f77015de266f5a5b751fd7cfe424784eb3864
2015-01-13 20:15:52 +00:00
Ori Livneh d9b9b06032 MWException -> Exception
Change-Id: I18da1baeb70387b96e30811a049185a264dec26d
2015-01-09 17:55:54 -08:00
physikerwelt (Moritz Schubotz) d9522b6049 Increase size of the math_mathml in the mathlatexml table
The type text allows text with maximum length of 64k only. Since the
MathML generated by LaTeXML is quite verbose this is too small for
some equations used at Wikipedia.

Bug: 73090
Change-Id: Id09ec6201f68efe63a439f6e85a53876d5c1e521
2014-11-18 12:42:27 +01:00
Frédéric Wang e26d641b85 Make MathML mode work on mobile devices
- load ext.math.css on mobile devices
- move the @font-face rules for the Latin Modern WOFF fonts into a separate
  Desktop-only stylesheet.

Change-Id: Ifca3679185a4675bc31dff99a086fef740b9dab5
2014-10-20 22:40:53 +02:00
Gabriel Wicke c61b8becac Use radio buttons only for math mode selection
While the combination of all redering modes, might
be useful for some power users it will confuse the
average user and makes bug reporting harder.

Therefore, source rendering on the server side is
used when MathJax is enabled on the client side.

Change-Id: I05a20d7c2298115dbf0429db6c107e8132cc15ff
2014-10-13 09:42:37 +02:00
Frédéric Wang 296c79e070 Rename fallback-svg and fallback-png to fallback-image
- Merge fallback-svg and fallback-png into one fallback-image class.
- Move the vertical centering of PNG to MathTexvc and ext.math.js.
- Remove "img" from ext.math.css to reduce CSS specificity and make
  style easier to override by user stylesheets.
- Add a comment about the !important rules for centering in
  display mode.
- Only load ext.math.scripts in MathML mode.

Bug: 71955
Change-Id: If8ee1cf6453257a0a2f6aa186d4007954a8e5d8e
2014-10-12 13:42:01 +02:00
physikerwelt (Moritz Schubotz) ccc4114812 Fine grained options for wgMathDisableTeXFilter
Add new option to filter only new input.
Now the complete list of possible settings is:
MW_MATH_CHECK_ALWAYS  backwards compatible to false
MW_MATH_CHECK_NEVER   backwards compatible to true
MW_MATH_CHECK_NEW     new option

Change-Id: I455b41c8b8d918f4c34f6c115194d227a8394e0a
2014-10-10 18:27:04 +00:00
Frédéric Wang c3894c2c49 Display MathML when MathPlayer is installed
When MathPlayer is installed, we show the MathML instead of the SVG fallback.
This will in particular allow the sync highlighting feature of MathPlayer.
This also introduces a module ext.math.js that could be used to do some
Javascript postprocessing.

Bug: 71748
Change-Id: I438a20032c312d12321ca4c5686bcfd107656b37
2014-10-10 20:20:47 +02:00
physikerwelt (Moritz Schubotz) 68f9e96240 Add new MathHook
* Adds a new hook that is called after the rendering
  this is required to keep the MathIndex up to date
  for the MathSearch extension.
* The hook can be used for special modifications of
  the output format.

Change-Id: I7b45b4398c10ffe75f481a82c149ba4f66820338
2014-07-23 16:09:21 +00:00
physikerwelt 65642489ae Separate render and getHtml
Currently the method render always returns
a html string that can be a string that
represents the correct result or a rendered
error message.
This change splits rendering and
fetching of the HTML output.
This simplifies the logic of the rendering
and caching mechanism.
Now the render method returns a boolean that
indicates if the rendering was sucessful or
not.

Step 2/2

Warning: Errors in this change might affect
caching logic and squid caches.

Change-Id: I00502b84212ed70cdf63bd69916a35afbd6fdbc1
2014-06-09 23:21:44 +02:00
physikerwelt 4ca287b43a Improve MathML error handling
This change improves the error handling for MathML.

* Make MathHooks::getMathNames public
* Allow to use the same error messages for LaTeXML and Mathoid
* unify the string delimiter in error messages to "

Change-Id: I6568e6a3c98cb008f45f887d42e446daafe0ed3c
2014-06-04 07:38:48 +00:00
physikerwelt 3cbb5225e3 Add separate database tables for Mathoid
Add the tables needed for Mathoid.

Bug: 65793
Change-Id: Ia8dcb11234dffb7bce67f9ca0e7ebf1279fd7620
2014-05-27 06:53:50 +00:00
physikerwelt 972cee0f98 Add separate database table for LaTeXML (step 2)
Currently the PNG and the LaTeXML rendering mode
use a common table in the database. If both rendering
modes are allowed in a wiki simultaneously this causes
problems, because the fields are continuously overwritten.

This change creates the new database table defined in step 1.

Bug: 65522
Change-Id: I5f125d36b83776ca6f75ff014dc9095d0a737a35
2014-05-21 17:23:42 +00:00
physikerwelt ed570661de Improve mathtable
* Add primary key to mathtable
* Unify naming of database files

Bug: 65525
Change-Id: I4f4d31c281257014734e9e3a8d7f1506855ea6d9
2014-05-21 08:48:34 +00:00
physikerwelt bb9edf4f7a Catch misconfiguration of math default option
If the LocalSettings.php has invalid settings
for $wgDefaultUserOptions['math']
and $wgValidMathModes the user prefrences
pages displays an error. This commit
catches this error and selects the first
rendering option availible.

Bug: 64844
Change-Id: I1e3c468c0dc92378f7dc7b7d81fb4693e70f6b6f
2014-05-06 11:59:02 +00:00