Commit graph

577 commits

Author SHA1 Message Date
Tim Starling
75d7731dde In parserTests.php, fix upload directory handling
Instead of having two conflicting filerepo configurations, one at
/tmp/test-repo and another at a randomized path, and populating the one
that isn't used with files, let's just have a single upload directory,
populate it with files, and then actually use those files.

This fixes a set of confusing system-dependent parser test failures. In
the failure scenario, the file upload would be recorded, but then
invalid JPEG metadata would trigger LocalFile::loadFromFile(), which
would look for the file in the wrong place and mark it missing. Then
parser tests would fail due to image links being broken (red).

This is probably not as nice as the fake in-memory repo used by
NewParserTest, but this approach does provide a richer integration test.
This is a conservative fix that just fixes the things that are terribly
broken rather than making new things.

Also:

* Clear the RepoGroup singleton, for completeness, since it doesn't
  make sense to set $wgLocalRepo without clearing it. Since we now set up
  a similar repo at initialisation to the one set up with each test, it
  probably doesn't have any effect.

* Warn if gd is not present since this causes 49 test failures.

* Use glob patterns in teardownUploadDir() instead of requiring every
  file to be individually listed. This fixes an error due to failure to
  delete a 240px file.

Change-Id: I56a0e0d1cb363b40cf19c735e00cbb8929c1401a
2015-09-28 15:48:32 +10:00
Vivek Ghaisas
c54766586a Fix issues identified by SpaceBeforeSingleLineComment sniff
Change-Id: I048ccb1fa260e4b7152ca5f09b053defdd72d8f9
2015-09-26 23:06:52 +00:00
Reedy
58f0a7ee4e Wrap some long strings in tests/
Change-Id: I89d53c5051e5ee4bd8624df8ee2b25993090a7df
2015-09-26 21:01:59 +01:00
Arlo Breault
cc062f0e76 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 6619409e60a3208144836970773f191e7a6d147f

Change-Id: Iea6199d2d6a314f118febdc2308be1723a9970d2
2015-09-24 10:26:13 +02:00
C. Scott Ananian
a05971dfc7 Terminate free external link on &nbsp; (and numeric versions of <>)
Bug: T84937
Change-Id: Ic74d8d069e08c0597c7b26755e0d942bf3a510cc
2015-09-23 16:00:52 -04:00
Tim Starling
2c6c954e23 Abstract and refactor Tidy support
* Split tidy implementations into a class hierarchy
* Bring all tidy configuration into a single associative array and
  deprecate the old configuration.
* Remove $wgAlwaysUseTidy

This is preparatory to replacement of Tidy (T89331). I used the name
"Raggett" for things relating to Dave Raggett's Tidy, since if we use
"tidy" to mean the new abstract system as well as Raggett's tidy, it
gets confusing.

Change-Id: I77af1a16cbbb47fc226d05fb9aad56c58e8910b5
2015-09-10 20:18:52 -07:00
Arlo Breault
bef1ba5c71 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 45ef2301bfc549c890851de811e5b34f68d5646a

Change-Id: I9394b326bc370ea6240dd6504aabc2678e346d2a
2015-09-10 09:17:51 -07:00
jenkins-bot
804cc6885a Merge "Revert "Do not encode "'" as %27 (redirect loop in Opera 12)"" 2015-09-10 15:36:10 +00:00
Bartosz Dziewoński
8477b1b277 Revert "Do not encode "'" as %27 (redirect loop in Opera 12)"
This seems to cause redirect loops in current Firefox instead.

This reverts commit a89a21990e.

Bug: T106793
Change-Id: I18fac8ab0f94e2df8476131b132c9866902a02c4
2015-09-10 15:23:25 +00:00
Subramanya Sastry
23e2f64ec5 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit c8c7b5efa5a1754ec17294ee9e0269b3dfc9b0b1

Change-Id: I006cc95fb354c1b4ad40f0999938c5c4afaf099d
2015-09-07 20:28:23 -05:00
Bartosz Dziewoński
a89a21990e Do not encode "'" as %27 (redirect loop in Opera 12)
Similar to 7b4df0e12e,
but for apostrophe instead of tilde and for Opera
instead of Chrome.

