Commit graph

543 commits

Author SHA1 Message Date
Alexandre Emsenhuber
876115459b Make Parser::makeKnownLinkHolder() call Linker::linkKnown() instead of deprecated Linker::makeKnownLinkObj() 2011-03-13 14:00:38 +00:00
Platonides
9a59164dbf Merge corrected r81741 and resolve the TODO.
Keep disabled with a class constant.
2011-03-07 19:13:19 +00:00
Alexandre Emsenhuber
9e0c678ddf Only call ParserOptions::getNumberHeadings() when needed for the benefit of cache sharing when this is not used.
Also fixed a bug in ParserOutput when no option is used; otherwise getUsedOptions() will return false and throw warnings in ParserOptions::optionsHash().
2011-03-06 21:16:22 +00:00
Tim Starling
4431b79a68 Fixed fatal error in Preprocessor_Hash due to r82645 2011-02-28 02:40:39 +00:00
Sam Reed
e1f5c11aee More bits of documentation 2011-02-27 15:23:41 +00:00
Mark A. Hershberger
25f5ca8254 * EOL w/s cleanup
* Normalize function names to eliminate two references to “HalfParsedDATA”
2011-02-24 20:23:49 +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
be3710c312 Fixes for r82645:
* Fixed several obvious bugs in the $wgCiteCacheReferences helper functions, missed due to inadequate testing.
* Don't save complete Title objects to memcached, they contain cached data with a short lifetime.
* Fixed a doc comment.
2011-02-23 23:42:04 +00:00
Mark A. Hershberger
fcf56ed2f3 (Bug #27634) TOC title appears in wrong language
Patch from P.Copp
2011-02-23 20:32:57 +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
Platonides
78e4547bea Rename startExternalParse() when used for internal usage, per r80818 CR. 2011-02-22 15:05:08 +00:00
Alexandre Emsenhuber
19f1eccc53 Per Platonides; follow-up r78201: add "stubthreshold" to ParserOptions; also provides a proper fix to r81765 2011-02-20 15:03:25 +00:00
Mark A. Hershberger
690ebe937a (Bug #27467) preload can leave UNIQ
Patch to fix from P.Copp
2011-02-19 19:18:02 +00:00
Sam Reed
7d98280f3e More function and variable documentation 2011-02-19 01:02:56 +00:00
Mark A. Hershberger
b4cee86beb w/s fixups 2011-02-12 04:06:22 +00:00
Platonides
aeb547b465 Adding more wfProfileOut() 2011-02-10 16:11:34 +00:00
Alexandre Emsenhuber
195eafd6ef * Add a amtitle param to meta=allmessages
Only used used when amenableparser is passed; the user can now define the page used for {{PAGENAME}} and related stuff instead of being hardcoded to "API"
2011-02-09 15:19:45 +00:00
Sam Reed
da3b3fbae4 More return type documentation 2011-02-08 23:18:13 +00:00
Platonides
8272ebfe6b Hack to shortcut it to zero until User::getStubThreshold() produces a call to optionUsed() 2011-02-08 17:58:53 +00:00
Platonides
a601b4f677 Revert r81738. Extensions calling clearState() with no mOptions fixed. 2011-02-08 16:32:30 +00:00
Brion Vibber
7d158675b2 Tweak for r79018: fatal errors due to something calling parser clearState when mOptions wasn't defined 2011-02-08 13:31:30 +00:00
Daniel Friesen
f0fd318a4e Followup r81583, break some of the long lines and centralize the regex. 2011-02-08 01:31:21 +00:00
Daniel Friesen
d06c054971 Switch <editsection> to <mw:editsection> and start hiding these editsection tags from Tidy so it doesn't break them. 2011-02-06 01:38:33 +00:00
Daniel Friesen
1455b81f0c Kill off Linker::getExternalLinkAttributes. 2011-02-05 23:06:36 +00:00
Brian Wolff
13bb571b11 (follow up r79706 to address CR comments) Simplify some of the logic in LinksUpdate.php
Make it so that by default, the parser consdiers categories to have a sortkey of "" unless
specified otherwise. Before, the parser said the sortkey was the page name, and then in LinksUpdate
we reset the sortkey (prefix) to "" if it was the same as the page name.

This way, the parser uniformly outputs the sortkey prefix, instead of a mix between prefix or pagename.

It should be noted, this changes the output of api.php?action=parse for categories that do not have
a sortkey.
2011-02-05 02:16:13 +00:00
Alexandre Emsenhuber
dfd6988313 Use wfMessage() instead of wfMsgGetKey() 2011-02-04 16:52:26 +00:00
Alexandre Emsenhuber
51c6afc751 * Replaced $wgMessageCache by MessageCache::singleton(); since we only use one instance of this class (as for ParserCache, LinkCache)
* MessageCache::singleton() calls wfGetMessageCacheStorage() directly instead of using $messageMemc, just in case this would be called before that variable is set
* Per TimStarling: also removed deprecated methods in MessageCache class: addMessages() and related, [get|set|enable|disable]Transform(), loadAllMessages(), loadMessageFile() and some others. Same for the legacyData stuff in LocalisationCache that was only used by MessageCache::addMessages() and related. 
* Converted remaining extensions
2011-01-26 15:42:04 +00:00
Brion Vibber
0f3c246fe5 Provisionally reverting r80430 (bug 529, 12974)
As noted in CR there are some issues where we're trading one set of weird behavior for a different, but previously unknown, set of weird behavior which breaks existing markup that works around the old behavior.
I'd recommend keeping this in store for after the 1.17 stuff calms down so unexpected parser changes aren't cropping up in the middle of things for people working with trunk.

If these are the right changes to make then great -- but they should be done after the consequences are better understood and folks can prepare for changes.
2011-01-26 01:16:18 +00:00
Platonides
90694b1ffd Transforming a message uses automatically $wgTitle, which may not be set if running from eg. a script, usecase broken by r80819.
Creating a new title in transformMsg() in such case. Reverting r80987 (its revert), and r80898 (workaround).

Confirmed that now both the installer and extensions/Translate/scripts/sync-group.php work.
2011-01-26 00:23:39 +00:00
Antoine Musso
8ed6718db0 revert r80819 for now so we can use phpunit
function foo (Title $title = null ) {} does not work
2011-01-25 20:37:33 +00:00
Sam Reed
13c42dc573 Couple more raw SQL to query arrays 2011-01-24 23:15:10 +00:00
Platonides
b6875ddacc Accept being passed a null Title to startExternalParse(), at the callers responsibility.
Added a note about getUserSig() side-effects.
2011-01-23 18:45:21 +00:00
Platonides
a39b8f1311 Add types to prototypes. 2011-01-23 16:11:14 +00:00
Platonides
1f19b8832c Replace the repeated prologues to set mOptions, clearState(), setOutputType(), setTitle() with startExternalParse() calls 2011-01-23 16:07:13 +00:00
Platonides
10505ce8ee Remove a couple of calls to ParserOptions::resetUsage(), missed on its removal in r79018 2011-01-23 15:56:30 +00:00
Krinkle
0552353f1f Follow-up per r80813 CR 2011-01-23 14:34:19 +00:00
Krinkle
3cc14d4bf8 Bug 26870 - add width/height param to {{filepath:}}
* In addition to r80381
* Expanded comments in SpecialFilePath a little bit
2011-01-23 13:09:15 +00:00
Ilmari Karonen
7e5472dea3 followup r80511: make {{PAGENAMEE}} and friends also call wfEscapeWikiText() (why is the code duplicated, anyway??) 2011-01-18 20:15:50 +00:00
Happy-melon
2d8ee839cb (bug 529, bug 12974) alter behaviour of the table- and template-parser:
* Remove the hack from bug 529 which inserts a newline when the template text begins with any block character; this breaks many things in many exciting ways.  I've left it in for now when the text begins with a wikitable, as that markup can't be mistaken for anything else.
* Instead, move the contents of a table cell onto a new line for parsing, so that linestart elements (including nested tables) will parse as normal.  

This means that structures like

{| 
| {{template-containing-wikilist}}
|}

Will still work, but for the right reason, and structures like

{|
| style="color:{{template-containing-hexcode}}" | Foo
| * Bar
| {|
   | Look at me, I'm nested!
  |}
|}

Will all now start to work.  Structures like 

* Foo {{template-containing-wikilist}}

Will now not, but honestly, should they?
2011-01-16 23:57:13 +00:00
Robert Leverington
2a30aa1d25 Add new hook ArticlePrepareTextForEdit, called when preparing text to be saved.
Add new parser option "PreSaveTransform" that allows the pre-save transformation to be selectively disabled.
2011-01-16 21:12:26 +00:00
Platonides
7970796f1a Pasting lines typo in r80025 2011-01-16 16:41:15 +00:00
Daniel Friesen
39ab3cfc9f Implement Message::isBlank and Message::isDisabled.
And while we're at it... update a random assortment of code using wfEmptyMsg to use the new wfMessage class and our exists/isBlank/isDisabled methods.
2011-01-14 10:51:05 +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
Platonides
5ceb97cfc3 Follow up r80025.
The space is actually used inside extensions, such as Maps, covertly called as 'display_map' into 
Validator, then converted into 'display map' by getName().
2011-01-12 00:11:11 +00:00
Platonides
f1bcac7be1 Forbid '<', '>', ' ', '\n', '\r' in parser hook names.
Registering a tag hook with < or > on its name resulted in a UNIQ marker.
Spaces, tabs or LF do work (CR fails due to the CR->LF transformation), 
but it's easier to also forbid them, just as they are not allowed in other 
markup languages.
2011-01-11 18:38:32 +00:00
Tim Starling
8e42c60b60 Update comment for r64876 2011-01-07 01:38:06 +00:00
Sam Reed
0c59a5f824 Followup r79709, re-add equals
Removed due to previous CR, that had not had any response to, so presumed right
2011-01-06 15:27:49 +00:00
Sam Reed
5c94145e33 Fixup fixme on r67819 2011-01-06 03:24:35 +00:00