Commit graph

70 commits

Author SHA1 Message Date
libraryupgrader 072d9c945c build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: Ie0106bd59ebf06a333596cd914292f7846e8fa23
2017-09-24 05:29:05 +00: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
Moritz Schubotz 46ccf11e8e Purge formulae on action=purge
Previously, the 'action=purge' parameter could not be
accessed by the math extension, since 'action=purge' caused a reload
of the page, even before the math extension was called. However,
before MediaWiki 1.29.+ additional GET request parameter were
forwarded to the next page and could be evaluated by the math
extension. Thus, an additional parameter 'mathpurge=true' was added
to re-render formulae. However, it seems that this additional GET
parameter is no longer being forwarded.

This change reads the refer header to check if 'action=purge' was
passed. This makes the mathpurge parameter obsolete.

Bug: T74537
Change-Id: Ia09c039de3a7232a28bfdd5a97daf1029e5d7c40
2017-05-26 17:50:35 +02:00
jenkins-bot a336d62a35 Merge "Avoid DBPerformance warnings in writeToDatabase()" 2016-06-10 08:34:56 +00:00
Aaron Schulz 9a1dede261 Avoid DBPerformance warnings in writeToDatabase()
Switch to using DeferredUpdates.

Bug: T92357
Change-Id: I64179317ab8ed21c864a4cb237cd4ed8705393e1
2016-06-09 22:33:44 +00:00
Marko Obrovac d722bc51f4 Send a no-cache content request on mathpurge=true
When the user specifies the mathpurge=true query parameter, the Math
extension needs to prompt RESTBase to regenerate the renders for all
formulae on the page and consequently issue Varnish purge requests. This
behaviour is achieved by including the `Cache-Control: no-cache` header
when requesting a render. Since RESTBase regenerates all of the renders
when it receives the header, send it only for the first content request;
if subsequent content requests are made, RESTBase will already have the
new renders.

Bug: T136205
Change-Id: I44482ccc1d8afdf6d40dcf8965d8debe83ef7e17
2016-06-03 14:10:57 +02:00
physikerwelt 6f7bcaf2c6 Update to mediawiki-codesniffer 0.6.0
Change-Id: I2a1a74c771bc00f6c1569568dfcf474f06714426
2016-04-19 17:07:21 -04: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 2f8c92cb79 Reduce number of Restbase requests
This change reduces the number of Restbase requests to two
by bundling all requests for MathML

Bug: T132096
Change-Id: Idfc29eeeca754738fe78ca0372e6b6725065528d
2016-04-12 15:13:26 +00: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
physikerwelt c77118d37d Reduce the number or requests sent to Restbase
Currently two post request and one get request is sent
for each formula.
This change gets rid of the second post request.

Change-Id: I805a2c0fa619c9143c38a0cc60e76c9480578ed3
2016-01-29 18:16:05 +01: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 1ec767791b Make math usable without RESTbase
* Do not contact RESTbase in texvc rendering mode and
  use the well established tex checking that is already build
  into texvc.
* Do not use RESTbase in LaTeXML mode.

Background:
In I1982612e8c6a356e3dbdf447724ac82e5968cc77 RESTbased replaced
texvccheck that was a derivate of texvc designed for people
that wanted to use secure MathML rendering using mathoid.
The integration of mathoid to restbase made this feature obsolete.
However, texvccheck was not only used to check the latex input
that was sent to mathoid, but also the string which was sent to texvc.
Since texvc has already build in tex checking this is not
required and does not improve security.
Finally, users updating from old versions of the math extension
(prior to 2014) that do not have textexvccheck installed,
do not need to compile the texvccheck binary after this change.

PS5: Also treats the case where VisualEditor is not installed.

Bug: T121173
Change-Id: I1bd076b09206869b5ed75280d22e1b36bfb8d8ad
2015-12-11 22:04:12 +01:00
physikerwelt 897afa480b Use RestBase to check input tex rather than texvccheck
* This will increase the performance of tex rendering for all
 rendering modes since no shell access is required anymore.

 Merge with caution. If the connection to restbase fails, rendering
 of new formulae will be completely disabled i.e. broken.

Change-Id: I1982612e8c6a356e3dbdf447724ac82e5968cc77
2015-12-03 09:03:43 +00:00
physikerwelt c66a85f143 Fix error in checking logic
Tex validation should be skipped if checking is disabled.
Consequently if 'disable tex filter' is set to 'never' it's a double
negation and tex should always be checked.
If 'disable tex filter' is set to always, never check tex.

Change-Id: Ic6fda8016838eae03a0ed36e3d8d4f35423ba8b1
2015-12-03 08:30:24 +01: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 f93333686d Fix: Set default MathStyle to inlineDisplaystyle
Redo Ibf6bdbd4ea36b4905445d5878f32f7e0b2bc8bac, which was
reverted by I029328849f05ec2afcabf38d2b79b337cb54cbd5.

In addition this patch simplifies the tex sent to the mathoid
server. Instead of {\displaystyle {\textstyle ... } } only
{\textstyle is sent (which overwrites \displaystyle anyway).

Change-Id: I16d6f67215c2f85ecd1d3a0bddacfc1700681557
2015-08-05 12:35:30 +02: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 fdf791d02a Fix: Set default MathStyle to inlineDisplaystyle
In I6d1094ece79e912d9ddbef6681a25196c7a6e801 math styles
were renamed from integer constants to string constants.
Before NULL corresponded to inlineDisplaystyle. This is
no longer the case so NULL has to be replaced by the actual
default value.

Change-Id: Ibf6bdbd4ea36b4905445d5878f32f7e0b2bc8bac
2015-07-31 18:09:40 +02: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 5c12ed983f Remove useless debug functionality
* MathDebug was intended to provide advanced debugging functionality
  for the math extension. However, the interesting debugging and
  logging feature never made it from the debug branch to the master.
* The current debug functionality is mostly useless. Only some values
  are written to memory and never used thereafter.
* This change moves the existing functionality to the MathSearch
  extension and introduced the required hook for that.

Details:
* $wgMathDebug is removed
* A new Hook MathRenderingResultRetrieved is created
* The math rendering object is printed to the svg error
  page if wgDebugComments is active (instead of wgMathDebug)

Change-Id: I6fad69b5d9b9ca8a7d12c7e410d3ae6180fbddbf
2015-07-14 10:34:37 -04: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
Chad Horohoe eab415ef71 Math: tidy up error message handling
- We don't localize errors and debug logs like this, it makes them
  impossible to decipher
- Also remove some 1.21 and below back-compat while we're here

Change-Id: Idb23fe5b434fa9fa3518672d57ec6e5466d005ac
2015-02-19 16:22:46 -08:00
Chad Horohoe 0404113641 Remove obvious function-level profiling
Change-Id: I41d48da124e38c46ce71aa9d3b756096a424df1c
2015-02-12 12:14:24 -08:00
physikerwelt (Moritz Schubotz) 1c9383d985 LaTeXML: prevent automatic rerendering of SVG
MathMathML::renderingRequired called the getSvg
function in MathLaTeXML that caused an automatic
rerendering of the SVG image if it was not cached.
That this rendering is triggered from the function
renderingRequired is contra intutive and should be
avoided.

Change-Id: Ifa14f50193a05b3058624a18974c56897fcec09e
2015-02-08 16:28:04 +00:00
physikerwelt (Moritz Schubotz) 9c0a2c28b9 MathRenderer, SpecialMathShowImage: Correct phpdoc
Change-Id: Ibce076dfb6bd3676e288cf2d762ebcb55606246d
2015-01-22 19:11:47 +00:00
physikerwelt (Moritz Schubotz) 4d7f6f8b77 Add type hinting for newFromMd5 constructor
Bug: T87142
Change-Id: I2989ff42e48e802c1eed1877f0f2ac9316b5fd21
2015-01-22 19:10:57 +00:00
Ed Sanders 21ade23c71 Whitespace fixes
Change-Id: Id22a4bfdc1b8c4074f6d7e6f21e8dbc2824d856e
2015-01-16 11:41:51 +00:00
physikerwelt (Moritz Schubotz) 3564b7cfe8 Avoid calling readFromDatabase in source mode
In source mode there is no database cache,
so we do not need to call readFromDatabase there.

Change-Id: I791eab923f5ed6e0a3e28dbaf49ba1ae8fdb6cdc
2014-10-11 16:41:38 +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
physikerwelt f2dff6574b Fix: id-attribute
Id attribute was read wrong place

Change-Id: I6f2671a322f637a1d8e0c88833ce4456d188829b
2014-07-25 17:18:45 +00:00
physikerwelt (Moritz Schubotz) cbbf5453d1 Enable MathML rendering mode
This change allows to registered users
to test the new MathML rendering mode.
Invalid settings for math rendering mode
will default to MathMathML.

Change-Id: I75f24cb762609d6728247e3758fcc18f2ebfc6e6
2014-06-11 13:21:34 +02:00
physikerwelt (Moritz Schubotz) 04ce4a02c7 Add options to the math tag
* id: Allows to name equations
  and deep link to equations
* forcemathmode: Allows to override the user defined rendering mode.
  This feature is useful for help pages and discussions about rendering.
* type: support for MathML and asciimath input
  required for MediaWiki instances that want to
  incorporate MathML sources like for instance pubmed

Change-Id: I615c7f1a5762e9e662937b70953fb873309d4c07
2014-06-10 20:19:12 +02:00
physikerwelt (Moritz Schubotz) d928de94e5 Add alternative constructor
Adds a new constructor that allows
to create a new instance of the MathRenderer
based on an inputhash.

This method is required for the Specialpage
and the MathSearch extension.

Change-Id: I618b0fa7dcfdf8a7c740991c19ae0d70e71f19ba
2014-06-10 13:14:56 +02: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 c390f6479a Add getHtmlOutput method
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 adds a mechanism that allows
to fetch the HTML output.
In a followup commit the rendering function
is changed to return a boolean value rather
than the rendering result.
This will simplify the error handling and caching.

Change-Id: I80760493e391911c41eb69d75a93c6a34db8852e
2014-06-06 21:52:35 +02:00
physikerwelt (Moritz Schubotz) c7197bee19 Add separate database table for LaTeXML (step 5)
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 is patch changes the logic of the rendering
engine to use the specific database.
The caching logic is now simpler to understand.
A entry is written to the database if the changed field
of the MathRenderer class is true. Is is triggered by the
setters of the database relevant fields.


Bug: 65522
Change-Id: Ief9de889b9292b21c9d1529a8b1797f38196edad
2014-05-31 10:34:21 +00:00
physikerwelt 410416101f Add separate database table for LaTeXML (step 4)
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.

In this change the MathRenderer class fields are updated
and new setters and getters are introduced.

Bug: 65522
Change-Id: I09ba07c5ed6b16d65cffe4da238d138a6cafd795
2014-05-28 09:06:43 +00:00
physikerwelt bf33d51320 Add separate database table for LaTeXML (step 3)
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 adds the method getMathTableName that will
allow renderers to access their specific table in the
database.

Change-Id: I8b11ffd0a39fadd7d3c8de1e94e74ff5f490430d
2014-05-27 05:33:20 +00:00
Moritz Schubotz (Physikerwelt) 58f913ecb0 $wgMathValidModes and orthogonal MathJax enabler
To adjust the selectable math rendering modes in user preferences $wgMathValidModes
is introduced.

* $wgUseLaTeXML becomes unnecessary use $wgMathValidModes[] = MW_MATH_LATEXML;
  to enable the LaTeXML rendering mode
* add $wgMathValidModes[] = MW_MATH_MATHJAX; to enable MathJax

Currently, MathJax is bound to the MW_MATH_SOURCE rendering mode.
This change makes the base mode user configurable.
That means before MathJax is loaded the png fallback image could
be displayed.

ATTENTION: This change modifies global variables as follows:
* MW_MATH_MATHJAX is deprecated.

Bug: 57981
Change-Id: Ibf705cb66754d04e4c7eafd1e98608b25d7dbb94
2014-04-08 15:29:42 +00:00
Moritz Schubotz (Physikerwelt) c5b0b15d8f Fix MathJax centers equations
* Removes the MathJax heuristics that decides
  if equations are centered or left-aligned.
* Introduces the attribute display to specify
  if the math element is rendered in inline,
  display, or inline-displaystyle.
* add css rules for display / inline math images

Bug: 61051
Change-Id: Iba69903f781f0cb1606b8ddcffb90fb86c9b229b
2014-04-06 21:58:30 +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