Commit graph

1012 commits

Author SHA1 Message Date
Aaron Schulz
42ef6b6585 Fix NS_MEDIA link handling 2008-04-19 21:29:19 +00:00
Aryeh Gregor
82a87bd33c * Add Parser::incrementExpensiveFunctionCount() and use it in CoreParserFunctions::getcategorycount(); refactor slightly so that formatRaw is called even for 0 (do any languages format that differently? maybe if they use non-Arabic numerals?). From bug 12698, by CBM.
* Add a cache so that calling getcategorycount for the same category many times won't stupidly repeat the same query over and over.  Currently an early return avoids incrementing the expensive function count in this case, so technically this makes things *slower*, not faster, but that can be tweaked if anyone cares.
2008-04-18 14:34:38 +00:00
Brion Vibber
cee68e6681 * (bug 13728) Don't trim initial whitespace during section edits 2008-04-14 20:39:00 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Brion Vibber
784d10e4d3 Kill a bunch of '=&' references for LinkCache, ParserCache, and MimeMagic singletons.
This is an old PHP 4-ism; only needed today if you want to be able to replace the singleton with another object by using the reference as an lval. :)
Killing them because they annoy me.
2008-04-09 18:23:34 +00:00
Aaron Schulz
8c719c68b1 Partial revert of r32982; old Title method is fine here 2008-04-09 12:15:44 +00:00
Aaron Schulz
aed9d4b912 ...really get rid of link color query spam 2008-04-09 05:21:00 +00:00
Aaron Schulz
e9474997ee This wants a title now 2008-04-08 20:46:54 +00:00
Aaron Schulz
a17762266f * Add redirect and size fields to title. Add accessors.
* Add newFromRow() function for Titles to optionally avoid some queries on accessor use
* Make linkbatch and some things that directly use linkcache select len/redirect fields along with the rest all in one query. This avoids query spam for link coloring.
2008-04-08 20:34:09 +00:00
Brion Vibber
c1f2158242 * (13624) Fix regression with manual thumb= parameter on images
Fixes parser test case:
* Fuzz testing: image with bogus manual thumbnail  [Fixed between 07-Apr-2008 22:04:11, 1.13alpha (r32931) and 07-Apr-2008 23:29:32, 1.13alpha (r32931)]
2008-04-07 23:30:45 +00:00
Brion Vibber
3725c751a0 * (6943) Added PAGESINCATEGORY: magic word
Patch by Mr.Z-man, https://bugzilla.wikimedia.org/attachment.cgi?id=4793
Moves some of the 'expensive parser function' tracking to core.
2008-04-07 22:11:31 +00:00
Aryeh Gregor
67a93f613e (bug 13500) For backward compatibility, permit "pxpx" and similar constructs to be used for specifying image sizes. This could use some parser tests, maybe, but I'm not sure those give correct results on my machine, so probably not worth it for me to try. 2008-03-27 14:33:02 +00:00
Brion Vibber
5cbe54fa7b * (bug 13522) Fix fatal error in Parser::extractTagsAndParams
Patch by MinuteElectron - https://bugzilla.wikimedia.org/attachment.cgi?id=4772 with fixes
Replaces an instance variable with a constant, since it doesn't change, which is safe to access when the function is called statically from an outside class, as some extensions do.
2008-03-27 00:00:25 +00:00
Tim Starling
7cde8b499e Another bugfix in the parameter validation thing: allow the handler to validate height/width. Apparently some people specify thumbnail sizes by height only using "x100px", relying on the handler to discard the width. 2008-03-25 08:23:10 +00:00
Tim Starling
b03e5cdc12 allow spaces in numeric image parameters for b/c 2008-03-25 05:57:16 +00:00
Tim Starling
e67df1ecac Fixed r32391 -- the media handler may define parameters, and the parser has no right or ability to validate those parameters. The handler does in fact provide a validateParam() function for precisely this purpose -- to signal to the parser which parameters should be silently ignored. In particular, the thumbtime parameter in OggHandler would have been broken by this commit. 2008-03-25 05:17:42 +00:00
Aryeh Gregor
b6ca4495ff Actually, let's be a little pickier here. 2008-03-25 00:50:14 +00:00
Aryeh Gregor
42e3ee23a0 (bug 13436) Treat image captions as image captions when they include option keywords (like ending with "px" or starting with "upright"), provided the non-keyword part of the caption is non-numeric. Patch based on suggestion by Mormegil, Soxred93. 2008-03-25 00:46:37 +00:00
Brion Vibber
cd148a2b8f * (bug 12077) Fix HTML nesting for TOC
Patch by WTucker at https://bugzilla.wikimedia.org/show_bug.cgi?id=12077#c5
Plus parser test case
2008-03-24 23:33:31 +00:00
Brion Vibber
1ca04031af Update to r32375 / bug 11874 -- !important may have whitespace between ! and important 2008-03-24 18:45:26 +00:00
Brion Vibber
2e2647203f * (bug 11874) Inline CSS with !important no longer borken
Patch by Nicolas Dumazet - https://bugzilla.wikimedia.org/attachment.cgi?id=4754
Plus parser test case
2008-03-24 18:32:26 +00:00
Aaron Schulz
76fecd8d8b Pass $time on like it should 2008-03-18 23:14:20 +00:00
Brion Vibber
1ba1ef57b9 Workaround for runJobs CategoryTree issue:
* Don't bloat $this->mStripList on every setHook() call.

It adds up in batch processing until we end up with regex errors!
2008-03-18 21:45:18 +00:00
Aryeh Gregor
6232139bfd It's not IE, it's the standards! We aren't supposed to have names that conflict in case to begin with. http://www.w3.org/TR/html4/struct/links.html#h-12.2.1 2008-03-13 19:12:49 +00:00
Brion Vibber
f3f82e3f60 * (bug 10721) Duplicate section anchors with differing case now disambiguated
for Internet Explorer's sake
2008-03-13 18:30:50 +00:00
Niklas Laxström
92363755ce * Parse MediaWiki message translations with a correct language setting on preview 2008-03-07 14:02:12 +00:00
Brion Vibber
9d533a070c * (bug 13247) Prettified ISBN links 2008-03-05 00:28:33 +00:00
Brion Vibber
ea3a20cdd3 * (bug 13174) __HIDDENCAT__ now applies only to category pages 2008-02-29 00:55:45 +00:00
Raimond Spekking
8eaed9fa0f * (bug 13159) Use content language for name of Category:Hidden categories 2008-02-26 09:36:43 +00:00
Tim Starling
792e155bd2 * Put both hidden categories and normal categories into the view page HTML, but with hidden categories being unconditionally hidden with CSS. A JS show/hide toggle can be added in user/site JS.
* Add user preference to always show hidden categories
* Add all hidden categories to [[Category:Hidden categories]], localised by hidden-category-category
* Add wgVariantArticlePath and wgActionPaths to the JS variables script, needed to determine title from link href.
2008-02-25 16:38:25 +00:00
Tim Starling
aaf4d99d02 Hook suggested on IRC. 2008-02-21 10:25:44 +00:00
Tim Starling
269a91037b * Added __HIDDENCAT__ feature, to hide categories from the box at the bottom of the member pages depending on special text on the category page.
* Added page_props backend, generic parser-driven page properties which, when changed, invalidate the cache of backlinked pages on any links table. Could be used to add overlays to images depending on their deletion status, or to add icons to articles based on category membership. 
* Refactored double-underscore handling in the parser. 
* Moved CoreParserFunctions registration to CoreParserFunctions.
2008-02-20 08:53:12 +00:00
Aryeh Gregor
8bf5159e4d Improvements for 30871:
* Use !empty() to avoid notices if $s->page_is_redirect isn't set.
* Enable unconditionally.  This causes some extra queries, but only if 
makeLinkObj() is being used, which for typical article links it's not.  
(The previous version didn't add page_is_redirect to the parameter even 
when it would have caused no extra queries, in two places in 
Parser.php.)  If the extra makeLinkObj() queries are a problem, they can 
be combined with the existence check query.  Or failing that, it can 
just be reverted for that method only, which will still allow the 
feature to work with standard in-article links.
2008-02-12 19:58:12 +00:00
Thomas Bleher
ece86ccdb3 A few trivial changes:
* Update some URLs (pages moved from meta to mw.org)
* Update and fix some comments
* Fix indentation and whitespace in phase3/includes/filerepo/ICRepo.php
2008-02-09 21:48:41 +00:00
Ilmari Karonen
51b793396c (bug 12815) Signature timestamps are now given in the time zone specified by
$wgLocaltimezone.  Formerly the timestamp itself was always in UTC, while the
timezone code in parentheses came from $wgLocaltimezone or, if unset, from
the server environment.
2008-02-09 20:39:32 +00:00
Tim Starling
6fb641cdfd * Added alternate preprocessor implementation "Preprocessor_Hash" which uses plain PHP hashtables for the underlying data structure. This removes the DOM dependence, avoids XML charset problems, and avoids the lack of memory accounting in DOM. It will hopefully serve as a better model for alternate language implementations than the DOM version. I haven't measured the preformance yet, but it should be comparable to Preprocessor_DOM. If the performance is good, this might be a better default than Preprocessor_DOM.
* Verified Preprocessor_Hash against Preprocessor_DOM with a differential fuzz test.
* Improved the utility of Parser_DiffTest by synchronising strip markers and allowing for loose object comparison. 
* Abstracted PPDStack to make it usable in Preprocessor_Hash.
2008-02-05 08:23:58 +00:00
Brion Vibber
cf9cd9dad3 Reverting r30413 for now.
'parentpagename' seems to duplicate 'basepagename'; why?
2008-02-04 19:53:21 +00:00
Misza13
b002ea6e2c Adding {{ROOTPAGENAME}} (and {{ROOTPAGENAMEE}}) variables for accessing the page's root name (i.e. everything up to the first "/").
Also adding {{PARENTPAGENAME}} as an alias for {{BASEPAGENAME}}.
2008-02-02 00:56:41 +00:00
Tim Starling
eb76c1f16c Fix a regression of bug 4899 due to HHPv2: <h> tags now appear on tree depth levels other than the first. The 4899 aspect is easily fixed by having extractSections() look at the i attribute instead of just counting.
The implications in general are that headings inside properly-closed double braces will not have section edit links, even where the braces are broken by invalid title characters and expanded literally to recover the heading. Respecting such headings as section breaks would run into the same problems as those discussed w.r.t. LST on wikitech-l -- there's no way to recover the text for a section that starts on one tree level and finishes on a different one. The fact that higher level <h> nodes appear in the XML is just due to a shortcut in preprocessToObj(): headings are put into the stack in case the braces turn out to be unclosed, in which case the heading will be at level 1 of the tree.
2008-02-01 01:35:55 +00:00
Tim Starling
140e894bde Fixed the fact that defaults in template arguments {{{x|y}}} don't work when substing templates. Now defaults in triple braces will work in PST mode, except at the top (non-template) level. This is b/c breaking. 2008-01-30 02:52:14 +00:00
Tim Starling
122f4fb713 Workaround for segfault observed on parse for certain input text. Related to PHP bug 35229, but was observed in call_user_func_array() not call_user_func(). Apparently autoloading is buggy especially when invoked from an unusual context. My workaround is to trigger early autoloading using is_callable(). And if we're going to call is_callable(), we may as well do something sensible if it returns false, right? 2008-01-25 07:43:23 +00:00
Tim Starling
f748d710ee * Make lc and uc parser functions skip strip markers
* Made ==foo==<!----> create a valid section edit link
* Changed header processing heuristics -- now double-equals signs are generally respected as header starts, and will break template invocations, and single equals signs are respected as header syntax but might not generate a section edit link.
2008-01-24 09:07:47 +00:00
Tim Starling
906e978e91 * Factored out PPD "part" handling into its own class. Verified with differential fuzz test.
* Stabilise timestamps generated by the parser to avoid diff test false positives
* Fixed msgnw bug. Use RECOVER_ORIG.
* Fixed editintro bug. Cloning the parser in MessageCache has some side-effects that need to be corrected.
* Fixed typo in Parser_DiffTest.php
* General improvements to preprocessorFuzzTest.php
* Fixed breakage of XML output feature in Special:ExpandTemplates
2008-01-24 04:29:56 +00:00
Tim Starling
7da545c00d Fix for bug 12726: make the internal OT_xxx constants class constants. 2008-01-22 10:47:44 +00:00
Tim Starling
ee8d294003 Fix for bug 12705. Fixed refreshLinks.php documentation. 2008-01-22 10:10:21 +00:00
Tim Starling
8404b249ad Postcard from linuxland.
* Reduced stack depth by using an internal stack in expand(), and by having some common code paths (e.g. non-subst double-brace during PST) return objects which can be expanded in that internal stack instead of the PHP stack. This is friendly to xdebug but slightly slower than the original version. Also it probably helps robustness when you don't add 7 stack levels per pair of double braces.
* Profiling indicates that expand and PPD are now good targets for porting to C. Abstracted and refactored the relevant code to allow for a drop-in replacement. A factor of 2 reduction in average-case replaceVariables() time may be possible.
* Verified with preprocessorFuzzTest.php against r29950, updated to allow better PST tests.
* Made parserTests.php respect $wgParserConf
* LST and ParserFunctions need a simultaneous update with the core due to changed interfaces. DOM objects are now wrapped rather than directly exposed.
2008-01-21 16:36:08 +00:00
Tim Starling
3e6f914894 Fix for more than 6 equals signs on their own line. 2008-01-19 13:53:09 +00:00
Tim Starling
6bfc746e83 * Eliminated message mode (OT_MSG), using OT_PREPROCESS instead. As proposed on wikitech-l.
* Fixed #tag behaviour in preprocess()
* Fixed #tag quote stripping regex
* Made MessageCache::getMessage() never transform its result, that is now left up to the caller. 
* A few other minor changes
2008-01-19 09:03:45 +00:00
Tim Starling
31baa8a17a Added ParserFirstCallInit hook. Deferred function registration in ParserFunctions until this hook is called. 2008-01-17 08:58:24 +00:00
Tim Starling
03c5e3c266 It was a bit too early to remove OnlyIncludeReplacer... still used by Parser_OldPP. 2008-01-17 04:02:57 +00:00