Bug: T106793
Change-Id: Ic54390434cebcc76a6c8ab49acc164d36e0cdff6
2015-09-05 21:17:33 +01:00
Subramanya Sastry
cd3ddb1f59 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 5f2fae6c7e601b706403621924b769e87c5ed554

Change-Id: Ied3e5b2ac4df059c37f8e617ae55e47e8d15c1ee
2015-09-02 13:23:01 -05:00
Arlo Breault
174b09c184 Allow stop characters as quoted attribute delimiters
* Matches Parsoid in Ibdaa51f94eadc640278594a3eb5dd43356c286ea

Change-Id: I51b6861d7232d857b75881966091ae1e662c13a9
2015-08-26 14:33:12 -07:00
mjbmr
04f93370bb Replace 'emailpage' with 'emailuser'
Bug: T109614
Change-Id: I345d0091b17ef61499dc7d8c170308fd8194dc00
2015-08-20 10:49:03 +00:00
jenkins-bot
586effc0b7 Merge "Escape return of {{int:}} if message not exists" 2015-08-19 17:31:48 +00:00
C. Scott Ananian
bb281c0317 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit e2aa4e4159b9c7b5350567f26f5f14780843a368

Change-Id: I64b4e901ece0e66011b5110312885fab9c8b9cb8
2015-08-18 19:24:34 -04:00
C. Scott Ananian
bc75784cbb T106578: Update Sanitizer to match legal HTML5 character entities.
Invalid HTML5 character entities become instances of UTF8_REPLACEMENT,
so we also ensure that checkCSS notices this and emits the proper
human-friendly sanitization notice.

Change-Id: I76cef7c772b1e3eba0af8dab6403e9100beab03a
2015-08-18 23:05:10 +00:00
C. Scott Ananian
87eebf8dd5 Support IPv6 URLs in bracketed and auto links.
The corresponding patch for Parsoid is
Ibb33188cdfe2004e469c3f6ee6f30d34d1923283.

Task: T23261
Change-Id: Iff077bf31168b431febb243e2e62f2c6502616bc
2015-08-18 22:50:58 +00:00
C. Scott Ananian
59e8147b67 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 48617c40c2eb9c7a421bb9c5b3ba0907fdec9c21

Change-Id: I565886079e64985844fc0a7c67ab74340b42f84a
2015-08-17 16:52:48 -04:00
Kevin Israel
20cbd0f226 Make PPFrame::RECOVER_COMMENTS actually work
Because of a missing condition, it generally only had an effect on
output type Parser::OT_WIKI, and thus {{msgnw:}} would strip comments
except when substituted during a pre-save transform.

Bug: T98841
Change-Id: I1e47696434fe87475f9902e6bfb8990566456e2f
2015-08-15 04:12:23 -04:00
jenkins-bot
c43d2d37a6 Merge "Parser: Don't generate an external link on "http://)" and similar" 2015-08-05 20:12:29 +00:00
C. Scott Ananian
eade3aedf5 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 19c5d8af12ea0a79141f3aa0634d0fd28fb30c5c

Change-Id: Ifffc18a38c6501706209d1b033d2305a7534ba61
2015-08-04 12:31:19 -04:00
Bartosz Dziewoński
bd7e02f39f Parser: Don't generate an external link on "http://)" and similar
Bug: T105697
Change-Id: I6cd14b9c4a541af8d0bb50b925aa0b015e97c3fe
2015-08-04 12:23:07 -04:00
jenkins-bot
38514beff4 Merge "Empty attribute syntax" 2015-08-03 23:07:00 +00:00
umherirrender
87c1ca1ac1 Escape return of {{int:}} if message not exists
This avoids returning possible html tags like <var> for {{int:var}}.

Bug: T44914
Change-Id: Ibcba9129d88510e6a84282c774ebe2dbfa548462
2015-07-24 22:02:54 +02:00
Arlo Breault
0b4208e645 Allow whitespace between indent and table start tag
* \s matches the trim on the line.

 * Since leading space is ok for table start tags, and you can use them
   in ":" context, you should be able to compose the two together.

Bug: T105238
Change-Id: Id08e24e5dd2bb8ca09453adec87b21225df4a840
2015-07-18 20:41:33 +00:00
C. Scott Ananian
e51fe52629 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit ece4412e84bdfc7960b69c38207f6981b9f6b596

Change-Id: I5beed6dce381cfbd6ead8b280697c2e044cae889
2015-07-09 13:48:11 -04:00
jenkins-bot
6a779b59a2 Merge "T105242: U is for urlencode" 2015-07-09 14:54:47 +00:00
Brian Wolff
7b4df0e12e Do not encode '~' as %7E. Fixes redirect loop in chrome.
As of 155d555b83, we now redirect variations on hex escapes
into their canonical form. This was causing '~' to be redirected
to %7E. However google chrome seems to canonicalize %7E back
into ~, causing a redirect loop.

RFC 3986 says ~ is unreserved, so not hex encoding it should be
fine. To quote: "For consistency, percent-encoded octets in the
ranges of...tilde (%7E) should not be created by URI producers"

Bug: T105265
Change-Id: I01556eee496e2fb540de8ff09c082c1fedddb5f7
2015-07-09 11:52:24 +01:00
Arlo Breault
baddcab658 T105242: U is for urlencode
* Urlencode and extension tags don't play nice. The current behaviour
   is pretty broken. For example,

      {{urlencode:<pre id="one">two</pre>}}

   outputs

       <pre id="one">two</pre>

   which isn't exactly urlencoded.

 * Just drop the unexpanded content; anything more seems unsafe. There's
   precedent for this already in anchorencode.

 * Noticed in the infobox caption for enwiki/%22F%22_Is_for_Fugitive

Change-Id: I0ec5d2fdeb71f762036464f65029afd029e8b4a1
2015-07-08 15:28:21 -07:00
C. Scott Ananian
1c4a8ff314 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 34bd76a1747816ed96952ce81ce2fafa751dbb21

Change-Id: Iabf427db488251e26d55a0eb68b282eccd9eb8df
2015-07-08 17:57:39 -04:00
Brad Jorsch
359e77d7c9 Parser: Avoid producing <span></span> in the TOC
If someone renames a section but wants old targeted links to still work,
<span id="old-anchor"></span> is the usual solution. And sometimes
people put it inside the section header markup, like

 == <span id="old-anchor"></span>New name ==

since putting it before makes it be considered part of the previous section
while putting it after causes the browser to scroll the section header
off the screen.

But this has the unfortunate side effect that the TOC text for that
section will be "<span></span>New name". We should strip that useless
empty span.

Bug: T96153
Change-Id: I47a33ceb79d48f6d0c38fa3b3814a378feb5e31e
2015-07-08 17:11:21 +00:00
Arlo Breault
aee072efe2 Empty attribute syntax
* The value is implicitly the empty string.
   http://www.w3.org/TR/html5/syntax.html#syntax-attribute-name

Bug: T54330
Change-Id: I8591ef209fb7337fb39ad6e45135942d074373bc
2015-07-07 13:55:53 -07:00
Mark A. Hershberger
671adf39db Remove i18n references to Popularpages
bug: T100676
Change-Id: I66002cbfb6b210fa08b57782665450b59439d17f
2015-06-15 17:48:52 -04:00
Liangent
ca38682dda LanguageConverter fix of empty and numeric strings
Bug: T51072
Bug: T48634
Bug: T53551
Change-Id: I2c88f1cf7c0014bebf5c798916b660b334a0b78b
2015-06-08 14:23:42 +00:00
Aaron Schulz
8194b2014b Deprecate $wgEnableParserCache
* There is little reason to disable it and one can set $wgParserCacheType
  if truly needed

Change-Id: Iec5fc7729d0f9de67ec2aa6c0e9c2c1e3e0d57ad
2015-06-04 19:23:03 +01:00
jenkins-bot
e36a953cc2 Merge "tests: Clean up file headers" 2015-04-01 22:27:33 +00:00
Subramanya Sastry
278c83af8b Sync up with Parsoid parserTests.
This now aligns with Parsoid commit ea9c04956577c35ec15609a966bf5a4d5541ab45

