Commit graph

934 commits

Author SHA1 Message Date
Brion Vibber
5cdbf22f78 Fix regressions in r27759 -- pages already marked in link cache at link parsing time were styled as new links but not given the edit action.
The original link coloring array used 0 for broken links, and an empty() check which would return true for both missing entries and entries which had been stored explicitly as 0.
r27759 switched it to use class names, but the change of the check to !isset() no longer got the explicit case.

11 previously failing test(s) now PASSING! :)
    * Piped link to namespace  [Fixed between 27-Nov-2007 19:23:59, 1.12alpha (r27890) and 27-Nov-2007 20:42:42, 1.12alpha (r27900)]
    * Link containing % as a single hex sequence interpreted to char  [Fixed between 27-Nov-2007 19:23:59, 1.12alpha (r27890) and 27-Nov-2007 20:42:42, 1.12alpha (r27900)]
    * Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)  [Fixed between 27-Nov-2007 19:23:59, 1.12alpha (r27890) and 27-Nov-2007 20:42:42, 1.12alpha (r27900)]
    * Nonexistant template  [Fixed between 27-Nov-2007 19:23:59, 1.12alpha (r27890) and 27-Nov-2007 20:42:42, 1.12alpha (r27900)]
    * Template with thumb image (with link in description)  [Fixed between 27-Nov-2007 19:23:59, 1.12alpha (r27890) and 27-Nov-2007 20:42:42, 1.12alpha (r27900)]
    * BUG 561: {{/Subpage}}  [Fixed between 27-Nov-2007 19:23:59, 1.12alpha (r27890) and 27-Nov-2007 20:42:42, 1.12alpha (r27900)]
    * Transclusion of nonexistent MediaWiki message  [Fixed between 27-Nov-2007 19:23:59, 1.12alpha (r27890) and 27-Nov-2007 20:42:42, 1.12alpha (r27900)]
    * Say the magic word  [Fixed between 27-Nov-2007 19:23:59, 1.12alpha (r27890) and 27-Nov-2007 20:42:42, 1.12alpha (r27900)]
    * Parents of subpages, one level up, not named  [Fixed between 27-Nov-2007 19:23:59, 1.12alpha (r27890) and 27-Nov-2007 20:42:42, 1.12alpha (r27900)]
    * RAW magic word  [Fixed between 27-Nov-2007 19:23:59, 1.12alpha (r27890) and 27-Nov-2007 20:42:42, 1.12alpha (r27900)]
    * red link from nonexistent article  [Fixed between 27-Nov-2007 19:23:59, 1.12alpha (r27890) and 27-Nov-2007 20:42:42, 1.12alpha (r27900)]
