mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-14 19:26:08 +00:00
Disable PHPCS more narrowly
Change-Id: I20d8b519d5827e865ccd3adf7c2c6ba069f37afb
This commit is contained in:
parent
dcf8f0926d
commit
7a53bd905c
|
@ -444,9 +444,7 @@ class MathMathML extends MathRenderer {
|
|||
$class .= 'inline';
|
||||
}
|
||||
if ( !$fallback ) {
|
||||
// @codingStandardsIgnoreStart
|
||||
$class .= ' mwe-math-mathml-a11y';
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
return $class;
|
||||
}
|
||||
|
|
|
@ -124,10 +124,14 @@ class SpecialMathShowImage extends SpecialPage {
|
|||
*/
|
||||
private function printSvgError( $msg ) {
|
||||
global $wgDebugComments;
|
||||
// @codingStandardsIgnoreStart
|
||||
$result = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 4" preserveAspectRatio="xMidYMid meet" >' .
|
||||
'<text text-anchor="start" fill="red" y="2">' . htmlspecialchars( $msg ) . '</text></svg>';
|
||||
// @codingStandardsIgnoreEnd
|
||||
$escaped = htmlspecialchars( $msg );
|
||||
$result = <<<SVG
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 4" preserveAspectRatio="xMidYMid meet" >
|
||||
<text text-anchor="start" fill="red" y="2">
|
||||
$escaped
|
||||
</text>
|
||||
</svg>
|
||||
SVG;
|
||||
if ( $wgDebugComments ) {
|
||||
$result .= '<!--'. var_export( $this->renderer, true ) .'-->';
|
||||
}
|
||||
|
|
|
@ -95,9 +95,8 @@ class SpecialMathStatus extends SpecialPage {
|
|||
// New Mexico' in ''Journal of Environmental and Public Health'' , vol. 2010p.
|
||||
// authors Joseph E. Bunnell; Linda V. Garcia; Jill M. Furst;
|
||||
// Harry Lerch; Ricardo A. Olea; Stephen E. Suitt; Allan Kolker
|
||||
// @codingStandardsIgnoreStart
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
$inputSample = '<msub> <mrow> <mi> P</mi> </mrow> <mrow> <mi> i</mi> <mi> j</mi> </mrow> </msub> <mo> =</mo> <mfrac> <mrow> <mn> 100</mn> <msub> <mrow> <mi> d</mi> </mrow> <mrow> <mi> i</mi> <mi> j</mi> </mrow> </msub> </mrow> <mrow> <mn> 6.75</mn> <msub> <mrow> <mi> r</mi> </mrow> <mrow> <mi> j</mi> </mrow> </msub> </mrow> </mfrac> <mo> ,</mo> </math>';
|
||||
// @codingStandardsIgnoreEnd
|
||||
$attribs = [ 'type' => 'pmml' ];
|
||||
$renderer = new MathMathML( $inputSample, $attribs );
|
||||
$this->assertEquals( 'pmml', $renderer->getInputType(), 'Checking if MathML input is supported' );
|
||||
|
@ -114,9 +113,8 @@ class SpecialMathStatus extends SpecialPage {
|
|||
public function testLaTeXMLIntegration() {
|
||||
$renderer = MathRenderer::getRenderer( "a+b", [], 'latexml' );
|
||||
$this->assertTrue( $renderer->render( true ), "Rendering of a+b in LaTeXML mode" );
|
||||
// @codingStandardsIgnoreStart
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
$expected = '<math xmlns="http://www.w3.org/1998/Math/MathML" id="p1.m1" class="ltx_Math" alttext="{\displaystyle a+b}" ><semantics><mrow id="p1.m1.4" xref="p1.m1.4.cmml"><mi id="p1.m1.1" xref="p1.m1.1.cmml">a</mi><mo id="p1.m1.2" xref="p1.m1.2.cmml">+</mo><mi id="p1.m1.3" xref="p1.m1.3.cmml">b</mi></mrow><annotation-xml encoding="MathML-Content"><apply id="p1.m1.4.cmml" xref="p1.m1.4"><plus id="p1.m1.2.cmml" xref="p1.m1.2"/><ci id="p1.m1.1.cmml" xref="p1.m1.1">a</ci><ci id="p1.m1.3.cmml" xref="p1.m1.3">b</ci></apply></annotation-xml><annotation encoding="application/x-tex">{\displaystyle a+b}</annotation></semantics></math>';
|
||||
// @codingStandardsIgnoreEnd
|
||||
$real = preg_replace( "/\n\\s*/", '', $renderer->getHtmlOutput() );
|
||||
$this->assertContains( $expected, $real,
|
||||
"Comparing the output to the MathML reference rendering" .
|
||||
|
|
|
@ -92,9 +92,8 @@ class MathRestbaseInterfaceTest extends MediaWikiTestCase {
|
|||
* @expectedExceptionMessage Cannot get mml. TeX parse error: Missing close brace
|
||||
*/
|
||||
public function testLateError() {
|
||||
// @codingStandardsIgnoreStart
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
$input = '{"type":"https://mediawiki.org/wiki/HyperSwitch/errors/bad_request","title":"Bad Request","method":"POST","detail":["TeX parse error: Missing close brace"],"uri":"/complete"}';
|
||||
// @codingStandardsIgnoreEnd
|
||||
MathRestbaseInterface::throwContentError( 'mml', $input );
|
||||
}
|
||||
|
||||
|
@ -105,9 +104,8 @@ class MathRestbaseInterfaceTest extends MediaWikiTestCase {
|
|||
* @expectedExceptionMessage Cannot get mml. TeX parse error: Missing close brace
|
||||
*/
|
||||
public function testLateErrorString() {
|
||||
// @codingStandardsIgnoreStart
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
$input = '{"type":"https://mediawiki.org/wiki/HyperSwitch/errors/bad_request","title":"Bad Request","method":"POST","detail": "TeX parse error: Missing close brace","uri":"/complete"}';
|
||||
// @codingStandardsIgnoreEnd
|
||||
MathRestbaseInterface::throwContentError( 'mml', $input );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue