Commit graph

58 commits

Author SHA1 Message Date
Dan Collins
9846e2558c (bug 27936) Improve parser handling of nested braces.
Parser tests also included, test case and original patch supplied by
Bergi on bugzilla. Tested against the current version.

Change-Id: Id7ec4e694783dd0f682f65f39d8b9e59f82e58aa
2013-02-06 03:39:07 +00:00
umherirrender
570dda0455 fix some spacing
Change-Id: I88e73d47a552918880514d88a876296a6cb80d88
2013-02-04 20:09:18 +00:00
Siebrand Mazeland
d4b046a893 Update docs for return and exception info
* Removed some inline tabs in the process.
* IDE fixed some incorrect leading spaces, too.

Change-Id: Ic9303eff6db4424ac3f1fa2816839692b43e6190
2012-10-09 09:41:58 +00:00
Aaron Schulz
5f5ba94b06 Merge "store text length in local var in Preprocess::processToObj/Xml" 2012-08-15 00:22:10 +00:00
umherirrender
80cc857fc1 store text length in local var in Preprocess::processToObj/Xml
The $text is constant and that means, the length of $text is also
constant, store it in a local var is easy than.

Change-Id: I9631b862f40eef7f8b18559ffd474a0037077d18
2012-08-06 13:41:28 +02:00
umherirrender
91c3d5c6c5 Fix wrong return value in Preprocessor::getChildrenOfType
I am not sure, but this looks wrong, because it adds the type to the
array and not the child.
This method is unused in core and wmf extensions, maybe
removing/deprecating is a better idea, but I am not sure, if that is
possible.
I have only see this possible error, while looking through the
preprocessor.

Change-Id: I5b7492d455989a8a3e71b5db6d31091b986c502a
2012-08-05 22:14:45 +02:00
Antoine Musso
aab43dd495 escape tags and entity in doxygen comments
When inserting XML elements inline <such as this one>, doxygen chokes
about it not being known. Simply enclosing the tag in double quotes
prevents doxygen from emitting a warning.

Also enclosed a few invalid functions calls such as \. and double quoted
the HTML entities such as &foobar;

Change-Id: I4019637145e683c2bec3d17b2fd98b0c50a932f1
2012-07-10 17:08:32 +02:00
Tim Starling
7fc5234cbe Scribunto parser support
Add $indexOffset parameter to PPFrame::newChild(). This makes it
possible to use newChild() for interpreting named parameters to
invoke in Scribunto -- otherwise I would have had to duplicate its
functionality, which would have been tricky given that I wanted to
make a real frame with an expand() method. Setting $indexOffset allows
newChild() to start counting numbered parameters from somewhere other
than the first pipe character, leaving room for the Scribunto function
name.

Fixed PPCustomFrame_*::getArguments(), was missing for no apparent
reason. I didn't end up using it in Scribunto, but there's no harm in
adding it anyway.

Change-Id: I0c761aab8a7f1ae74e8d151a1346febb5c466e18
2012-05-22 13:53:41 +10:00
Reedy
2df7fae395 Add/update function level parameter documentation
Change-Id: I148b84e3b81c29c63585f3bf524fc445fd7683a7
2012-05-15 00:44:25 +01:00
umherirrender
e5614cea2c Show Highest expansion depth in limit report
With 1.20wmf2 we get a tracking category with all the problem pages,
seeing the limit for a page is a helpful information than

Change-Id: I1916e5fa6de06b923a01cf1f0ca9362287a9fd70
2012-05-04 22:44:14 +02:00
Alexandre Emsenhuber
0fc8c8e14e Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I10c077f27a2077a266a64048fa137f7b1f8e226c
2012-05-01 09:05:48 +02:00
umherirrender
069a4b2280 (bug 22887) Add warning and tracking category for preprocessor errors
I have only add things and not change the current error strings to
messages, because bug 21521 is WONTFIX

Change of Preprocessor_HipHop.php is not tested

Change-Id: I7a7243b8ba010dbb395bdbbb3e00e3217088038e
2012-04-27 16:16:35 +01:00
Christian Aistleitner
0954fc366f Sanitizing already existing use of PHP's assert 2012-03-19 11:14:43 +00:00
Sam Reed
85bbb0b080 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 18:01:10 +00:00
Brion Vibber
d60063eac2 Revert r103795 -- adds <dws> pseudotag which modifies preprocessor behavior in some way to eat whitespace
Not sure whether this is something we want, but it should probably be talked over first.
2011-11-23 00:30:13 +00:00
Mark A. Hershberger
5bd4f88169 Fixes Bug 31865 - Tag <dws> for discarding whitespaces.
Patch with parser tests from Van de Bugger
2011-11-21 01:45:23 +00:00
Sam Reed
2849f384d4 Bug 31995 - Addition of PPFrame::getTitle
Applied patch by Van de Bugger

Added documentation to go with

Added code to Preprocess_HipHop too
2011-11-09 20:52:24 +00:00
Sam Reed
937fc3bcfd Back out r95396 and friends 2011-09-29 22:08:00 +00:00
Aaron Schulz
23d5a27e2e Reverted r86072, r86419 per CR. Lots of conflicts resolved here. Removes lineStart from r87346 code as well for preprocess parser tests. 2011-09-12 19:16:22 +00:00
Sam Reed
44020e254c Merge the iwtransclusion branch back into trunk
Hexmode fixed broken unit tests in revisions after last time
2011-08-24 13:03:03 +00:00
Sam Reed
183d2dab37 Back out r93533, r93531, r93530
Breaks unit tests as below, not going to be able to fix them before I disappear for the evening, so might aswell leave trunk clean

ArticleTablesTest testbug14404

Error:
ArticleTablesTest::testbug14404
Undefined offset: 0

/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/includes/ArticleTablesTest.php:31
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiTestCase.php:60
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiPHPUnitCommand.php:20
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/phpunit.php:60

ParserTests testParserTest #552 - testParserTest with data set #551

Failure:
ParserTests::testParserTest with data set #551 ('RAW magic word', '{{RAW:QUERTY}}', '<p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
</p>', '', '')
RAW magic word
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-<p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
+<p><a href="/index.php?title=Template:RAW:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:RAW:QUERTY (page does not exist)">Template:RAW:QUERTY</a>
 </p>

/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/includes/parser/NewParserTest.php:545
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiTestCase.php:60
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/MediaWikiPHPUnitCommand.php:20
/home/ci/cruisecontrol-bin-2.8.3/projects/mw/source/tests/phpunit/phpunit.php:60
2011-07-30 15:56:54 +00:00
Sam Reed
dc9d39887e Merge iwtransclusion branch into trunk 2011-07-30 15:30:01 +00:00
Brion Vibber
b9995d5583 Provisional revert of r89648: "Another try at fixing bug 93 "tilde signatures inside nowiki tags sometimes get expanded (<includeonly><nowiki>~~~~</nowiki></includeonly>)""
This seems to disable PST for <includeonly>...</includeonly> in addition to the <includeonly><nowiki>...</nowiki></includeonly> that the bug is about.
This was caught by a parser test case, but the test case was changed to match... seems like the wrong change?

Also failed to update Preprocessor_HipHop.hphp to match the other two preprocessor classes.
2011-06-07 17:34:20 +00:00
Paul Copperman
27b5141563 Another try at fixing bug 93 "tilde signatures inside nowiki tags sometimes get expanded (<includeonly><nowiki>~~~~</nowiki></includeonly>)"
* Change the preprocessor to insert strip items for <ignore> nodes during pre-save-transform, just like <comment> nodes are handled already. This effectively disables all pre-save-transform steps inside <includeonly> tags.
* Adapt parser tests to the new behavior.
2011-06-07 15:12:26 +00:00
Brion Vibber
96a947fc7a Revert r88997: fix for bug 93 caused some additional problems.
Follow-up to r89191: disable test case for bug 93 as it currently fails (bug left open).
2011-06-02 00:32:43 +00:00
Sam Reed
527e85fa9f More documentation in various files 2011-05-29 14:01:47 +00:00
Mark A. Hershberger
bb8fbba7b3 fix for Bug #93 “tilde signatures inside nowiki tags sometimes get expanded (<includeonly><nowiki>~~~~</nowiki></includeonly>)”
Patch from Brad Jorsch