2007-11-27 20:45:41 +00:00
Tim Starling
ed10536151 Fixed bug 12056: transformMsg() was not calling unstripBoth(), breaking the common use case of <charinsert> among other things. 2007-11-27 06:20:40 +00:00
Aryeh Gregor
b5dc7f412a * Also localize Special:Contributions in 'signature-anon', as with User: in 'signature'
* Whitespace, comments
2007-11-23 17:49:08 +00:00
Aryeh Gregor
d2e14acbe0 Don't have gibberish English strings like "User" in foreign-language wikis' signatures. Still need to fix Special:Contributions. 2007-11-23 17:02:25 +00:00
ThomasV
abf601e0fc * got rid of magic codes for colours.* added hook for link recolouring by extensions* merged redundant stub tests in one single function, getLinkColour (Linker.php)
* deprecated makeStubLink and makeStubLinkObj
2007-11-22 15:54:18 +00:00
Steve Sanbeg
f193a1b2e8 cache template redirects, since we were already checking cache for them 2007-11-21 23:07:36 +00:00
Brion Vibber
1e7eceaac7 Revert r27694 -- if you're seeing this problem, it's probably because you're pulling things out of $wgParser->mFunctionHooks and copying it to another parser without knowing the internal format has changed. That should be fixed whereever that's being done (as it was fixed on the parser tests.) 2007-11-20 21:26:48 +00:00
Brion Vibber
a6101521a2 Cleanup vis-a-vis r27691
Use x option on regex so we can break it up for legibility. 
PHP doesn't seem to let you concat multiple strings in a constant definition, which is kind of lame, so this seems to be the cleanest way to break it over lines. :P
2007-11-20 21:21:39 +00:00
Steve Sanbeg
b372d09e85 try to prevent old extensions from exploding mysteriously; probably, there's a better way to do this 2007-11-20 20:55:11 +00:00
Daniel Cannon
a703f2f59f This is giving me a syntax error. It looks gross this way, but I can't think of any other way to split up the constant string. 2007-11-20 19:40:48 +00:00
Tim Starling
b6dba5bcfd * Refactored the parser. See my huge entry in RELEASE-NOTES for details.
* Made it possible to configure the parser class being used, via $wgParserConf.
* Moved defines from the top of Parser.php to either class constants or Defines.php
* Added Parser_DiffTest, a differential parser class for regression testing
* Added Parser_OldPP, a parser class which operates like the parser before this commit. I made one breaking change: a bugfix to avoid losing whitespace when adding MWTEMPLATESECTION markers. 
* Made internal tidy work with PHP 5
* Added the ability to supply a hook for template fetching via ParserOptions. This is handy for testing.
* Updated parserTests.txt to account for the various breaking changes I made. Removed a few parser tests that no longer test for anything useful.
2007-11-20 10:55:08 +00:00
Brion Vibber
e682f4eb68 Reverting r27599
* Uses hardcoded magic numbers extensively, which is poor practice
* Adds two hooks with no documentation
* Dropping $class unencoded into the HTML output feels like bad practice to me
* A link-by-link coloring plugin sounds like it could be very expensive to begin with; I'm a bit leery of adding in such overhead.
2007-11-19 15:38:56 +00:00
ThomasV
d03c63eb73 Inserted two hooks for extension-defined colour codes, and simplified the way link colours are passed. Deprecated makeStubLink and makeStubLinkObj 2007-11-18 11:10:26 +00:00
Brion Vibber
909e5b363c * Changed signature-ip to signature-anon
* Removed the hardcoding of the link parameter ($1), let the message control the destination.
* Removed the hardcoded talk page links. They can be easily re-added if desired, though, and added per-wiki.
* Removed the $3 and $4 parameters
* Fixed wfEscapeWikiText() to do "]" as well as "[", so sigs with "]" won't break links
* Updated a parser test case for the escaping change
2007-11-15 03:30:03 +00:00
Brion Vibber
b9ddd7440b Fix regression in r27416 -- {{REVISIONID}} was broken on save since a parsed copy from before revision-insert was used to insert into parser cache.
The parser now sets a "vary-revision" flag on the ParserOutput when using {{REVISIONID}}; Article then reparses the page after insertion if and only if required.
2007-11-15 02:54:28 +00:00
Niklas Laxström
ac5b0d6a1a * Not nice to sprinkle signatures in random languages 2007-11-14 20:18:29 +00:00
Roan Kattouw
be23facd3d (bug 11315):
*Default signatures can be changed in [[MediaWiki:Signature]] and [[MediaWiki:Signature-ip]]
* Signatures for anonymous users link to Special:Contributions page rather than user page
2007-11-13 20:32:11 +00:00
Niklas Laxström
07fd6c1224 * Fetch linkprefix only when needed 2007-11-13 09:55:45 +00:00
Rotem Liss
11c9dd35bb Reverting r27280: Shows a PHP warning, and doesn't seem to fix the bug. If it should be passed by reference, please change the function itself. 2007-11-07 11:16:43 +00:00
Steve Sanbeg
01ef4daf2d replace lost reference, per Bug 8451 2007-11-06 22:38:05 +00:00
Brion Vibber
6a3260fe26 Revert r26670 [LiquidThreads-related patches] for now:
* Adds five undocumented hooks
* Unclear purpose for change to SpecialPage
* Big search-and-replace in EditPage for title usage which seems to still leave things inconsistent; a bit confused what all that's mean to be doing.
2007-10-18 14:55:48 +00:00
David McCabe
c474b77da3 Merged in changes from Liquid Threads branch including extra hooks and minor changes to EditPage. (Liquid Threads itself is still an extension; this is just some things it needs.) 2007-10-12 23:12:24 +00:00
Rotem Liss
80c6bc669d Fix comment. 2007-10-12 07:11:09 +00:00
Brion Vibber
ef1545f14a * Add {{filepath:}} parser function to get full path to an uploaded file, complementing {{fullurl:}} for pages.
Giving this a |nowiki option to wrap the returned path in <nowiki>s for non-linked standalone use.
Added File::getFullURL() function for cleaner calls; using full path to ensure consistency here.
2007-09-14 15:29:52 +00:00
Tim Starling
87bd9eaa2a Moved EditPage::sectionAnchor() and EditPage::pseudoParseSectionAnchor() to Parser, names slightly changed. Replaced O(N^2) regexes with calls to StringUtils. This should fix the breakage of ActiveAbstract extension, which was calling EditPage::sectionAnchor() statically.
We could probably all benefit from implementing a general rule *not* to call random non-static functions statically. This style is very vulnerable to breakage on later refactoring.
2007-09-08 02:08:08 +00:00
Aryeh Gregor
85f2c1839f Use "public function", not the old "@public" nonsense. 2007-09-07 01:55:33 +00:00
Tim Laqua
64b80f0c98 (m) Marking Parser::doQuotes() as public as it needs to be available to EditPage::pseudoParseSectionAnchor 2007-09-07 01:30:17 +00:00
Aryeh Gregor
1e3b8049eb Reinstate r25260 with fix (missing trim()). No additional parser tests are broken relative to trunk. 2007-08-29 16:10:36 +00:00
Brion Vibber
106c4bc74c Revert r25260; breaks several parser tests cases, seems to be borking up section IDs.
8 previously passing test(s) now FAILING! :(
   * Basic section headings  [Introduced between 29-Aug-2007 15:27:48, 1.11alpha (r25250) and 29-Aug-2007 15:55:07, 1.11alpha (r25289)]
   * Section headings with TOC  [Introduced between 29-Aug-2007 15:27:48, 1.11alpha (r25250) and 29-Aug-2007 15:55:07, 1.11alpha (r25289)]
   * Handling of sections up to level 6 and beyond  [Introduced between 29-Aug-2007 15:27:48, 1.11alpha (r25250) and 29-Aug-2007 15:55:07, 1.11alpha (r25289)]
   * TOC regression (bug 9764)  [Introduced between 29-Aug-2007 15:27:48, 1.11alpha (r25250) and 29-Aug-2007 15:55:07, 1.11alpha (r25289)]
   * TOC with wgMaxTocLevel=3 (bug 6204)  [Introduced between 29-Aug-2007 15:27:48, 1.11alpha (r25250) and 29-Aug-2007 15:55:07, 1.11alpha (r25289)]
   * Resolving duplicate section names  [Introduced between 29-Aug-2007 15:27:48, 1.11alpha (r25250) and 29-Aug-2007 15:55:07, 1.11alpha (r25289)]
   * Fuzz testing: Parser14  [Introduced between 29-Aug-2007 15:27:48, 1.11alpha (r25250) and 29-Aug-2007 15:55:07, 1.11alpha (r25289)]
   * -{}- tags within headlines (within html for parserConvert())  [Introduced between 29-Aug-2007 15:27:48, 1.11alpha (r25250) and 29-Aug-2007 15:55:07, 1.11alpha (r25289)]

Sample:
--- /tmp/mwParser-557844546-expected    2007-08-29 15:55:46.000000000 +0000
+++ /tmp/mwParser-557844546-actual      2007-08-29 15:55:46.000000000 +0000
@@ -1,16 +1,16 @@
 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
 <ul>
-<li class="toclevel-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
+<li class="toclevel-1"><a href="#_Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
 <ul>

etc
2007-08-29 16:01:23 +00:00
Aryeh Gregor
ab3a00a097 (bug 8393) <sup> and <sub> need to be preserved (without attributes) for entries in the table of contents. 2007-08-29 00:06:58 +00:00
Brion Vibber
756b356e43 Hack a special case for regression in setting image height via box size (eg 200x200px).
The height had been simply dropped off the face of the earth, with only the width taken into account anymore.
The infrastructure for parameters doesn't seem to gracefully handle multiple values coming from one magic word match, so this is an ugly hack.
2007-08-25 15:49:36 +00:00
Tim Starling
daf77bd5f1 In ImageGallery:
* Split "is parsing" and "respect bad images" concepts. 
* Call media handler parser hook 
* Use the $linkAttribs parameter instead of putting an <a> tag around the whole media output.
2007-08-22 13:40:22 +00:00
Rob Church
2fe74340d8 (bug 8737) Fix warnings caused by incorrect use of /dev/null when piping process error output under Windows 2007-08-15 21:44:58 +00:00
Tim Starling
164bb322f2 Basic integrated audio/video support, with Ogg implementation.
* JavaScript video player based loosely on Greg Maxwell's player
* Image page text snippet customisation
* Abstraction of transform parameters in the parser. Introduced Linker::makeImageLink2().
* Made canRender(), mustRender() depend on file, not just on handler. Moved width=0, height=0 checking to ImageHandler::canRender(), since audio streams have width=height=0 but should be rendered.

Also:
* Automatic upgrade for oldimage rows on image page view, allows media handler selection based on oi_*_mime
* oi_*_mime unconditionally referenced, REQUIRES SCHEMA UPGRADE
* Don't destroy file info for missing files on upgrade
* Simple, centralised extension message file handling
* Made MessageCache::loadAllMessages non-static, optimised for repeated-call case due to abuse in User.php
* Support for lightweight parser output hooks, with callback whitelist for security
* Moved Linker::formatSize() to Language, to join the new formatTimePeriod() and formatBitrate()
* Introduced MagicWordArray, regex capture trick requires that magic word IDs DO NOT CONTAIN HYPHENS.
2007-08-15 10:50:09 +00:00
Daniel Cannon
f2bc6281e2 Minor whitespace cleanup ... rmvd closing ?> 2007-08-14 01:58:12 +00:00
Jens Frank
8c3822b9b7 New Parser::setTransparentTagHook for parser extension and template compatibility 2007-07-15 11:14:53 +00:00
Brion Vibber
4d3446a8e3 * (bug 10508) Allow HTML attributes on <gallery>
* (bug 1962) Allow HTML attributes on <math>
2007-07-13 17:25:06 +00:00
Brion Vibber
223498207f * (bug 9151) Fix relative subpage links with section fragments 2007-07-12 21:02:25 +00:00
Jens Frank
611942d03e Fix bug with <nowiki> in front of links for wikis where linkPrefixExtension is true 2007-07-11 20:44:33 +00:00
Raimond Spekking
1258d8bd59 * (bug 10334) Replace normal spaces before percent (%) signs with non-breaking spaces 2007-06-26 08:56:30 +00:00
Rob Church
4a55dcdda8 Revert r23395, since it won't work (d'oh, of course) 2007-06-25 16:07:49 +00:00
Rob Church
fcd4e076c2 On second thoughts, don't increment the parser cache serial; it *will* cause a load spike. Added some backwards-compatible checking which should incur no overhead. \o/ 2007-06-25 16:00:46 +00:00
Rob Church
19be1d25ac Fix up DISPLAYTITLE and enable per default:
* Clean up the mess in ParserOutput
* Reject (ignore) custom titles which don't normalise to the same as the current page -- THIS IS IMPORTANT OTHERWISE LINKING GOES TO POT (and not the good kind of pot)
[WARNING: Touches parser version. Old caches will be expired. You might wish to undo this and add some temporarily backwards-compatibility for a few days.]
2007-06-25 15:51:09 +00:00
Brion Vibber
c52af0da6d * (bug 10338) Enforce signature length limit in Unicode characters instead of bytes
Uses mb_strlen(), which we already have a fallback function for if mbstring extension isn't present.
2007-06-25 15:02:46 +00:00
Aaron Schulz
d36548e2c5 *Use wfSuppressWarnings() instead of error_reporting() 2007-06-20 22:25:39 +00:00
Aaron Schulz
92ad0a60a6 *Goddamn hack, modify error level temporarily while some dates are parsed so as not to make E_STRICT unusable due to local time complaint floodage 2007-06-20 18:41:15 +00:00
Brion Vibber
7fe0850db1 * (bug 10309) Initialise parser state properly in extractSections(), fixes
some cases where section edits broke because tags were improperly stripped
2007-06-19 16:00:11 +00:00
Niklas Laxström
d7743ca457 * Escape the output of magic variables that return page name or part of it 2007-06-18 13:34:07 +00:00
Brion Vibber
1e919f4299 * (bug 8577) Fix some weird misapplications of time zones.
{{CURRENT*}} functions now consistently use UTC as intended, while
  {{LOCAL*}} functions return local time per server config or $wgLocaltimezone.
  Signature dates for Japanese and other languages including weekday now show
  the correct day to match the rest of the time in local time.
2007-06-15 19:07:15 +00:00
Brion Vibber
b802e2a780 * (bug 8458) Limit custom signature length to $wgMaxSigChars bytes 2007-06-13 16:28:19 +00:00