Commit graph

44 commits

Author SHA1 Message Date
Thiemo Kreuz 56ad7ff334 Update a few type hints
Some random bits I found while working on some other code.

Change-Id: I29be84cb54e05af5030defd99cb1f42f9c6a5b63
2021-02-18 16:20:35 +00:00
Umherirrender 99c3e91fb4 Add missing @var and improve documentation
Change-Id: I8be91329f1f85f3bf40ea19d3b7e0be7dc655df1
2020-12-17 21:53:28 +01:00
libraryupgrader ce88944fe5 build: Updating mediawiki/mediawiki-codesniffer to 33.0.0
The following sniffs are failing and were disabled:
* Generic.ControlStructures.DisallowYodaConditions.Found
* MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate
* MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected
* MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage
* MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage

Additional changes:
* Dropped .inc files from .phpcs.xml (T200956).

Change-Id: I2a0a579219607d60c1557d4b700cdf810f07f538
2020-11-04 04:01:14 +00:00
Umherirrender 78dace58e6 build: Bump phan to 0.10.2, remove taint-check
Change-Id: I044a8b6d32dc539911616e88f9491b3b3c382449
2020-05-31 17:47:02 +02:00
libraryupgrader ccc6a0cb48 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 24.0.0 → 26.0.0

npm:
* set-value: 2.0.0 → 2.0.1
  * https://npmjs.com/advisories/1012
  * CVE-2019-10747
* union-value: 1.0.0 → 1.0.1
  * https://npmjs.com/advisories/1012
  * CVE-2019-10747
* mixin-deep: 1.3.1 → 1.3.2
  * https://npmjs.com/advisories/1013
  * CVE-2019-10746

Change-Id: Id7c540a37118f3a89917f467dcb715f504b843ef
2019-07-14 13:30:34 +00:00
libraryupgrader 54d1b77401 build: Updating mediawiki/mediawiki-codesniffer to 24.0.0
Change-Id: I30daab715920757ec96350c9933fc18c887972c4
2019-02-06 23:08:22 +00:00
Umherirrender c82458bbbc Remove @global doc annotation
It is unknown to doxygen

Change-Id: I1ef4bf4292b78fcd434f35c31f75b08b9c6a49d8
2018-09-09 20:53:28 +02:00
Reedy f46452a196 Remove unnecessary else statements and indenting
Change-Id: Ifa36998ca089d2a045e821bc1b941c5eec7e9474
2018-06-07 02:06:59 +01:00
Thiemo Kreuz 0e8c745885 Update @license tags from GPLv2 to GPL-2.0-or-later
Change-Id: I150433038f8411df0b9f40f5c8933d7a533f426b
2018-04-14 09:36:27 +00:00
Thiemo Kreuz cb76291cbf Remove @file tags from normal class level comments
The @file tag is helpful when a block of documentation does not refer
to a class, but to a file. This is not the case here. These comments
can be normal class level comments.

Change-Id: I5ea1a1ecbe2dd681b91b793d4e45e7cd8dee529e
2018-04-13 15:29:59 +02:00
Umherirrender bbc88d5f5d Fix parameter docs
* Removed () from param doc
* Fix return type
* Changed default type

Change-Id: I82d81c99683cb79d60980eaa702c99110af6db94
2018-04-07 21:04:07 +02: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
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
Brad Jorsch 1c3dd4fb0d Replace use of &$this
Use of &$this doesn't work in PHP 7.1. For callbacks to methods like
array_map() it's completely unnecessary, while for hooks we still need
to pass a reference and so we need to copy $this into a local variable.

Bug: T153505
Change-Id: Ib31f3bbffdd6b25ad9a21498294644e4dde33bd1
2017-01-31 22:54:07 -05: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 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
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
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
physikerwelt da6865c014 Fix: SVG images for LaTeXML were not cached
* The createSvg function calculated the new SVG image
  but did not set the change bit

Change-Id: Ib797f607386013960edafb33c609c9cff4de0e4b
2015-07-13 11:45:30 -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 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) 4459c5c452 Avoid unnecessary database reads
Use the cached function isInDatabase rather than readFromDatabase to
 avoid unnecessary read operations on the database.

 Currently, readFromDatabase is usually called only once during instance
 livetime. But after I455b41c8b8d918f4c34f6c115194d227a8394e0a has bben
 merged chances are that it's called twice.

