Commit graph

18 commits

Author SHA1 Message Date
Fomafix
025a5fb71a Let Html::element do the HTML encoding
This change avoids an unnecessary HTML encoding of `"` to `"` and
`>` to `>`.

Change-Id: Ieb135edacb84982908d9462bae3c287f54761f1f
2019-11-19 06:59:55 +01:00
Max Semenik
48a323f702 tests: Add explicit return type void to setUp() and tearDown()
Bug: T192167
Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43
Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
2019-10-30 14:31:22 -07:00
Kunal Mehta
674e486cb5 Recognize CSS/JS redirects with non-ASCII targets
The regex in JavaScriptContent and CssContent was trying to pass
urlencoded stuff to Title::newFromText(), which would fail. Make sure we
urldecode it first.

Bug: T208264
Change-Id: I189c4c308da2875839ad8c1061332500f0e6d244
2018-10-31 23:09:50 -07:00
Umherirrender
255d76f2a1 build: Updating mediawiki/mediawiki-codesniffer to 15.0.0
Clean up use of @codingStandardsIgnore
- @codingStandardsIgnoreFile -> phpcs:ignoreFile
- @codingStandardsIgnoreLine -> phpcs:ignore
- @codingStandardsIgnoreStart -> phpcs:disable
- @codingStandardsIgnoreEnd -> phpcs:enable

For phpcs:disable always the necessary sniffs are provided.
Some start/end pairs are changed to line ignore

Change-Id: I92ef235849bcc349c69e53504e664a155dd162c8
2018-01-01 14:10:16 +01:00
Kunal Mehta
4de7b0a542 Add @covers tags to ContentHandler tests
Change-Id: I4d0994e91f63a0921343f34ef81a82463b4ab969
2017-12-27 17:48:56 +00:00
umherirrender
eac06f65ce Use more short array syntax in comments (/tests/)
Change-Id: I86c73cb9447ac562a73348b4030e24ebf49a90dc
2016-07-10 17:23:29 +02:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Amir E. Aharoni
e77af93e83 Add @codingStandardsIgnoreStart to 5 files under tests/phpunit/includes
To pass phpcs.

Bug: T102614
Change-Id: I4c7d60d26112c7ba67b66f1923ce945e96175d15
2015-10-03 12:30:29 +00:00
Reedy
3a6fc5e96c Re-enable Squiz.WhiteSpace.ScopeClosingBrace.Indent
Change-Id: I743c4ce019321d631c0a11ee2112fe9aa8ba4c5d
2015-09-26 16:09:54 +00:00
Kunal Mehta
71b3e7a4b7 Implement redirects in CssContent
Just like ad9f14d662 which was for JavaScript. The redirect will be
of the form "/* #REDIRECT */@import url(...);".

Bug: T73201
Bug: T35973
Change-Id: I10bae44af4b4923f8797172702974cd45dc25ab4
2015-07-28 17:53:47 +00:00
Kunal Mehta
ad9f14d662 Support redirects in JavaScriptContent
When a JavaScript page is moved, a "redirect" in the form of
mw.loader.load(...) will be left behind, so any other
JavaScript loading the page that way will still work, albeit
with an extra HTTP request.

This also implements Content::getRedirectTarget(), so redirects
are marked properly in the database, and users viewing them
are redirected properly. A magic "/* #REDIRECT */" comment
must be in front of the mw.loader.load call. This is done so
that pages which currently are just one mw.loader.load call
aren't turned into redirects.

Bug: 71200
Bug: 33973
Change-Id: I10fdff087a901da56fad64531f0e382f90ebcf37
2015-07-20 15:36:49 +00:00
daniel
48d5e5b3c9 Introduce ContentGetParserOutput hook
This hooks allows extensions to override the normal model-specific
rendering of page content. A typical use would be to provide syntax
highlighting for pages that contain scripts. In that sense,
ContentGetParserOutput is a generalization of the old ShowRawCssJs
hook.

This, together with I76412f9d, is a (hopefully) fixed version of the
reverted Ibfb2cbefea44.

Change-Id: I979e2438689648ba4c959d8083197ef14ce524e8
2014-05-10 14:27:33 +02:00
addshore
2df1b0f0be Add @covers tags for /content files
Change-Id: Ied40e5afb1027f7d8ff46ffbf722ff6558eed880
2013-10-18 12:53:29 +02:00
Ori.livneh
6ec90a1acd Revert "Introducing ContentGetParserOutput hook."
This change removed getHtml(), but not the call to it from fillParserOutput.
It has a few other issues that I'll flag in-line after deploying the revert.

This reverts commit fda090a7e7

Bug: 49398
Change-Id: Idcef8d4cedc7c03f72bc1743e0f89cc5ed4ad7a7
2013-06-10 19:13:00 +00:00
daniel
fda090a7e7 Introducing ContentGetParserOutput hook.
This hooks allows extensions to override the normal model-specific rendering
of page content. A typical use would be to provide syntax highlighting for
pages that contain scripts. In that sense, ContentGetParserOutput is a
generalization of the old ShowRawCssJs hook.

Change-Id: Ibfb2cbefea44eeee9f2a027f47e7721bf177ba0f
2013-06-04 15:57:04 +00:00
Siebrand Mazeland
791d0b2a98 Update code formatting
Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03
2013-04-26 14:21:20 +00:00
Siebrand Mazeland
9f77245218 Update formatting
4 of n.

Change-Id: I23e2409ce9eff14c3434154d236de83c93a92440
2013-02-14 14:10:38 +01:00
Timo Tijhof
a4aef7d495 Fix warnings and enforce conventions in ContentHandler tests.
Syntax:
* Call parent setUp from setUp.
* Set required globals for the test inside the test class instead
  of assuming the default settings.
* Data providers are called statically and outside setUp/tearDown
  ("public static function")
* Test function names should be prefixed with "test"
  ("testIsRedirect")
* Marked 2 functions as unused. JavascriptContentTest has 2 data
  providers for tests that don't exist in it (nor in TextContentText)
  but do exist in WikitextContentTest.

Style:
* Single quotes
* Remove odd comment "# =====" lines
* Consistent tree wrapping with arrays.
  array(
      array(
          .. ) );
  array(
      array(
          ..
      )
  );
  Some were closing on the previous line instead.
  Made it consistent now.
* Remove odd indentation to make nested arrays line up:
  array( 'foo' => array(  'bar' => true,
                          'baz' => array() ) )
  array( 'foo' => array(
      'bar' => true,
      'baz' => array()
  ) )

  We don't do this kind of indentation because it is fragile
  and becomes outdates when any of the earlier keys ("foo")
  change. Converted to a regular tree instead.

  Also triggered git warnings for mixing spaces with tabs, which
  is almost always an detector for this style.

* Not using @annotations in inline comments, reserved (and only
  parsed/meaningful) for block comments.

Follows-up 8b568be5e2

Change-Id: Ic55d539b9a58f448b550bcd98894d389764e0694
2012-10-25 22:37:32 +02:00