Commit graph

446 commits

Author SHA1 Message Date
Alexandre Emsenhuber
759707959c We have startParse() for that 2011-08-11 13:57:15 +00:00
Sam Reed
3023c3053a Add documentation
Minor whitespace/brace additions
2011-08-05 00:33:03 +00:00
Sam Reed
8e062ead64 * (bug 17119) class Parser: senseless use of non-existing regexp back reference
Patch made by Dan Collins,, based on text placed by "seth"
2011-08-04 22:20:52 +00:00
Alexandre Emsenhuber
93075f0af3 Per Platonides, follow-up r93758: rename ParserOutput::addOutputPage() to ParserOutput::addOutputPageMetadata() to match its behaviour 2011-08-02 16:31:22 +00:00
Platonides
76e7c63bff Follow up r93633. Allow only classic spaces. 2011-08-02 16:23:46 +00:00
Alexandre Emsenhuber
700aec3775 * (bug 15558) Allow includable special pages to be parameterized using wiki syntax
* Changed SpecialPageFactory::capturePath() to take the same parameters as SpecialPageFactory::executePath() (except the last one) and made it always return a bool instead of bool-or-string. The result HTML can be fetched from the OutputPage object of the context.
* Added module styles, scritps and messages members to ParserOutput in addition to modules. The first one is needed to display Special:RecentChanges correctly when transcluded since EnhancedChangesList::beginRecentChangesList() calls addModuleStyles( 'mediawiki.special.changeslist' )

Yes, this means that you can use {{Special:Recentchanges|enhanced=0}} to use the old changes list. For the ones that wonder, {{Special:Recentchanges|uselang=something}} will not work since the Language object is forced to the one used by the parser.
2011-08-02 15:40:03 +00:00
Mark A. Hershberger
507edf6873 Fixes Bug #30149 - Handling of parentheses for Korean, Chinese and Japanese
Adapts the pipe trick with parens for fullwidth parentheses.  Adds parsertests.

Patch from Dan Collins.
2011-08-01 17:37:25 +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
Antoine Musso
176f91596c Unicode space separator characters (Zs) now terminates links
Fix 19052 which was only reporting the issue for U+3000 IDEOGRAPHIC SPACE.
Covers both external links and images links. See parser tests for examples.

Unicode 'Zs' includes all characters from the 'separator, space' category.
Characters part of this category are:

Char    Name
U+0020  SPACE
U+00A0  NO-BREAK SPACE
U+1680  OGHAM SPACE MARK
U+180E  MONGOLIAN VOWEL SEPARATOR
U+2000  EN QUAD
U+2001  EM QUAD
U+2002  EN SPACE
U+2003  EM SPACE
U+2004  THREE-PER-EM SPACE
U+2005  FOUR-PER-EM SPACE
U+2006  SIX-PER-EM SPACE
U+2007  FIGURE SPACE
U+2008  PUNCTUATION SPACE
U+2009  THIN SPACE
U+200A  HAIR SPACE
U+202F  NARROW NO-BREAK SPACE
U+205F  MEDIUM MATHEMATICAL SPACE
U+3000  IDEOGRAPHIC SPACE


TEST PLAN:

$ php parserTests.php --quiet
This is MediaWiki version 1.19alpha (r93258).

Reading tests from "tests/parser/parserTests.txt"...
Reading tests from "tests/parser/extraParserTests.txt"...
Reading tests from "../mwexts/LabeledSectionTransclusion/lstParserTests.txt"...
Passed 686 of 686 tests (100%)... ALL TESTS PASSED!

Sounds good :-)
2011-07-27 18:03:01 +00:00
Sam Reed
896f05efde Trim trailing whitespace
Add documentation

Remove unused variables

