Commit graph

949 commits

Author SHA1 Message Date
Tim Starling
4decbc2934 * Merged comment handling with the main loop of preprocessToDom(). This fixes a section numbering/marking regression introduced in r28588. Added parser tests demonstrating the issue.
* Merged includeonly/noinclude/onlyinclude handling with preprocessToDom(), and used the resulting überparser to fix another section numbering bug: bug 6563. The fix involves putting a template flag "T" into the section parameter of edit links. This flag indicates to extractSections() how <includeonly> etc. should be handled.

If these two changes stick, I'll eventually describe the precise syntactic effects in RELEASE-NOTES.

* Added splitExtNode() for future use in LabeledSectionTransclusion.
* Added parser tests for bug 6563.
2008-01-05 12:39:12 +00:00
Tim Starling
3f8a69a50a * Removed noargs/noparse in braceSubstitution(), they have been largely obsolete since the introduction of replace_callback() and now just cause bugs and confusion. Did some related code cleanup.
* Fixed a bug 529 regression -- uncovered line-start syntax in parser function results was not recognised. Added a parser test for this failure plus another three bug 529 tests for good measure.
2008-01-03 05:37:32 +00:00
Victor Vasiliev
1293b0ef26 This should be array() by default 2007-12-28 08:41:45 +00:00
Victor Vasiliev
7847494e5d * Parser now returns list of sections (for API; some extensions probably also need it)
* Add list of sections to action=parse output
2007-12-27 20:14:07 +00:00
Tim Starling
9d4c263996 * Strip comments early, before template expansion. This mimics the behaviour in the old parser. Added parser tests demonstrating the regression this fixes. The syntactic effect is fairly elegant, with comments taking effect at source level, as expected. The removeHTMLcomments() and preprocessToDom() passes could be merged at a later date.
* No need for comment stripping in Expr.php anymore
* Updated srvus() to roughly account for these changes
* Gave comment handling its own preprocessor tag, and split off comment handling from extensionSubstitution(). This only applies for the non-HTML modes, since in HTML mode, comments are stripped early. 
* Strip comments from template argument names (PPFrame::newChild).
2007-12-17 15:07:25 +00:00
Tim Starling
6d67871e1a Fix support for PPFrame with no title. 2007-12-11 07:11:31 +00:00
Tim Starling
9f52185cec Add support for parse warnings. Currently only displayed on preview, but can be put in other places if desired. 2007-12-10 06:02:29 +00:00
Tim Starling
ff141daa80 * Hacky fix for invalid character problem
* Fixed bug in Parser::splitBraceNode
2007-12-09 08:13:32 +00:00
Brion Vibber
852b0dcfa7 @fixme this is probably *horribly wrong*
LanguageConverter seems to want $wgParser's uniqPrefix, however
if this is called for a parser cache hit, the parser may not
have ever been initialized in the first place.

Not really sure what the heck is supposed to be going on here...
For now, returning an empty string '' without dying out, but
leaving a stub exception comment in for testing.
2007-12-03 20:38:06 +00:00
Tim Starling
faac0cfe3f * Fix incorrect call to PPFrame::implode() from PPFrame::expand()
* Add PPFrame::splitBraceNode() for use in extensions
* Remove some obsolete debugging code
2007-12-02 08:27:39 +00:00
Tim Starling
45c90e6e73 Got rid of the $shallowFlags/$deepFlags split -- seemed like a good idea at the time but turns out to be useless. Best to kill it before some extension starts using expand() flags and b/c kicks in. 2007-12-01 07:13:31 +00:00
Tim Starling
416187b7a4 Don't destroy parser state in cleanSig(). Possible fix for bug 12154, pending confirmation. 2007-12-01 06:52:25 +00:00
Tim Starling
cde3bdd6fe Bug 12150: missing increment 2007-11-30 18:37:47 +00:00
Tim Starling
cd8b5fad98 * Add #ifexist invocation count to the limit report comment
* Fix limit report inclusion criteria for new preprocessor -- make it display only for the primary text on edit and page view
2007-11-30 14:50:48 +00:00
Tim Starling
2771512dbe * $wgDebugTidy feature
* Fixed a bug in extractSections() -- inappropriate expansion of double-brace constructs causing a fatal error under some circumstances (reported by Nikerabbit, thanks)
2007-11-30 12:26:12 +00:00
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