Change-Id: I6434195ad1d323a578a8fdca1b4555e11ab30a15
2014-09-06 02:34:30 +00:00
physikerwelt 6cb52f9190 Add SVG generation for LaTeXML
Currently SVGs are generated only in
MathML mode but not in LaTeXML mode.
Since LaTeXML can benefit from the
SVGs as well this change introduces
the functionality to generate SVG
images from LaTeXML MathML input.

Generating SVG images for LaTeXML is an essential
part of Math 2.0. It enables to include LaTeXMLs Content
MathML and provides fallback
images for visitors with MathML disabled browsers.

Change-Id: If13a8b0825bf12dbfe4920ddb7ad552df9bc095f
2014-08-01 03:33:08 +02:00
physikerwelt (Moritz Schubotz) 52656990b4 MathMathML
The LaTeXML class contains some code that is
not specific to LaTeXML but to MathML.
This code can be shared between LaTeXML and Mathoid.
This change introduces a new class called MathMathML
and moves the shared code from the LaTeXML class to this
new class.

Bug: 65973
Change-Id: I50517ba83f9a0d2aa8e237f062f18e4319ddbac8
2014-06-05 09:06:33 +00: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 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
physikerwelt 3b7ea6413c Change default value for $wgMathLaTeXMLUrl
new LaTeXML instance.
Sponsored by https://www.xsede.org/

Cherry-Pick from Id92ef141c7921a82528b3ba4384e026322499312

Change-Id: Idd1de9da348d473acc6cea8d2d1a855f1f6b07fa
2014-05-09 11:06:39 +02: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
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
physikerwelt dd4f911d87 Rename some global variables that violate the naming convention
* $wg(.*) variables from extension should start with the extension name
    i.e. for extension Math $wgMath(.*)
* But keep $wgUseMathJax, because it has been used for 2 years now.
* Add release notes

Change-Id: Ib70a9f7767890cc4618bc10c2610784f5b17e670
2014-02-01 11:56:07 +00:00
Max Semenik 4d68c31de1 Add profiling
Change-Id: I9066f6b2606044412a9b91ca395e841550d7e787
2013-11-18 14:46:00 +04:00
physikerwelt (Moritz Schubotz) 12b43489ea Expose LaTeXML Settings
Make LaTeXML setting configurable with the new global
variable $wgDefaultLaTeXMLSetting.

PS: This variable can be specified as an array or a
string. If specified as an array, the
 array('a'=>'b','c'=>array('e','f'))
would be transformed to the equivalent setting
 a=b&c=e&c=f
,which is the input format for the LaTeXML daemon.

Change-Id: I2869df27cee83b426c6eb2312306fac9d6203ef2
2013-09-20 17:20:03 +00:00
physikerwelt 48461d0fca Check if media wiki core is capable of xml type checking
* new test for XML type checking function
* check if StrigUtils::isUtf8 exists in core (Thanks to Deyan Ginev for the hint.)

Bug: 50884
Change-Id: I86af95cbecc4b5c9c33fcd3a66a7fb2ccdde0194
2013-07-18 20:49:09 +00:00
physikerwelt 233d285264 Replace SimpleXml by Mediawiki library
This replaces the SimpleXML library by
the internal class XmlTypeCheck

Needs at least that version
 https://gerrit.wikimedia.org/r/#/c/66365/

Change-Id: Iafbd820f7130c8eb8d4f19824632b4ac89f214a9
2013-06-18 08:35:01 +00:00
physikerwelt 443c7ef95a Calculate HTTP POST data in separate method for debugging
To check if the renderer works correctly it is desired to be able to
separate the test of the renderer and the function of the extension
PHP code. Therefore the method getPostData can be used to get
the values can be sent to the renderer directly via
curl –d 'POSTDATA' URL

Change-Id: I530f5fcba46364458643914bca81cf0bc1b60a58
2013-05-30 07:59:27 +00:00
physikerwelt 927340d345 New rendering option LaTeXML
Introduces a new rending option to render TeX to MathML
via LaTeXML.

Bug: 43222
Change-Id: I5d29e219c0d3b907e22ea0bb3b30f000d8a7a9f8
2013-05-26 12:12:51 +00:00