Remove an extract from ImageFunctionsTest
2011-07-24 21:36:04 +00:00
Ian Baker
64a8dd2094 Refactored section assembly code to be more readable
Added a hook that's called for each section.  This allows sections to be addressed separately at the document level, for example by wrapping each in a div (as in the reverted r50769).  This in-turn enables richer section-specific UI, like highlighting or in-line editing.
2011-07-18 23:23:14 +00:00
Roan Kattouw
ec7101610c Fix r14202 (!!): this validates the protocol against the regex for the second time (preg_split has already made sure it matches wfUrlProtocols() so no need), and uses strpos() to validate against a regex (that's just wrong). I'm removing it not because it's useless but because it breaks for URL protocols that don't contain a ':' ('//' in my case) for no reason at all. Found out about this when writing parser tests for it (will commit these in a minute), so yay tests! 2011-07-12 20:55:05 +00:00
Bryan Tong Minh
e9e0bf8cc1 Follow-up r88054: register the file if a hook changed the target file. 2011-07-09 10:31:09 +00:00
Roan Kattouw
4b36056ac9 (bug 29497) To support protocol-relative URLs in external links, add '//' to $wgUrlProtocols and remove a useless \b in the bracketed external link regex in the parser that prevented the former from working outright. With this change, things like [//example.com/wiki/Foo Bar] are now supported, and [[{fullurl:Foo|action=edit}} Bar] no longer breaks if $wgServer is set to '//example.com' but produces a protocol-relative link instead. Protocol-relative URLs in free text are not picked up and turned into [1] links like URLs with protcols are; this is probably due to another \b somewhere, but I think this is a good thing. 2011-07-07 18:26:24 +00:00
Platonides
66f193da79 $wgContLang no longer used here 2011-06-29 13:23:51 +00:00
Robin Pepermans
6bc8739f6f Follow-up r90742: the parser should call getFunctionLang() 2011-06-27 23:58:46 +00:00
Robin Pepermans
d761eab349 Make parser->getFunctionLang be dependent on title->getPageLanguage() instead of $wgContLang, i.e. the page content language instead of the wiki content language. This sets the right language on page view + edit for all pages, instead of only edit preview on MediaWiki namespace pages (as in EditPage.php). 2011-06-26 22:58:27 +00:00
Robin Pepermans
9f9047290f Directionality and language improvements as part of bug 6100 (under $wgBetterDirectionality):
* Make TOC numberings be in the page content language instead of wiki content language.
* Update getPageLanguage() and add a hook (for bug 9360/28970).
* Show redirects (when viewing a page with &redirect=no) in the user language direction (not essential but nicer imo).
2011-06-24 22:10:39 +00:00
Aaron Schulz
335b921b2b * Removed break in first loop of generateTableHTML(), which caused:
'<b>Notice</b>: Undefined index: type in <b>C:\wamp\www\MW_trunk\includes\parser\Parser.php</b>
* Made some code simplifications
2011-06-24 20:25:16 +00:00
Sam Reed
1682c80f1f Followup r85596, recursiveTagParse returns a string, not a parser output object 2011-06-23 09:26:48 +00:00
Alexandre Emsenhuber
44574b23b0 Removed hidden usage of $wgTitle in parser and the workarround in ExtraParserTest.php 2011-06-22 17:45:31 +00:00
Sam Reed
ee5922ccf6 Expand return documentation for r84357 2011-06-20 13:57:22 +00:00
Sam Reed
16842c0b73 Swap else if for elseif
Trimming trailing whitespace also

Doing in 3 commits (2/3), so hopefully reviewable in CR...
2011-06-17 16:05:05 +00:00
Alexandre Emsenhuber
e976326343 Per Nikerabbit, fixes for r89176:
* correct variable name in preprocessorFuzzTest.php
* Added type hints in Parser's test methods
2011-06-14 15:08:52 +00:00
Alexandre Emsenhuber
6582de54f3 Replace the text directly instead of using the StripState object since it will be unstripped just after the call replaceTransparentTags(), but left the call unstripGeneral() for the benefit of Poem extension that use it to escape the <br /> tag 2011-06-05 19:37:08 +00:00
Brion Vibber
443366b11b Provisional revert of r89230: per CR, benchmarking currently shows that it makes things slightly slower, not faster
http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89230#c17571
2011-06-03 22:27:38 +00:00
Krinkle
439a38eca2 typo from r78201 2011-06-03 01:04:24 +00:00
Platonides
f5f020c3aa The big regex at doMagicLinks deserves being more thoroughly studied. 2011-05-31 21:52:39 +00:00
Jeroen De Dauw
8dc1a86b0c this method should not be private? the parser function docs use it as public 2011-05-31 17:19:11 +00:00
Tim Starling
67099169ad * Use Preprocessor_Hash by default in compiled mode, it is faster
* Don't profile MagicWord::get(), it is very fast and the profiling overhead was excessive. Profile MagicWord::load() instead.
2011-05-31 06:10:23 +00:00
Alexandre Emsenhuber
c58ef2b85b * make preprocessorFuzzTest.php pass the Title object to Parser, removed checks for non-object in Parser
* make the parser use ParserOptions::getUser() instead of $wgUser
* fixed some E_NOTICE and E_STRICT in preprocessorFuzzTest.php
2011-05-30 16:10:23 +00:00
Happy-melon
16ea3e3f82 Rv r84022 for now: crashes PHP on large url strings (bug29197), which is a nasty DOS vector. Leaving the parser tests in because this should definitely be fixed and reimplemented... 2011-05-29 09:32:17 +00:00
Sam Reed
3614ecfffb And more documentation. Yaaaay 2011-05-28 17:18:50 +00:00
Sam Reed
ebef5e723b More documentation tweaks/additions 2011-05-26 19:52:56 +00:00
Sam Reed
696100b6a9 Remove unused variables/globals
Swap while to foreach
2011-05-26 19:20:35 +00:00
Mark A. Hershberger
0a49fd69b0 Misc EOL w/s and spaces-instead-of-tabs fixes. One day I'll get around to nagging people for this stuff, but for now, I'll JFDI myself. 2011-05-25 15:39:47 +00:00
Aaron Schulz
fc37a9625a * Follow-up r88740:
* Fixed parse() arguments in getRevIncludes()
* Changed clearTagHook() to avoid preprocessed-xml cache corruption
* Check current version cache in getRevIncludes()
2011-05-25 10:11:06 +00:00
Aaron Schulz
6d409c1308 Follow-up r88740: forgot to commit this guy 2011-05-24 19:52:27 +00:00
Chad Horohoe
3e11266ae5 $wgArticle is deprecated! Possible removal in 1.20 or 1.21!
* Encapsulate index.php in wfIndexMain() (similar to r77873)
* Kill $wgArticle check in Exception, not necessary anymore
* Kill $wgArticle in Setup, also not necessary
* Add angry note about $wgArticle to rebuildFileCache.
* Remove note about $wgArticle in Parser since it's dying anyway
2011-05-22 17:59:47 +00:00
Siebrand Mazeland
75c6696aa8 Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely. 2011-05-17 22:03:20 +00:00
Platonides
cec4972e31 Profile brace substitution per title to help detect the "bad templates". (Make this configurable?) 2011-05-15 12:40:32 +00:00
Bryan Tong Minh
41231616b6 (bug 23002) Imagelinks table not updated after imagemove. The actual bug was inconsistent behaviour between imagelinks and pagelinks for redirects.
* Parser now only adds the redirect source to imagelinks, like it does in pagelinks
* ImagePage now shows the file redirects in-line with the normal "The following pages link to this file:"
** Added message linkstoimage-redirect
** Removed the separate file redirects section and removed associated message redirectstofile
** ImagePage::imageLinks will first fetch image links to the file, determine which are redirects, and if there are fewer links than the limit, fetch the redirect target links.
2011-05-14 12:20:45 +00:00
Sam Reed
f985524076 More versions added to @deprecated tags
Couple of inbound calls fixed up

Some ancient code removed as it's been marked deprecated
2011-05-06 21:50:18 +00:00
Sam Reed
21d35067b9 Kill some more long deprecated unused functions
Add more @deprecated since where appropriate
2011-05-06 21:09:34 +00:00
Leo Koppelkamm
384d4383a3 Fix PHP notice in r85922. Sorry for the holdup, I kinda forgot about it 2011-05-05 09:12:55 +00:00
Sam Reed
e8e63594de Make a method static per the comment, update the only non static usage (in Parser) itself 2011-05-01 23:59:41 +00:00
Sam Reed
018a22d827 Documentation tweaks, additions and updates 2011-05-01 23:54:41 +00:00
Sam Reed
ef6afb5d9e Tweak documentation
Add braces
2011-04-29 23:34:37 +00:00
Sam Reed
409b547cae * (bug 28719) Do not call mLinkHolders __destruct explicitly
Patch by Vitaliy Filippov
2011-04-27 20:05:39 +00:00