Commit graph

461 commits

Author SHA1 Message Date
umherirrender
092cd8ee31 Fixed some @params documentation (tests)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: Ic8aaf0a93796b97d0fa4617c1f86ff59f4b36131
2014-04-17 20:43:42 +02:00
jenkins-bot
85d4e39ff0 Merge "Handle conflicting image format options in predictable way." 2014-04-15 16:50:38 +00:00
C. Scott Ananian
8079d4a7d1 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 207a3ba03b3a4371798c400092b76eb72b7034be

Change-Id: I4bd0ba7a2671104809ad26bc66d38c7e678fa7b6
2014-04-15 12:22:18 -04:00
C. Scott Ananian
079c3dda80 Ignore height as well as width for framed images.
This makes the PHP parser behavior consistent with the specification at
https://www.mediawiki.org/wiki/Help:Images#Size_and_frame which says:
"An image with frame always ignores the size specification."

This is actually a fix to File::getUnscaledThumb() -- which didn't
actually return an unscaled thumb if the 'height' parameter was set.

Bug: 62258
Change-Id: I0ce295a4681042c446314945da5f811448b44fe6
2014-04-03 14:56:55 -04:00
C. Scott Ananian
0f799ce2b2 Update set of files cleaned up after parserTests
The parser tests now include more generated thumbnails, so we need to
update the list of thumbnail files we clean up after a run.

Change-Id: Ibabab27ecb895a61f57fff265c8d6d3147666e0d
2014-03-25 14:41:23 -04:00
C. Scott Ananian
722f3bd7f9 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit b2e209c4d370a4a83f33bb1a9f6f7794e7fda3ca

Change-Id: I27e0373436cbfd16b1558ca2b2e998144b808f4b
2014-03-25 12:51:46 -04:00
umherirrender
2000672ac3 Fixed spacing
- Added spaces after if/foreach/catch
- Added new line before end of file
- Added or removed spaces before/after parenthesis, comma
- Added spaces around string concat