Fix for includeonly case.  Hopefully fixing this ancient bug doesn't
‘cause people to cry
2011-05-27 20:55:02 +00:00
Sam Reed
ebef5e723b More documentation tweaks/additions 2011-05-26 19:52:56 +00:00
Mark A. Hershberger
1cc7a162c0 Updated patch from Bergi re: r86676 with tested code to fix bug #28642 2011-04-22 14:25:17 +00:00
Leo Koppelkamm
b4ec34def9 Followup to r86064 (List with double line-breaks inside tables). Also contains patch for Bug 16700 by Mormegil (Additional linebreak though nested templates). Parsertests for both 2011-04-14 19:28:45 +00:00
Tim Starling
4431b79a68 Fixed fatal error in Preprocessor_Hash due to r82645 2011-02-28 02:40:39 +00:00
Sam Reed
593f98ff2e More member variable documentation 2011-02-24 17:04:49 +00:00
Sam Reed
ccffe43a91 Add a couple of type hints noticed when poking bug 27673 2011-02-24 11:59:51 +00:00
Tim Starling
a20350dd31 * Rewrote StripState to not use ReplacementArray. The memory usage of FSS was excessive when there were many (>10k) strip items. I used preg_replace_callback(), which is slower than strtr() in the simplest case, but much faster than it when the markers have different lengths, which they usually do.
* It was not necessary to preserve the $stripState->general->setPair() interface since it wasn't used by any extensions.
* Moved StripState to its own file.
* Refactored serialiseHalfParsedText() and unserialiseHalfParsedText() so that the bulk of the functionality is in the relevant modules, instead of using scary direct access to object member variables. Made it support the new StripState. It seemed like a lot of work to go to to support an "emergency optimisation" feature in Cite. Cite updates will be in a subsequent commit.
* Fixed spelling of serialiseHalfParsedText() and unserialiseHalfParsedText(), there is unavoidable interface breakage anyway, due to cache object versioning. 
* Moved transparent tags to their own function, as requested in a fixme comment.
* Added documentation for markerSkipCallback().
* Removed OnlyIncludeReplacer, unused since MW 1.12.
2011-02-23 06:58:15 +00:00
Sam Reed
7d98280f3e More function and variable documentation 2011-02-19 01:02:56 +00:00
Platonides
6e7632e617 Allow to disable the preprocessor cache with $wgPreprocessorCacheThreshold = false 2011-01-13 17:35:54 +00:00
Platonides
e22cd590e0 Improve a preprocessor comment 2011-01-13 17:30:27 +00:00
Mark A. Hershberger
2e18112d60 Whitespace changes (before others) — “svn diff -x-w” shows no changes 2010-12-11 03:52:35 +00:00
Sam Reed
6b3b915353 Big attack on unused variables... 2010-10-14 20:53:04 +00:00
Platonides
52e275003a Code cleanup: unused globals, empty statements, typos... 2010-09-11 21:55:21 +00:00
Alexandre Emsenhuber
dc50e1a4bf * Added file description headers
* Added @file where needed
2010-08-22 14:31:05 +00:00
Sam Reed
380b6725d5 Remove some unused variables
Move variable in languages/classes/LanguageKu.php into commented code (used in comment)
2010-08-13 20:58:16 +00:00
Platonides
9c143c5900 Use ParserOptions accessors.
Only one direct usage remains, in ParserCache::getKey, which will be rewritten.
2010-08-05 19:01:47 +00:00
Sam Reed
f17a158fea Replace self with PPFrame to define proper location of some constants 2010-07-29 07:20:02 +00:00
Sam Reed
f4f5d17105 A few more wrong static things
Remove some =& from LanguageKk_cyrl
2010-07-25 21:15:27 +00:00
Conrad Irwin
91f6526cfd (bug 19910) Preprocess headings of the form "===+\s+" in the same way as Parser::doHeadings() 2010-06-21 20:33:07 +00:00
Daniel Kinzler
b9febe4161 added newPartNodeArray for creating a node with a list of parts form a php array; useful for programatically constructing template parameters 2010-06-10 15:16:15 +00:00
Alexandre Emsenhuber
1ec45bef2e Fixed some doxygen warnings 2010-06-09 14:57:59 +00:00
Tim Starling
4b13d6b07f Applied patch by Juliano F. Ravasi for bug 20431: constructor for PPCustomFrame_* failed to initialise the object properly. 2009-09-04 00:43:51 +00:00
Victor Vasiliev
1671616088 Add getArguments, getNamedArguments and getNumberedArguments methods to PPFrame
interface, so extensions can access them.
2009-07-02 16:21:30 +00:00