Commit graph

499 commits

Author SHA1 Message Date
Platonides
49e6e233ec Bug 33845: Headings become cursive in TOC when they contain an image
Fixes the problems with r102179 and r102179, as there are
valid tags which begin the same, which meant they were not removed from
the TOC (the second regex, intended to remove tag parameters, then converted
<img or <blockquote> into <i> / <b>).
The same problem existed in the original regex, but as there are no valid 
tags which begin with sup or sub, it never happened).

Added comment explaining the tocline regex, and added a bunch of parser tests.
2012-01-21 16:27:27 +00:00
Max Semenik
b7e7a6c76e Made Parser::addTrackingCategory() public to benefit tag hooks/parser functions developers 2012-01-11 15:42:29 +00:00
Niklas Laxström
0865348cd4 Missing @since tags have a yet another victim 2012-01-09 19:11:55 +00:00
Sam Reed
7632e4a26f * (bug 33525) clearTagHooks doesn't clear function hooks.
* (bug 33523) Function tag hooks don't appear on Special:Version.

Patches by Nikola Kovacs
2012-01-04 21:30:06 +00:00
Antoine Musso
f6df3e972d revert r107006
(bug 23427) Introduced {{PAGEID}} variable to expose page.page_id
[patch by Waldir]
2012-01-04 09:08:16 +00:00
Brian Wolff
770cd71b51 (bug 31469) Make sure tracking category messages expand variables like
{{NAMESPACE}} relative to the Title of the currently being parsed page.

Basically wfMsgForContent expands messages with wrong title while doing linksupdate stuff via job queue. For the broken file tracking category (r86534),Wikipedia folk want to sort the page into different categories based on namespace, and for some namespaces not categorize them at all (After all, a broken file link in a talk namespace is often not a bad thing).

