Commit graph

436 commits

Author SHA1 Message Date
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
Leo Koppelkamm
a4296effc7 Add |alt= option for galleries ( Bug 18682 ). Recommit of r86749, with nested |alt= now fixed. Patch by Jan Paul Posma 2011-04-25 13:51:54 +00:00
Leo Koppelkamm
8548adf48f Reverting r86749: The alt stuff is far too simplistic. One way to fix it would be to generalize makeImage() in the parser to process gallery params as well, but I don't have time to that now 2011-04-23 09:55:42 +00:00
Leo Koppelkamm
f3e6866d1a Add ability to use add alt texts for images in galleries ( Bug 18682 ). Patch by Jan Paul Posma. Also cleaned up some comments and var names 2011-04-23 07:27:45 +00:00
Brion Vibber
2c55eba5c7 Doc comment updates for CoreTagHooks callback functions + Parser::setHook() & Parser::setTransparentTagHook().
Added notes about the 'extended' return values from some of the hooks, which seems to be undocumented but is vaguely similar to what is documented for parser function callbacks. It doesn't look like a very safe interface, and could stomp on internal variables if one isn't careful. Needs to be better defined and doc'd.

setTransparentTagHook() seems to have been largely undocumented and is only used by the 'geoserver' extension currently. Is this considered obsolete? Should it be simply replaced by use of the frame & recursiveTagParse goodies, or is it still needed for something?
2011-04-22 19:06:52 +00:00
Leo Koppelkamm
6e7c9e2701 Fix Bug 25794: Disallow multiple table captions & only keep the first 2011-04-21 07:27:05 +00:00
Chad Horohoe
783d4e0862 Remove @static from all over the place. That's what the static keyword is for, this being PHP5 and all 2011-04-21 00:07:09 +00:00
Brian Wolff
35c61744a6 (bug 23816) Add tracking category for any page with a broken image.
Note this considers a link to a non-existent image to be broken. A link
to an image that exists but does not have a handler is not considered broken.
2011-04-20 19:43:47 +00:00
Sam Reed
3a0ed7a044 * (bug 28532) wfMsgExt() and wfMsgWikiHtml() use $wgOut->parse()
* (bug 16129) Transcluded special pages expose strip markers when they output parsed messages

Also adding some related documentation during my travels around the code
2011-04-18 12:43:53 +00:00
Happy-melon
2c9cfd7cce Refactor the factory/i18n/list/etc static methods from SpecialPage into their own class; there's no reason we need to be parsing them in every single SpecialPage subclass. Leave all the methods as stubs in SpecialPage.php; if we required PHP 5.3 they could be replaced by a a __callStatic() magic method, but that doesn't work on PHP 5.2.
Also make a few changes to the functions available.  SpecialPageFactory::resolveAlias() now takes an optional subpage and returns array(<name>,<subpage>).  Similarly merge getPage() and getPageByAlias().  There were many examples of (extensions particularly) making dubious assumptions about the presence or absence of subpages or canonical-ness.

I didn't deprecate SpecialPage::getTitleFor() as it's got over six hundred calls.  I'm rather undecided on the best position of getPage()/executePath().  Although the latter needs cleanup anyway.
2011-04-17 11:31:11 +00:00
Alexandre Emsenhuber
4207ab0c63 * (bug 28511) Use [] syntax instead of {} for string offset access 2011-04-17 07:59:58 +00:00