Commit graph

978 commits

Author SHA1 Message Date
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
Tim Starling
678b861f63 * Fixed "Morwen/13" from http://meta.wikimedia.org/w/index.php?title=Migration_to_the_new_preprocessor&oldid=837845 . The fix is heuristic, to avoid infinite backtracking or "alternate-reality" style branching in the preprocessToDom stack. Some edit section links will go missing despite my best efforts.
* Split the PPD stack out to its own class. Verified with a differential fuzz test.
* Added parser tests for Morwen/13 (including new heuristic behaviour) and bug 5678.
2008-01-17 03:23:07 +00:00
Tim Starling
7c62d6293e * Strip fragments from $parser->mTitle to avoid having them show up in odd places, like section edit links. Potential fix for a bug which is reproducible on test.wikipedia.org but not locally.
* Identifiable heading for limit report
2008-01-16 02:47:31 +00:00
Tim Starling
4fff963520 * Fixed loop detection in LST
* Renamed some LST parser tests
* Fixed <gallery> caption behaviour .It should not generate <pre> when there are spaces at the start. Used recursiveTagParse() instead of parse(), to avoid generation of a limit report, among other things.
* Refactored template loop check
* Updated a couple of parser tests
2008-01-14 06:59:20 +00:00
Tim Starling
4b461685e8 * Fix heading immediately after comment-on-own-line
* Fix ===== on own line
2008-01-14 03:43:14 +00:00
Tim Starling
28011713df Expansion cache for template arguments. Fixes the most common <ref> numbering bugs. I think the rest can be fixed in the Cite extension itself. I will give that a go later. 2008-01-13 12:47:38 +00:00
Tim Starling
9ed8fb3d9d Third time lucky? More complex method to obtain precise bug-for-bug compatibility with the old parser. 2008-01-13 09:23:58 +00:00
Tim Starling
2c83f549e1 Improved tplarg whitespace fix, following on from buggy r29685. 2008-01-13 08:51:09 +00:00
Tim Starling
1d5990f670 Fix handling for whitespace in template arguments. 2008-01-13 06:40:14 +00:00
Tim Starling
c0c8bc506b * Fixed template loop check, broken by changes in parse order
* Added template recursion depth limit. It needs a small limit, because of exorbitant stack space usage, xdebug compatibility problems, and the potential for O(N^2) memory usage in the template loop check.
* Made these two error messages more obvious in the parser output, with <span class="error"> instead of a comment. This is similar to the #expr error messages, which seem to have been well received by our template programmer community.
2008-01-11 03:25:41 +00:00
Domas Mituzas
74ea08c85b set OutputPage::mContainsOldMagic only for specific listed magic words
For now the suggested times are ignored and base 3600 is used for all dynamic ones
This makes templates more friendly parser-cache wise.
2008-01-09 20:47:46 +00:00
Tim Starling
6067e1ea8b Added {{#tag:}}: generic adaptor from parser function syntax to XML-style extension tag. Allows any extension tag (including nowiki and pre) to be called with input given by a template expansion. Inspired by [[Extension:TagParser]]. 2008-01-09 07:13:54 +00:00
Tim Starling
6533120d2d * Fixed handling of whitespace before HTML comments, slightly broken since r29292.
* Fixed ot['pre'] bug
2008-01-08 05:12:20 +00:00
Aaron Schulz
3ba2d84bd1 Revision timestamp comes out as the current time when no rev ID is given (like the first time prepareTextForEdit() is called). This works for new revisions, but is wrong for null edits. Needs to be flagged so that editUpdates() knows to parse after rev ID given so that it can get the last timestamp. 2008-01-06 03:17:09 +00:00
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