Anyhow, explicitly set the title object for the message using wfMessage. There's probably deeper issues here in regards to why wfMsg et al is using wrong title, but this should fix the immediate issue.
2011-12-30 06:44:38 +00:00
Danny B
ff2ef8285a * (bug 23427) Introduced {{PAGEID}} variable to expose page.page_id [patch by Waldir] 2011-12-21 23:19:24 +00:00
Brian Wolff
4df8e9d595 Throw an exception if Parser::disableCache is called before mOutput initialized (Aka when not parsing something).
So far I've encountered 2 extensions that give fatal errors from calling $wgParser->disableOutput() from hooks that are called at points where parsing is not taking place! Exception with a backtrace is much nicer than "Fatal error: Call to a member function disableCache() on a non-object..."
2011-12-15 07:17:29 +00:00
Jeroen De Dauw
4544a78316 rem use of escapeLocalURL 2011-12-13 04:58:48 +00:00
Tim Starling
71e27e22de * Revert r103476, r105161 and implement the fix for bug 32858 (a.k.a. bug 32450) in WikiPage instead. See comment 14 for further rationale.
* Clarified release notes. Please write what the new code does, not the bug description.
2011-12-09 10:32:55 +00:00
Chad Horohoe
a1f5c6ce73 Minor tweaks to cleanSig(inSig)
* Make cleanSig public, since it's a declared entry point per class docs
* Make cleanSigInSig public static, added 2 more test cases for it
2011-12-06 23:07:13 +00:00
Antoine Musso
144ffcc01a allow bold in TOC lines
just like r102179 allowed italics in TOC lines for bug 26375, this
patch allow bold text as well.
2011-12-06 10:50:47 +00:00
Antoine Musso
7fc6a7aae0 Skip replaceInternalLinks2 for js/css pages
Just skip the whole replaceInternalLinks2 parser function whenever we hit
js/css pages. Previous patch r103476 only handled Category links which was
not enough.
2011-12-05 10:14:40 +00:00
John Du Hart
51a6eadec1 Followup r103817, updating setLang usages 2011-11-23 10:28:21 +00:00
Antoine Musso
78562bd14c (bug 32450) MediaWiki: .js|.css pages parsed [[Category:#]] links
This patch skip the [[Category:#]] parsing logic when the Title is in
NS_MEDIAWIKI and ends with .js or .css. This way the code is kept as is
and pages are no more categorized.

How to reproduce the issue:

	$ echo 'var foo = "[[Category:bug32450]]"' \
	| php maintenance/parse.php --title MediaWiki:Foobar.js
	<p>var foo = ""
	</p>
	$

Note how the text got stripped.

After this patch:

	$ echo 'var foo = "[[Category:bug32450]]"' \
	| php maintenance/parse.php --title MediaWiki:Foobar.js
	<p>var foo = "[[Category:bug32450]]"
	</p>
	$

TEST PLAN:
==========

$ php parserTests.php --quiet
This is MediaWiki version 1.19alpha (r103473).

Reading tests from "tests/parser/parserTests.txt"...
Reading tests from "tests/parser/extraParserTests.txt"...
Passed 654 of 654 tests (100%)... ALL TESTS PASSED!
$
2011-11-17 16:46:45 +00:00
Platonides
528a450f68 Attempt to fix translatewiki bug 32057
The different Preprocessor::newChild expect false (with strict comparison) if there's no title passed to them.
2011-11-08 20:58:57 +00:00
Platonides
c77380f9c2 Bug 26375 - Italics should be passed to TOC
http://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_%28technical%29&oldid=403630551#Italics_in_ToC
2011-11-06 15:07:34 +00:00
Aaron Schulz
6c4360c951 Make use of Title::isSpecialPage() in various places 2011-11-02 20:55:08 +00:00
Aaron Schulz
7377d6c080 Added pfunc profiling to braceSubstitution() 2011-10-27 21:53:37 +00:00
Platonides
d581e9dd5a Removal of unused globals 2011-10-27 20:48:09 +00:00
Aaron Schulz
9a932c4bc8 Fixed braceSubstitution() to only profile templates rather than all kinds of possibly long strings of text to parse. It was dumping the whole text as the name of the profiling entry. 2011-10-27 01:19:34 +00:00
Platonides
8d0c01d751 If the page contains __NOEDITSECTION__, it will never have edit sections, so don't create markers. Follow-up r99250.
Fix for bug 31647: Regression: __NOEDITSECTION__ is ignored when the page is read from the parser cache
2011-10-25 22:18:33 +00:00
Alexandre Emsenhuber
0ba7a5f510 * (bug 31921) Fix for r78201: magic words REVISIONDAY, REVISIONMONTH and REVISIONYEAR now give current values on preview 2011-10-24 16:14:49 +00:00
Alexandre Emsenhuber
d491ae56a7 Follow-up r100227:
* Missed one call to ParserOptions::getUserLang() in Parser
* Also convert RefreshLinksJob and RefreshLinksJob2 to use ParserOptions::newFromUserAndLang() and pass $wgContLang instead of whatever $wgLang could be
2011-10-19 15:30:02 +00:00
Alexandre Emsenhuber
bd548f36e9 * Changed ParserOptions to store a Language object instead of only a string, avoids object -> string -> object conversion
* ParserOptions::getUserLang() will still return a string for compatibility, added ParserOptions::getUserLangObj() to get the object
* Added ParserOptions::newFromUserAndLang() and ParserOptions::newFromContext() to easily get a ParserOptions object when a context is available or when someone wants to force the language
* Updated OutputPage and Preferences to use newFromContext() and WikiPage to use newFromUserAndLang()
* ParserOptions::setUserLang() still accepts either a string or a Language object, but changed the calls to pass an object instead of a string
* Changed Parser::getFunctionLang() to return the Language object from ParserOptions when parsing interface messages rather than $wgLang directly and updated the documentation to say that $wgLang should not be used directly (as $wgUser, $wgTitle and $wgRequest)
2011-10-19 14:16:01 +00:00
Platonides
4d065bb19f Bug 31445: "Section edit links do not show"
Always generate the mw:editsection placeholders.
Remove them if not used.
Update the ParserOutput if fetching from ParserCache
2011-10-07 20:50:10 +00:00
Sam Reed
937fc3bcfd Back out r95396 and friends 2011-09-29 22:08:00 +00:00
Alexandre Emsenhuber
0a45e7dc76 Per Aaron, follow-up r93758: add coments and fix typos 2011-09-29 15:14:34 +00:00
Chad Horohoe
c7e950e474 Also add $wgRequest to the forbidden globals...thought it was common sense. 2011-09-27 18:56:44 +00:00
Roan Kattouw
dc4ab75a51 Fix stupid typo in r98193, thanks Dantman 2011-09-26 23:16:32 +00:00
Roan Kattouw
95e857198b (bug 31176) {{SERVERNAME}} doesn't play nice with protocol-relative URLs 2011-09-26 23:14:20 +00:00
Robin Pepermans
07dc087494 Re-do r96798 ("LanguageConverter now depends on the page content language"), without the change in WikiPage which caused an infinite loop (see bug 31098) 2011-09-22 20:31:23 +00:00
Tim Starling
70105f8b85 Reverted r85922 and related: new doTableStuff(). I copied in the old doTableStuff() from before r85922 and reverted all parser test changes that looked vaguely related. Apologies to Platonides, since some of his parser tests appeared to be relevant to the old parser, but it's simplest to just revert all the related changes and then re-add any useful tests later. See CR r85922 for full rationale. 2011-09-15 12:10:53 +00:00
Sam Reed
fb32210aee Whitespace/documentation 2011-09-14 15:07:20 +00:00
Niklas Laxström
c48b41201a Revert r96798 - makes parser go infinite loop somewhere 2011-09-14 11:23:58 +00:00
Aaron Schulz
42ead260a4 Removed parser hacks from r88740, r88741, r88780 2011-09-13 20:26:41 +00:00
Aaron Schulz
23d5a27e2e Reverted r86072, r86419 per CR. Lots of conflicts resolved here. Removes lineStart from r87346 code as well for preprocess parser tests. 2011-09-12 19:16:22 +00:00
Robin Pepermans
75932b439d * r96737: set OutputPage->addWikiText() as an interface message by default
* r96760: use 'noflip' for $flip in OutputPage->addInlineStyle() so it's always a string
* Add some parameter documentation
2011-09-11 21:07:17 +00:00
Robin Pepermans
9a6efcc3e4 (Bug 30364) LanguageConverter should depend on the page content language instead of the wiki content language. Remains largely the same, except for extensions using the PageContentLanguage hook like Translate and WikimediaIncubator.
* Made variant tabs hidden on special pages (has no or sometimes wrong/inconsistent effect there; plus it's mainly in the user language)
* Made redirects be in content language again (remove from Title->getPageLanguage())
2011-09-11 17:56:27 +00:00
Robin Pepermans
4ae1ef34c1 Per r90858 CR, throw MW exception on missing title context 2011-09-07 04:05:37 +00:00
Aaron Schulz
9d572d1844 Cleanup to r84610 per CR: changed BeforeParserMakeImageLinkObj hook to use a RepoGroup style param array that also excepts a 'broken' parameter. This new parameter replaces the odd "use timestamp '0' to make a broken thumbnail' convention. No other callers are using this hook other than FR, so the old time/sha1 params where removed. 2011-09-06 18:11:53 +00:00
Tim Starling
76f3bb9227 Reverted r84357 and r90461 and fixed the bug in a better way: in an empty document, consider section zero to exist, and to be empty, effectively representing the whole document. This allows section zero of a blank page to be viewed and edited with no updates to EditPage. 2011-09-05 06:56:08 +00:00
Aaron Schulz
6c34627a63 Reverted parser bump from r84601 per CR 2011-09-02 23:14:08 +00:00
Sam Reed
44020e254c Merge the iwtransclusion branch back into trunk
Hexmode fixed broken unit tests in revisions after last time
2011-08-24 13:03:03 +00:00
Brian Wolff
e15cb2b9db Follow-up r86534 - Do not add tracking categories if we're looking at a special page.
Thank you Nikerabbit for suggesting how to fix.
2011-08-21 18:46:01 +00:00
Roan Kattouw
b4ae56dea1 Per r90849, factor out most of the code that's duplicated between Parser::getExternalLinkAttribs() and Skin::addToSidebarPlain() into wfMatchesDomainList(). Change a loose comparison to a strict one, and add a FIXME comment about how whitelisting nl.wikipedia.org also whitelists nds-nl.wikipedia.org due to the function's simplistic substring approach. 2011-08-20 10:18:09 +00:00
Brian Wolff
c909720031 Follow-up r94680 - fix unit tests.
The way the magic variable unit tests are run looks a little sketchy to me...
2011-08-17 00:46:58 +00:00
Robin Pepermans
4948e56719 Magic words (time and number-formatting ones, plus DIRECTIONMARK, but not NAMESPACE) now depend on the page content language instead of the site language. In theory this sets the right magic words in system messages, although they are not used there.
Useful for multilingual wikis like Incubator, and probably for extensions like Translate.
2011-08-16 19:29:52 +00:00
Roan Kattouw
48bbe8b848 (bug 30269) Strings like foobar//barfoo are linked to become foobar[//barfoo]
* Introduce a boolean parameter to wfUrlProtocols() which, if set to false, will cause '//' to be dropped from the returned regex so it doesn't match protocol-relative URLs
* Introduce wfUrlProtocolsWithoutProtRel() as a wrapper for wfUrlProtocols( false ). The latter should not be used directly because the former is much clearer
* Use this new function in Parser::doMagicLinks() to fix the original bug. Also use it in ApiFormatBase::formatHTML() and CodeCommentLinker::link(), which probably had similar bugs
2011-08-15 12:20:00 +00:00
Alexandre Emsenhuber
76478abafe Added Parser::recursivePreprocess(); like preprocess() but doesn't call startParse() so that it can be used inside a parse operation using the same context without having to mess with other functions
Simple use case (PHP 5.3+) that will work show the expand text passed to a <preprocess> tag:
$wgHooks['ParserFirstCallInit'][] = function( $parser ) {
	$parser->setHook( 'preprocess', function( $text, $attr, $parser, $frame ) {
		return $parser->recursivePreprocess( $text, $frame );
	} );
	return true;
};
2011-08-14 20:22:52 +00:00