Change-Id: I310a0c652eb41a9845cfaa3c90262762b6ee4cc8
2015-04-01 15:08:10 -05:00
csteipp
125ed0e5ff SECURITY: Escape > in Html::expandAttributes
Escape > characters in attributes, so we don't confuse post-processing,
like LanguageConverter.

Bug: T73394
Change-Id: I768e2a12c7b6ba635e6c8571676b8c776b16bf72
2015-04-01 09:56:12 -07:00
Timo Tijhof
b4bac102b6 tests: Clean up file headers
* Remove redundant @licence/@license from test suite files.
  They already have full licence headers. And @licence raises a
  warning in Doxygen.

* Fix weird messes of comments inside comments and other things.

Change-Id: I38da8ca76330f72b8dc22b0ecf1ea69d5ea55ede
2015-04-01 00:17:12 +01:00
Bartosz Dziewoński
302e9e48f6 Parser tests for page status indicators
https://www.mediawiki.org/wiki/Help:Page_status_indicators

Change-Id: Ic461fe889a3f8ef9f332019f72cfb732c0ec1eca
2015-03-29 22:31:51 +00:00
Bartosz Dziewoński
5205405385 Emergency remove .mw-headline-anchor
Follows-up 6c7480e5f0, d2a6a73d2.

The should stop the § character from being indexed by Google et al.

Bug: T18691
Bug: T93000
Change-Id: Ie9e334e973e3ded270f1897a2c3816d9df739fc0
2015-03-17 22:31:45 +00:00
Arlo Breault
6b33e7fc21 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 9d213e1eb420bfd9ef6fbc661556b40c8aee32f6

Change-Id: Icb9de1ae26a7148fb0fe68840c5a9cfd45640560
2015-03-17 10:09:54 -07:00
Arlo Breault
78c3f2f4b1 Tidy up tidy usage
* There's a branch path in the sanitizer that depends on $wgUseTidy,
   which means the test output differs from on wiki.

 * In general, we should set these variables to match the wiki behaviour
   in tests.

 * Exposes T92892, Sanitizer removes empty tags when tidy is disabled.

 * Tweaked tests for T19663 to use an extension tag to show that
   HTML5 tags with non-word characters make it through the parser
   intact (before being ultimately sanitized).

Change-Id: I09c72fd739e11a8b757f37dc4c790758d782ad73
2015-03-16 16:33:50 -04:00
rillke
7ba745f854 Make PHP unit parser tests pass again after translation update
- sr-ec.json updated with 17607cf896

Change-Id: I7dfc9bcea2be85dd42d344858ce02246432f7fe1
2015-03-09 13:37:45 +01:00
Kunal Mehta
38abb23f9f Unbreak parser tests
Caused by f988ef004c, which would
have failed tests if l10n-bot hadn't self-merged.

Change-Id: I4674178f51c9b67bc057a84b06b3e4153857860b
2015-03-05 22:49:04 +00:00
C. Scott Ananian
75e29f5737 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 7608aeabdc1e47ce3dbfffd3ded85eecad647260

Change-Id: I4cb8f04b9d7988e5138c8f040fadeb0b7a9348f9
2015-03-02 17:53:16 -05:00
Bartosz Dziewoński
d2a6a73d29 Hide section anchor links from screen readers using aria-hidden
Hide from screen readers, as it is inside a heading (the programs use
headings to navigate, so the symbol is being read during navigation).
Pending T13555 being fixed.

See <https://phabricator.wikimedia.org/T18691#1076371> and
<https://phabricator.wikimedia.org/T18691#1076857> for reasoning.

Bug: T18691
Change-Id: I736cb7f52d5ce37eb7e8d3a3648ffd0bd40f2c83
2015-03-02 10:16:29 +01:00
Arlo Breault
24180b99d4 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 47ddba73a5f6078ac265f091d9c9e841c0fdead6

Change-Id: I07bd6edd2d62291f75bea79ab7825e390ccb314e
2015-02-26 20:38:13 -08:00
Brian Wolff
06c9f3ae7f Add srcset for images in <gallery>
Bug: T64709
Change-Id: I476beb6cf072c5a38570143d1f56baa3f49d23d4
2015-02-25 19:52:06 -04:00