From: Tim Starling
Date: Fri, 19 Feb 2010 05:19:32 +0000 (+0000)
Subject: Moving Conrad's recent parser work out to a branch. Reverted r62434, r62416, r62150...
X-Git-Tag: 1.31.0-rc.0~37703
X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=f5b882aadcb5a3cc3d59f5c4c1bfb744a6b09046;p=lhc%2Fweb%2Fwiklou.git
Moving Conrad's recent parser work out to a branch. Reverted r62434, r62416, r62150, r62111, r62085, r62081, r62080, r62077, r62076, r62069, r62049, r62035.
---
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 738466e2f4..4dab4c57a6 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -321,12 +321,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
maintenance/tests/.
* importImages.php maintenance script can now use the original uploader and
comment from another wiki.
-* (bug 845) [[#foo|]], [[/bar|]] should be equivalent to [[#foo|foo]],
- [[/bar|bar]] (new use of "pipe trick")
-* (bug 21660) Support full-width commas for pipe trick
-* (bug 7264) Magic word to give Page Title as if pipe-trick performed on it
- {{pipetrick:}}
-* (bug 20339) Allow using the pipe trick in log reasons
* Support for Turck MMCache was removed
=== Bug fixes in 1.16 ===
@@ -756,10 +750,6 @@ comment from another wiki.
as it appears in extensions as was the case before r30117 where it
was unintentionally sorted along with other fields.
* (bug 19334) Textarea no longer jumps when editing longer articles in IE8
-* (bug 5210) preload parser should parse (as well as )
-* (bug 8785) Pipe trick should work with colon functions
-* (bug 4099) Pipe trick doesn't work when emptiness is only provided by empty
- template parameter
* Truncate summary of page moves in revision comment field to avoid broken
multibyte characters
* (bug 22540) ForeignApiRepos no longer try to store thumbnails that don't exist
diff --git a/includes/EditPage.php b/includes/EditPage.php
index a6a69a86d4..2d9c2ffd1c 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -227,13 +227,22 @@ class EditPage {
* @return string The contents of the page.
*/
protected function getPreloadedText( $preload ) {
- global $wgParser, $wgUser;
if ( !empty( $this->mPreloadText ) ) {
return $this->mPreloadText;
+ } elseif ( $preload === '' ) {
+ return '';
} else {
$preloadTitle = Title::newFromText( $preload );
if ( isset( $preloadTitle ) && $preloadTitle->userCanRead() ) {
- return $wgParser->getTransclusionText( $preloadTitle, ParserOptions::newFromUser( $wgUser ) );
+ $rev = Revision::newFromTitle( $preloadTitle );
+ if ( is_object( $rev ) ) {
+ $text = $rev->getText();
+ // TODO FIXME: AAAAAAAAAAA, this shouldn't be implementing
+ // its own mini-parser! -ævar
+ $text = preg_replace( '~?includeonly>~', '', $text );
+ return $text;
+ } else
+ return '';
}
}
}
diff --git a/includes/Linker.php b/includes/Linker.php
index fe2ffa5b6b..c049f47357 100644
--- a/includes/Linker.php
+++ b/includes/Linker.php
@@ -1086,11 +1086,6 @@ class Linker {
# Handle link renaming [[foo|text]] will show link as "text"
if( $match[3] != "" ) {
$text = $match[3];
- if( $match[1] === "" && $this->commentContextTitle ) {
- $match[1] = Linker::getPipeTrickLink( $text, $this->commentContextTitle );
- }
- } elseif( $match[2] == "|" ) {
- $text = Linker::getPipeTrickText( $match[1] );
} else {
$text = $match[1];
}
@@ -1210,79 +1205,6 @@ class Linker {
return $ret;
}
- /**
- * Returns valid title characters and namespace characters for pipe trick.
- *
- * FIXME: the namespace characters should not be specified like this...
- */
- static function getPipeTrickCharacterClasses() {
- global $wgLegalTitleChars;
- return array( "[$wgLegalTitleChars]", '[ _0-9A-Za-z\x80-\xff-]' );
- }
-
- /**
- * From the [[title|]] return link-text as though the used typed [[title|link-text]]
- *
- * For most links this be as though the user typed [[ns:title|title]]
- * However [[ns:title (context)|]], [[ns:title, context|]] and [[ns:title (context), context|]]
- * [[#title (context)|]] [[../context/title (context), context|]]
- * all return the |title]] with no context or indicative punctuation.
- *
- * @param string $link from [[$link|]]
- * @return string $text for [[$link|$text]]
- */
- static function getPipeTrickText( $link ) {
- static $rexps = FALSE;
- if( !$rexps ) {
- list( $tc, $nc ) = Linker::getPipeTrickCharacterClasses();
- $rexps = array (
- # try this first, to turn "[[A, B (C)|]]" into "A, B"
- "/^(:?$nc+:|[:#\/]|$tc+[\\/#]|)($tc+?)( \\($tc+\\)| ï¼$tc+ï¼)$/", # [[ns:page (context)|]]
- "/^(:?$nc+:|[:#\/]|$tc+[\\/#]|)($tc+?)( \\($tc+\\)| ï¼$tc+ï¼|)((?:,|ï¼) $tc+|)$/", # [[ns:page (context), context|]]
- );
- }
- $text = urldecode( $link );
-
- for( $i = 0; $i < count( $rexps ); $i++) {
- if( preg_match( $rexps[$i], $text, $m ) )
- return $m[2];
- }
- return $text;
- }
-
- /**
- * From the [[|link-text]] return the title as though the user typed [[title|link-text]]
- *
- * On most pages this will return link-text or "" if the link-text is not a valid title
- * On pages like [[ns:title (context)]] and [[ns:title, context]] it will act like
- * [[ns:link-text (context)|link-text]] and [[ns:link-text, context|link-text]]
- *
- * @param string $text from [[|$text]]
- * @param Title $title to resolve the link against
- * @return string $link for [[$link|$text]]
- */
- static function getPipeTrickLink( $text, $title ) {
- static $rexps = FALSE, $tc;
- if( !$rexps ) {
- list( $tc, $nc ) = Linker::getPipeTrickCharacterClasses();
- $rexps = array (
- "/^($nc+:|)$tc+?( \\($tc+\\)| ï¼$tc+ï¼)$/", # [[ns:page (context)|]]
- "/^($nc+:|)$tc+?(?:(?: \\($tc+\\)| ï¼$tc+ï¼|)((?:,|ï¼) $tc+|))$/" # [[ns:page (context), context|]]
- );
- }
-
- if( !preg_match( "/^$tc+$/", $text ) )
- return '';
-
- $t = $title->getText();
-
- for( $i = 0; $i < count( $rexps ); $i++) {
- if( preg_match( $rexps[$i], $t, $m ) )
- return "$m[1]$text$m[2]";
- }
- return $text;
- }
-
/**
* Wrap a comment in standard punctuation and formatting if
* it's non-empty, otherwise return empty string.
diff --git a/includes/MagicWord.php b/includes/MagicWord.php
index fe30215595..ecbdf81699 100644
--- a/includes/MagicWord.php
+++ b/includes/MagicWord.php
@@ -84,8 +84,6 @@ class MagicWord {
'revisionuser',
'subpagename',
'subpagenamee',
- 'pipetrick',
- 'pipetricke',
'talkspace',
'talkspacee',
'subjectspace',
diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php
index affc3e40a3..8abcc04f40 100644
--- a/includes/parser/CoreParserFunctions.php
+++ b/includes/parser/CoreParserFunctions.php
@@ -67,8 +67,6 @@ class CoreParserFunctions {
$parser->setFunctionHook( 'talkpagenamee', array( __CLASS__, 'talkpagenamee' ), SFH_NO_HASH );
$parser->setFunctionHook( 'subjectpagename', array( __CLASS__, 'subjectpagename' ), SFH_NO_HASH );
$parser->setFunctionHook( 'subjectpagenamee', array( __CLASS__, 'subjectpagenamee' ), SFH_NO_HASH );
- $parser->setFunctionHook( 'pipetrick', array( __CLASS__, 'pipetrick' ), SFH_NO_HASH );
- $parser->setFunctionHook( 'pipetricke', array( __CLASS__, 'pipetricke' ), SFH_NO_HASH );
$parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS );
$parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) );
@@ -441,27 +439,6 @@ class CoreParserFunctions {
return $t->getSubjectPage()->getPrefixedUrl();
}
- /**
- * Performs the pipe trick in the same manner as [[title|]] or [[|title]].
- * {{#pipetrick:title}} == {{#pipetrick:title|}} -> Parser::getPipeTrickText
- * {{#pipetrick:|title}} -> Parser::getPipeTrickLink (rarer)
- * See http://en.wikipedia.org/wiki/Help:Pipe_trick and the Parser documentation
- * for more information.
- */
- static function pipetrick( $parser, $link = '', $text = '' ) {
- if ( $link )
- return $parser->getPipeTrickText( $link );
- else
- return $parser->getPipeTrickLink( $text );
- }
-
- /**
- * Performs the pipetrick and then url encodes the result
- */
- static function pipetricke( $parser, $link = '', $text = '' ) {
- return wfUrlEncode( str_replace( ' ', '_', self::pipetrick( $parser, $link, $text ) ) );
- }
-
/**
* Return the number of pages in the given category, or 0 if it's nonexis-
* tent. This is an expensive parser function and can't be called too many
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 298aa3d41a..f7bb478b9e 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -15,7 +15,7 @@
* (which in turn the browser understands, and can display).
*
*
- * There are six main entry points into the Parser class:
+ * There are five main entry points into the Parser class:
* parse()
* produces HTML output
* preSaveTransform().
@@ -26,8 +26,6 @@
* Cleans a signature before saving it to preferences
* extractSections()
* Extracts sections from an article for section editing
- * getTransclusionText()
- * Extracts the text of a template with only , etc., parsed
*
* Globals used:
* objects: $wgLang, $wgContLang
@@ -84,7 +82,6 @@ class Parser
const OT_WIKI = 2;
const OT_PREPROCESS = 3;
const OT_MSG = 3;
- const OT_INCLUDES = 4;
// Marker Suffix needs to be accessible staticly.
const MARKER_SUFFIX = "-QINU\x7f";
@@ -371,29 +368,24 @@ class Parser
wfRunHooks( 'ParserBeforeTidy', array( &$this, &$text ) );
- if ( $this->mTransparentTagHooks ) {
- //!JF Move to its own function
- $uniq_prefix = $this->mUniqPrefix;
- $matches = array();
- $elements = array_keys( $this->mTransparentTagHooks );
- $text = self::extractTagsAndParams( $elements, $text, $matches, $uniq_prefix );
-
- foreach( $matches as $marker => $data ) {
- list( $element, $content, $params, $tag ) = $data;
- $tagName = strtolower( $element );
- if( isset( $this->mTransparentTagHooks[$tagName] ) ) {
- $output = call_user_func_array( $this->mTransparentTagHooks[$tagName],
- array( $content, $params, $this ) );
- } else {
- $output = $tag;
- }
- $this->mStripState->general->setPair( $marker, $output );
+//!JF Move to its own function
+
+ $uniq_prefix = $this->mUniqPrefix;
+ $matches = array();
+ $elements = array_keys( $this->mTransparentTagHooks );
+ $text = self::extractTagsAndParams( $elements, $text, $matches, $uniq_prefix );
+
+ foreach( $matches as $marker => $data ) {
+ list( $element, $content, $params, $tag ) = $data;
+ $tagName = strtolower( $element );
+ if( isset( $this->mTransparentTagHooks[$tagName] ) ) {
+ $output = call_user_func_array( $this->mTransparentTagHooks[$tagName],
+ array( $content, $params, $this ) );
+ } else {
+ $output = $tag;
}
+ $this->mStripState->general->setPair( $marker, $output );
}
-
- # This was originally inserted for transparent tag hooks (now deprecated)
- # but some extensions (notably ) rely on the extra unstripGeneral()
- # after unstripNoWiki() so they can modify the contents of tags.
$text = $this->mStripState->unstripGeneral( $text );
$text = Sanitizer::normalizeCharReferences( $text );
@@ -497,26 +489,6 @@ class Parser
return $text;
}
- /**
- * Get the wikitext of a page as though it was transcluded.
- *
- * Specifically etc. are parsed, redirects are followed, comments
- * are removed, but templates arguments and parser functions are untouched.
- *
- * This is not called by the parser itself, see braceSubstitution for its transclusion.
- */
- public function getTransclusionText( $title, $options ) {
- // Must initialize first
- $this->clearState();
- $this->setOutputType( self::OT_INCLUDES );
- $this->mOptions = $options;
- $this->setTitle( new FakeTitle );
-
- list( $text, $title ) = $this->getTemplateDom( $title );
- $flags = PPFrame::NO_ARGS | PPFrame::NO_TEMPLATES;
- return $this->getPreprocessor()->newFrame()->expand( $text, $flags );
- }
-
/**
* Get a random string
*
@@ -1522,7 +1494,7 @@ class Parser
if ( !$tc ) {
$tc = Title::legalChars() . '#%';
# Match a link having the form [[namespace:link|alternate]]trail
- $e1 = "/^([{$tc}]*)(\\|.*?)?]](.*)\$/sD";
+ $e1 = "/^([{$tc}]+)(?:\\|(.+?))?]](.*)\$/sD";
# Match cases where there is no "]]", which might still be images
$e1_img = "/^([{$tc}]+)\\|(.*)\$/sD";
}
@@ -1602,15 +1574,7 @@ class Parser
wfProfileIn( __METHOD__."-e1" );
if ( preg_match( $e1, $line, $m ) ) { # page with normal text or alt
-
- if( $m[2] === '' ) {
- $text = '';
- } elseif( $m[2] === '|' ) {
- $text = $this->getPipeTrickText( $m[1] );
- } else {
- $text = substr( $m[2], 1 );
- }
-
+ $text = $m[2];
# If we get a ] at the beginning of $m[3] that means we have a link that's something like:
# [[Image:Foo.jpg|[http://example.com desc]]] <- having three ] in a row fucks up,
# the real problem is with the $e1 regex
@@ -1627,20 +1591,18 @@ class Parser
$text .= ']'; # so that replaceExternalLinks($text) works later
$m[3] = substr( $m[3], 1 );
}
-
- # Handle pipe-trick for [[|]]
- $lnk = $m[1] === '' ? $this->getPipeTrickLink( $text ) : $m[1];
# fix up urlencoded title texts
- if( strpos( $lnk, '%' ) !== false ) {
+ if( strpos( $m[1], '%' ) !== false ) {
# Should anchors '#' also be rejected?
- $lnk = str_replace( array('<', '>'), array('<', '>'), urldecode($lnk) );
+ $m[1] = str_replace( array('<', '>'), array('<', '>'), urldecode($m[1]) );
}
-
$trail = $m[3];
} elseif( preg_match($e1_img, $line, $m) ) { # Invalid, but might be an image with a link in its caption
$might_be_img = true;
$text = $m[2];
- $lnk = strpos( $m[1], '%' ) === false ? $m[1] : urldecode( $m[1] );
+ if ( strpos( $m[1], '%' ) !== false ) {
+ $m[1] = urldecode($m[1]);
+ }
$trail = "";
} else { # Invalid form; output directly
$s .= $prefix . '[[' . $line ;
@@ -1653,7 +1615,7 @@ class Parser
# Don't allow internal links to pages containing
# PROTO: where PROTO is a valid URL protocol; these
# should be external links.
- if ( preg_match( '/^\b(?:' . wfUrlProtocols() . ')/', $lnk ) ) {
+ if ( preg_match( '/^\b(?:' . wfUrlProtocols() . ')/', $m[1] ) ) {
$s .= $prefix . '[[' . $line ;
wfProfileOut( __METHOD__."-misc" );
continue;
@@ -1661,12 +1623,12 @@ class Parser
# Make subpage if necessary
if ( $useSubpages ) {
- $link = $this->maybeDoSubpageLink( $lnk, $text );
+ $link = $this->maybeDoSubpageLink( $m[1], $text );
} else {
- $link = $lnk;
+ $link = $m[1];
}
- $noforce = (substr( $lnk, 0, 1 ) !== ':');
+ $noforce = (substr( $m[1], 0, 1 ) !== ':');
if (!$noforce) {
# Strip off leading ':'
$link = substr( $link, 1 );
@@ -1914,25 +1876,6 @@ class Parser
return Linker::normalizeSubpageLink( $this->mTitle, $target, $text );
}
- /**
- * From the [[title|]] return link-text as though the used typed [[title|link-text]]
- * @param string $link from [[$link|]]
- * @return string $text for [[$link|$text]]
- */
- function getPipeTrickText( $link ) {
- return Linker::getPipeTrickText( $link );
- }
-
- /**
- * From the [[|link-text]] return the title as though the user typed [[title|link-text]]
- * @param string $text from [[|$text]]
- * @param Title $title to resolve the link against
- * @return string $link for [[$link|$text]]
- */
- function getPipeTrickLink( $text ) {
- return Linker::getPipeTrickLink( $text, $this->mTitle );
- }
-
/**#@+
* Used by doBlockLevels()
* @private
@@ -2495,14 +2438,6 @@ class Parser
$subjPage = $this->mTitle->getSubjectPage();
$value = $subjPage->getPrefixedUrl();
break;
- case 'pipetrick':
- $text = $this->mTitle->getText();
- $value = $this->getPipeTrickText( $text );
- break;
- case 'pipetricke':
- $text = $this->mTitle->getText();
- $value = wfUrlEncode( str_replace( ' ', '_', $this->getPipeTrickText( $text ) ) );
- break;
case 'revisionid':
// Let the edit saving system know we should parse the page
// *after* a revision ID has been assigned.
@@ -4045,11 +3980,32 @@ class Parser
'~~~' => $sigText
) );
- # Links of the form [[|]] or [[|]] perform pipe tricks
- # Note this only allows the # in the position it works.
+ # Context links: [[|name]] and [[name (context)|]]
+ #
global $wgLegalTitleChars;
- $pipeTrickRe = "/\[\[(?:(\\|)([$wgLegalTitleChars]+)|([#$wgLegalTitleChars]+)\\|)\]\]/";
- $text = preg_replace_callback( $pipeTrickRe, array( $this, 'pstPipeTrickCallback' ), $text );
+ $tc = "[$wgLegalTitleChars]";
+ $nc = '[ _0-9A-Za-z\x80-\xff-]'; # Namespaces can use non-ascii!
+
+ $p1 = "/\[\[(:?$nc+:|:|)($tc+?)( \\($tc+\\))\\|]]/"; # [[ns:page (context)|]]
+ $p4 = "/\[\[(:?$nc+:|:|)($tc+?)(ï¼$tc+ï¼)\\|]]/"; # [[ns:pageï¼contextï¼|]]
+ $p3 = "/\[\[(:?$nc+:|:|)($tc+?)( \\($tc+\\)|)(, $tc+|)\\|]]/"; # [[ns:page (context), context|]]
+ $p2 = "/\[\[\\|($tc+)]]/"; # [[|page]]
+
+ # try $p1 first, to turn "[[A, B (C)|]]" into "[[A, B (C)|A, B]]"
+ $text = preg_replace( $p1, '[[\\1\\2\\3|\\2]]', $text );
+ $text = preg_replace( $p4, '[[\\1\\2\\3|\\2]]', $text );
+ $text = preg_replace( $p3, '[[\\1\\2\\3\\4|\\2]]', $text );
+
+ $t = $this->mTitle->getText();
+ $m = array();
+ if ( preg_match( "/^($nc+:|)$tc+?( \\($tc+\\))$/", $t, $m ) ) {
+ $text = preg_replace( $p2, "[[$m[1]\\1$m[2]|\\1]]", $text );
+ } elseif ( preg_match( "/^($nc+:|)$tc+?(, $tc+|)$/", $t, $m ) && "$m[1]$m[2]" != '' ) {
+ $text = preg_replace( $p2, "[[$m[1]\\1$m[2]|\\1]]", $text );
+ } else {
+ # if there's no context, don't bother duplicating the title
+ $text = preg_replace( $p2, '[[\\1]]', $text );
+ }
# Trim trailing whitespace
$text = rtrim( $text );
@@ -4057,25 +4013,6 @@ class Parser
return $text;
}
- /**
- * Called from pstPass2 to perform the pipe trick on links.
- * Original was either [[|text]] or [[link|]]
- *
- * @param Array ("|" or "", text, link) $m
- */
- function pstPipeTrickCallback( $m )
- {
- if( $m[1] ) { # [[|]]
- $text = $m[2];
- $link = $this->getPipeTrickLink( $text );
- } else { # [[|]]
- $link = $m[3];
- $text = $this->getPipeTrickText( $link );
- }
-
- return $link === $text ? "[[$link]]" : "[[$link|$text]]";
- }
-
/**
* Fetch the user's signature text, if any, and normalize to
* validated, ready-to-insert wikitext.
@@ -4256,9 +4193,7 @@ class Parser
return $oldVal;
}
- /* An old work-around for bug 2257 - deprecated 2010-02-13 */
function setTransparentTagHook( $tag, $callback ) {
- wfDeprecated( __METHOD__ );
$tag = strtolower( $tag );
$oldVal = isset( $this->mTransparentTagHooks[$tag] ) ? $this->mTransparentTagHooks[$tag] : null;
$this->mTransparentTagHooks[$tag] = $callback;
diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php
index c8f0c006eb..e3643f2f5e 100644
--- a/languages/messages/MessagesEn.php
+++ b/languages/messages/MessagesEn.php
@@ -263,8 +263,6 @@ $magicWords = array(
'talkpagenamee' => array( 1, 'TALKPAGENAMEE' ),
'subjectpagename' => array( 1, 'SUBJECTPAGENAME', 'ARTICLEPAGENAME' ),
'subjectpagenamee' => array( 1, 'SUBJECTPAGENAMEE', 'ARTICLEPAGENAMEE' ),
- 'pipetrick' => array( 1, 'PIPETRICK' ),
- 'pipetricke' => array( 1, 'PIPETRICKE' ),
'msg' => array( 0, 'MSG:' ),
'subst' => array( 0, 'SUBST:' ),
'safesubst' => array( 0, 'SAFESUBST:' ),
diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt
index 023f955a1b..860b589465 100644
--- a/maintenance/parserTests.txt
+++ b/maintenance/parserTests.txt
@@ -2021,41 +2021,6 @@ title=[[User:Ãvar Arnfjörð Bjarmason]]
!! end
-!! test
-Magic Word: {{PIPETRICK}}
-!! options
-title=[[Some (page)]]
-!! input
-{{PIPETRICK}}
-{{PIPETRICK:Hello (one)}}
-{{PIPETRICK:World, hi|}}
-{{PIPETRICK:|Other}}
-!! result
-Some
-Hello
-World
-Other (page)
-
-!! end
-
-!! test
-Magic Word: {{PIPETRICKE}}
-!! options
-title=[[Some other (page)]]
-!! input
-{{PIPETRICKE}}
-{{PIPETRICKE:User:Ãvar Arnfjörð Bjarmason}}
-{{PIPETRICKE:#Something to do|}}
-{{PIPETRICKE:|The?last}}
-!! result
-Some_other
-%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
-Something_to_do
-The%3Flast_(page)
-
-!! end
-
-
!! test
Magic Word: {{REVISIONID}}
!! input
@@ -3033,48 +2998,6 @@ pst
[[:Bar:X (Y) Z|X (Y) Z]]
!! end
-!! test
-pre-save transform: context links ("pipe trick") based on current page
-!! options
-pst
-!! input
-[[#section|]]
-[[#section (context)|]]
-[[/relative|]]
-[[../context/relative|]]
-[[../context/relative (extra)|]]
-!! result
-[[#section|section]]
-[[#section (context)|section]]
-[[/relative|relative]]
-[[../context/relative|relative]]
-[[../context/relative (extra)|relative]]
-!! end
-
-!! test
-pre-save transform: context links ("pipe trick") to sections on other pages
-!! options
-pst
-!! input
-[[other#page|]]
-[[Help:Somewhere/completely (wierd)#section (two)|]]
-!! result
-[[other#page|page]]
-[[Help:Somewhere/completely (wierd)#section (two)|section]]
-!! end
-
-!! test
-pre-save transform: context links ("pipe trick") with full-width characters
-!! options
-pst
-!! input
-[[titleï¼ context|]]
-[[title ï¼contextï¼|]]
-!! result
-[[titleï¼ context|title]]
-[[title ï¼contextï¼|title]]
-!! end
-
!! test
pre-save transform: context links ("pipe trick") with interwiki prefix
!! options
@@ -3189,65 +3112,6 @@ pst title=[[Ns:Somearticle (IGNORED), Context]]
[[Ns:Article, Context|Article]]
!! end
-!! test
-pre-save transform: context links ("pipe trick") with url escaped page names
-!! options
-pst
-!! input
-[[Hello wo%52ld|]]
-[[Hello wo%52ld (again)|]]
-!! result
-[[Hello wo%52ld|Hello woRld]]
-[[Hello wo%52ld (again)|Hello woRld]]
-!! end
-
-!! test
-pre-save transform: context links ("pipe trick") with variables are not pre-empted
-!! options
-pst title=[[Test (page)]]
-!! input
-[[{{{1|}}}|]]
-[[|{{{1|}}}]]
-[[{{subst:PAGENAME}}|]]
-!! result
-[[{{{1|}}}|]]
-[[|{{{1|}}}]]
-[[Test (page)|Test]]
-!! end
-
-!! article
-Template:pipetest
-!! text
-[[{{{1}}}|]]
-!! endarticle
-
-!! article
-Template:testpipe
-!! text
-[[|{{{1}}}]]
-!! endarticle
-
-!! test
-("pipe trick") should work outside PST
-!!options
-title=[[Help:hello (world)]]
-!! input
-{{pipetest|hi (world)}}
-{{pipetest|hi (world), world}}
-{{pipetest|Help:hi (world), world}}
-{{pipetest|:Help:hi (world), world}}
-{{testpipe|hi}}
-[[{{PAGENAME}}|]]
-!! result
-hi
-hi
-hi
-hi
-hi
-Hello
-
-!! end
-
###
### Message transform tests
@@ -7745,17 +7609,6 @@ title=[[Main Page]]
#section
!! end
-!! test
-Edit comment with pipe trick
-!! options
-comment
-title=[[Article (context)]]
-!! input
-[[Hello (World)|]] [[|Entry]]
-!! result
-Hello Entry
-!! end
-
!!article
MediaWiki:bad image list
!!text