Change-Id: I0590070f1b3542108e242730e8d9a3ba9831e94f
2014-03-20 20:37:30 +00:00
jenkins-bot
e944f8bdf5 Merge "Allow setting default thumb size in parser tests" 2014-03-20 17:58:56 +00:00
C. Scott Ananian
e784f96a56 Allow setting default thumb size in parser tests
The mediawiki default thumb size is 180px.  The Parsoid default thumb
size is 220px, to match the default thumb size for most WMF wikipedias
(see https://bugzilla.wikimedia.org/show_bug.cgi?id=43336).

This discrepancy leads to inconsistent image-related test output.
Allow a test to set an explicit default thumb size with the
'thumbsize' option so that it is possible to write consistent tests.

Change-Id: Ib764d1f1660a50caaf8f0ff245822d1d1a1d264e
2014-03-20 13:40:16 -04:00
jenkins-bot
7e29aeb731 Merge "Update the documentation at the top of parserTests.txt" 2014-03-20 17:39:59 +00:00
Ladsgroup
16a5102765 Change URLs to mediawiki.org in comments to HTTPS
These are only documentation fixes
http://www.mediawiki.org --> https://www.mediawiki.org

Change-Id: I62ad42be1a3aac410cc53e98ce79389ceddd8988
2014-03-20 16:59:46 +00:00
C. Scott Ananian
f5d4ffd877 Update the documentation at the top of parserTests.txt
The meaning of the php/parsoid options changed slightly with
change Ie4e68960ca7c352af495ebb59ba83488935a44c4.  Update the
documentation comment at the top of the parser test file to match.

Change-Id: If0caac128704a15b824ccbcfbfb3f49812510f1d
2014-03-19 14:50:45 -04:00
C. Scott Ananian
bd2850d612 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 52b4e410acae520c1ecaed76efe062945b123187

Change-Id: I36ad89667817a94720fc0674cb39a5802d2c026c
2014-03-18 17:58:55 -04:00
C. Scott Ananian
083ec382c4 Handle conflicting image format options in predictable way.
The PHP parser now uses the first image format option that appears,
and ignores subsequent format options.  This enforces the "zero or one"
language in
https://en.wikipedia.org/wiki/Wikipedia:Extended_image_syntax#Type
and makes parser behavior more predictable.  This also matches Parsoid
behavior.

Change-Id: Ifa32238b3d274123c7b98022cf688c33edfd7197
2014-03-18 14:21:33 -04:00
C. Scott Ananian
eca4351d1f Parser tests: Make Foobar.svg consistent.
The parserTest.inc file created metadata saying that Foobar.svg was
240x180px, but created an empty SVG file; the DEFAULT_WIDTH and
DEFAULT_HEIGHT in includes/media/SVGMetadataExtractor.php would have
caused this to be treated as a 512x512px image.

In NewParserTest.php, a 200x200px image was created for Foobar.svg.

That caused inconsistent and confusing results for SVG-related parser
tests, depending on which of the testing frameworks you used.

Fixed both of these to use a consistent 240x180px image, since
non-square images are better for checking correct scaling.
(Parsoid has always used a 240x180px size for Foobar.svg).
The non-square image has caused three parser test results to
slightly change.

Change-Id: Ib60a7412d9be808a0995e94d3aa373f2c5ca9bad
2014-03-18 13:27:55 -04:00
umherirrender
4c81a710fa Fix formatting of some php docs
php docs of functions should have newline in it and not in one line.

Change-Id: If4a29aefb46a7f73d75593814e597fdb792d5470
2014-03-15 20:49:55 +00:00
C. Scott Ananian
e0e5893969 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit d6ebbd78101c6191e213e46838582d00f37c3bbb

Change-Id: I4fd04ac2bf4cd7a4fc195ad615e9940f4ddb29a5
2014-03-14 13:41:19 -04:00
Arlo Breault
23aadb06dc Allow more-descriptive section names for parserTests
This patch allows `!!wikitext` (for `!!input`) and `!!html` (for
`!!result`). This is more in line with what those sections actually
contain and closer to the semantics of how they are used.

The old names are accepted as aliases to accomodate parser tests to
provide a migration path for extensions and other users of the
parser tests framework.

In addition to `!!html`, this patch also accepts `!!html/*` and the
more-specific `!!html/php`.  This allows tests to include a number
of different "outputs" for a given wikitext input, for example
`!!html/parsoid` and `!!html/php`.

Co-authored-by: C. Scott Ananian <cscott@cscott.net>
Co-authored-by: Arlo Breault <abreault@wikimedia.org>
Change-Id: Ie4e68960ca7c352af495ebb59ba83488935a44c4
2014-03-12 12:07:56 -04:00
C. Scott Ananian
0e0ffe4d17 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 5a274b028d774784d514439f4539507e52c8e05e

Change-Id: Ie2699166ac378f758145d41d727b18f8fa6072b4
2014-03-05 14:51:56 -05:00
Danny B
43bf02c953 code-quality: Special:PrefixIndex is transcludable
Replacing 'id' attribute with 'class' to prevent pages' HTML from
becoming invalid due to using the same id.

Change-Id: Ibf561318a5005424e8920e693a62ccdb05bbd765
2014-03-05 13:15:45 +01:00
C. Scott Ananian
312b0ca106 Support >2 and JSON-formatted options in parser tests.
The parserTests options handling had a regex capture bug which caused
it to discard all but the first and last option values.  Fix this (by
separating value splitting from key/value capture).

Add support for JSON-valued options, which parsoid would like to begin
using.  Add support for backslash escapes in quoted strings.

Change-Id: I69323bb44b7a481bad6f490d0773a984239c0b9c
2014-02-19 07:50:47 -10:00
Gabriel Wicke
dfd85d2f3d Add Reference to relevant bug in new MSIE 6 CSS sanitization tests
Change-Id: Ie0bac33e9012d2d36242f31839a73cc848a40eba
2014-01-14 16:22:11 -08:00
csteipp
93891d1b5d SECURITY: Disallow -o-link in styles
Opera will execute javascript from -o-link css attributes.

Bug: 58472
Change-Id: I3b640282ca1feeb175b095e9fdc4dc3ceff05e0f
2014-01-13 22:12:28 -08:00
umherirrender
cf5cb9b79a Raw option of parser functions should match complete word
The MagicWord raw was not matched against the whole given string, which
result in a raw output, when this was not intented.
Fixing this by adding a new regex, which matches the string from start
to end.

Bug: 56199
Change-Id: I7781c415bd61447dd91872575877dd21f36fae9f
2014-01-12 22:25:33 +00:00
Subramanya Sastry
f52f3db653 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 97bb35b73a4e4779b9be0bf2aedc351f539b0a0d

Change-Id: Id9e18cd6f33c6f71d0dfb57bd854a98d81b5ad84
2014-01-02 15:02:10 -06:00
Aaron Schulz
2aa84651ca filebackend: cleaned up the FileBackend constructor
* Added some b/c code with deprecation warnings

Change-Id: Ifceffbc0a37a223bcd7cd3dc60181fc85765bc46
2013-12-03 13:57:01 -08:00
Aaron Schulz
2f29c7551b Revert "filebackend: cleaned up the FileBackend constructor"
Actually this messes with the implicit backend made for things like Math (when unconfigured), which uses the "new" operator.

This reverts commit 1f129a22cb.

Change-Id: I4c72c4f7c8b82e38df5496cf2b90fc9e19c40334
2013-12-03 20:40:24 +00:00
Aaron Schulz
1f129a22cb filebackend: cleaned up the FileBackend constructor
* Moved some of the graph construction work to FileBackendGroup.
  This helps the code in not depending on the rest of MW so much.
* Updated tests and FileBackendMultiwrite, which are the only things
  directly constructing FileBackend objects.

Change-Id: I188a053c70ce088ce34613d5db40e6708e3ea9b7
2013-11-23 20:21:53 -08:00
csteipp
feb23b469f SECURITY: Improve css javascript detection
* Forbid vertical tabs
* Convert Fullwidth, sup/sub script, IPA, and repetition unicode to
ascii, for ie6

Bug: 55332
Change-Id: I41a71b5b8fbecadd0f958cf57cc90d4c2fd9366e
2013-11-14 14:32:51 -08:00
jenkins-bot
584775e59d Merge "Add parserTests for language converter markup." 2013-11-07 16:39:56 +00:00
Subramanya Sastry
5e558e6590 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 325c6e5a47a6b3bf7a26778e534c8acabaca0058

Change-Id: I5c7cf9186197c49de449784265ffd8b0bb2bbb2c
2013-10-31 11:53:59 -05:00
jenkins-bot
8cabb5f777 Merge "Make TOC hideable" 2013-10-24 19:22:32 +00:00
addshore
17c1e91238 General cleanup of Parser tests
- Fixes scope
 - Adds covers tags

Change-Id: I6024f2f7cc7a1812a417c6c389b0a15addde0b5e
2013-10-23 12:26:15 +00:00
Kevin Israel
940fb88ba4 Parser::replaceInternalLinks: fix batching
The parser unnecessarily made individual checks for existence of
pages that were neither in LinkCache nor linked only with a fragment.
A Title::isKnown() call in Parser::replaceInternalLinks2() (added in
bca8b8ad7d) caused this.

Title::isKnown() was used to avoid treating a link to a distinct page
as a self-link even when the title happened to match one of the variants
returned by Language::autoConvertToAllVariants(). This change fixes
the bug by moving the problematic portion of the self-link check into
LinkHolderArray::doVariants().

Change-Id: I586e11e8b47308980ea04087ebc4246c397a8f53
2013-10-23 05:48:24 +00:00
Erwin Dokter
34bd573144 Have list items occupy their own line
Ensures that HTML list items are on their own line, which fixes a
CSS issue with .hlist; it depends on a breakable character between
list items, and a newline does provide one. Should also unburden
HTML Tidy, as output now matched that of Tidy.

Bug: 39617
Change-Id: I82fb4d749a200cfc049b30d2ee6e96a5ff7574e2
2013-10-19 19:45:18 +02:00
Max Semenik
21c1c7d025 Make TOC hideable
Currently, if an extension doesn't want a TOC, it has to remove it manually.
This change wraps the TOC in markers that make it easy to remove it in ParserOutput
on demand without fragmenting the parser cache with stuff like "use/not use TOC".

Change-Id: I2889bcb9eb999c9049601e92440132118e1a8a41
2013-10-18 17:47:47 +04:00
C. Scott Ananian
bc97a03f06 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 3d6d0723f93e2a838df717b5036e5cd6b0345eca

Change-Id: Iadc98cc4cc33c7725e5fbf4a16df7e1a898aee80
2013-10-03 10:53:32 -04:00
C. Scott Ananian
0d2c4c4d61 ParserTests: allow test of precedence between interwiki links and namespaces
Bug: 51680
Change-Id: I8ad82c596139824fb97d513a62513edf2941b958
2013-10-02 16:11:33 -04:00
C. Scott Ananian
e450b18e09 Sync up with Parsoid parserTests.
This now aligns with Parsoid commit 8da66db733e02a5a886a62075ab9d9e9c6db6e3a

Change-Id: I0b429b4affbacb4ed97718bce8ba9c886d268216
2013-09-16 16:14:48 -04:00
C. Scott Ananian
336d746523 Make line breaks in <blockquote> behave like <div> (bug 6200).
This is an old, old bug: the earliest filed dup is bug 1857, on 2005-04-10.
See bug 51086 for a modern discussion, and bug 52763 for some non-obvious
consequences: indented text inside a blockquote must not trigger
creation of a <pre> block (unlike <div>).

This patch should bring the PHP parser and Parsoid closer together.

This also fixes (or works around) bug 15491, which is really a bug in tidy.
But because <blockquote> content is typically wrapped with <p> tags now,
we don't trigger the tidy bug (see
https://bugzilla.wikimedia.org/show_bug.cgi?id=15491#c7 for details).

Credit to Aryeh Gregor (https://bugzilla.wikimedia.org/show_bug.cgi?id=6200#c8)
and Vitaliy Filippov (https://bugzilla.wikimedia.org/show_bug.cgi?id=6200#c37)
for almost-correct patches for this bug, which saved me a bunch of effort.
Thanks to Subramanya Sastry for pointing out bug 52763 and preventing a
bunch of broken articles on enwiki.

Bug: 6200
Bug: 15491
Bug: 52763
Change-Id: I3696d4ab7b8ad6ebccf8483d6da1722353c1697d
2013-09-12 08:09:23 -07:00
kaldari
e517e9be57 Removing all disambiguation code from core
Disambiguation related functions have been re-implemented in the
Disambiguator extension.

Bug: 35981
Change-Id: I4afa30bf2677c6541ef355013f8eaef46abfbe03
Dependency: I41637ea43a9e5000bcb8a782441ce36f1068881f
2013-09-05 14:07:51 -07:00
jenkins-bot
7e06997959 Merge "Clean up parser test's InterwikiLoadPrefix hook" 2013-08-26 16:10:50 +00:00
umherirrender
24bfde2710 Fix spacing and break some lines
Change-Id: Ia57685d8858e02e399ad5c75ce64d12609d340ac
2013-08-24 17:06:25 +02:00
Brad Jorsch
7b08f602dc Clean up parser test's InterwikiLoadPrefix hook
Change I36865e38 adjusted the parser test class to hook
InterwikiLoadPrefix, and prevent any other uses of that hook. Which is
ok, except it doesn't clean up after itself so it winds up breaking any
other parser tests that use the same hook.

Change-Id: I351a56ac39a44721d427e9c980eaf5fff246fb57
2013-08-22 14:42:45 -04:00
C. Scott Ananian
2305dbbd2a Sync up with Parsoid parserTests.
This now aligns with Parsoid commit bf60ad87877b573c9db813fe56f38842e2c52a3d

Change-Id: I9647d5010e06263a31970d8c168667af56c75b77
2013-08-16 14:43:54 -04:00
jenkins-bot
59c2b1de3f Merge "Add a parserTest documenting interaction of tabs and preformatted text." 2013-08-16 18:08:02 +00:00
C. Scott Ananian
d27cce60f3 Add parserTests for language converter markup.
This test demonstrates a bug with image link, list item, and table cell
parsing when language converter markup is present.

The test is disabled until the bug is fixed.

Bug: 52661
Change-Id: I2da85ab6ba58639d6959f1abb41461c76b3bf177
2013-08-16 13:14:17 -04:00
C. Scott Ananian
5b1f26b7b1 Add parserTests for the interaction of italics and possessives.
Bug: 49926
Change-Id: I9756a1fb0bd583e6a4495ef28c3c159492dad871
2013-08-16 12:42:55 -04:00
C. Scott Ananian
a8448c557d Add a parserTest documenting interaction of tabs and preformatted text.
Tabs are apparently used this way on the front page of plwiki.

Change-Id: I0a65d5a9783071e91696ed2b96887f44199a999d
2013-08-16 12:16:15 -04:00
Brian Wolff
14b3f8767b New more slick gallery display
This extension adds a "mode" parameter to the gallery
tag, allowing different formats for the gallery tag
(galleries in the ui can be controlled by a global)
The added modes are:
*traditional - The original gallery
*nolines - Like the original, no borders, less padding
*packed - All images aligned by having same height.
  JS also justifies the images.
  (I think this one is the one that will go over best
  with users.)
*packed-overlay - like packed, but caption goes over
  top the image in a transloucent box.
*packed-hover - like packed-overlay, but caption only
  visible on hover. Degrades gracefully on screen
  readers, and falls back to packed-overlay if
  you are using a touch screen. I kind of like
  this mode when the caption is not that important
  (ex a category where its just the file name).

This also adds a hook to allow people to make their
own gallery version. I believe there would be interest
in this, as different people have done different
experiments. For example:
* Wikia: http://community.wikia.com/wiki/Help:Galleries,_Slideshows,_and_Sliders/wikitext
* Wikinews: https://en.wikinews.org/wiki/Template:Picture_select

What I would like to see for this patch, is first it gets
enabled, with the default still "traditional". After
about a month or two we consult with users. If feedback
is positive, we change the default mode to one of the
others (probably "packed").

Adds a "mode" parameter to gallery for different
mode, including one 'height-constrained-overlay'
which looks much more like other modern websites.

Note: This makes one change to the old gallery format.
It makes Nonexistent files be rendered like thumbnails
(i.e. they are rendered with a little grey border).

One thing I'm slightly worried about with this patch,
is that I added an option to MediaTransformOutput::toHtml
to override the width attribute. I'm not sure if that
is the best approach, and would appreciate thoughts
on that.

This should be merged at the same time as Ie82c1548

Change-Id: I33462a8b52502ed76aeb163b66e3704c8618ba23
2013-08-14 20:56:05 -03:00