Page MenuHomePhabricator

diff.patch

Authored By
bzimport
Nov 21 2014, 7:01 PM
Size
2 KB
Referenced Files
None
Subscribers
None

diff.patch

Index: includes/parser/CoreParserFunctions.php
===================================================================
--- includes/parser/CoreParserFunctions.php (revision 107718)
+++ includes/parser/CoreParserFunctions.php (working copy)
@@ -80,6 +80,7 @@
$parser->setFunctionHook( 'subjectpagenamee', array( __CLASS__, 'subjectpagenamee' ), SFH_NO_HASH );
$parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS );
$parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) );
+ $parser->setFunctionHook( 'nometa', array( __CLASS__, 'nometa' ), SFH_OBJECT_ARGS | SFH_NO_HASH );
if ( $wgAllowDisplayTitle ) {
$parser->setFunctionHook( 'displaytitle', array( __CLASS__, 'displaytitle' ), SFH_NO_HASH );
@@ -794,4 +795,25 @@
);
return $parser->extensionSubstitution( $params, $frame );
}
+
+ /**
+ * Modifier to template so categories/other user-visible metadata is not transcluded.
+ *
+ * Using SFH_NO_HASH, to be like int: (and look like raw:, msg:, msgnw:, etc)
+ *
+ * This doesn't disable {{DISPLAYTITLE:...}}. {{DEFAULTSORT:...}}. I wasn't sure if it should or not.
+ */
+ public static function nometa( $parser, $frame, $arg ) {
+ $output = $parser->getOutput();
+ $langLinks = $output->getLanguageLinks();
+ $catLinks = $output->getCategoryLinks();
+
+ $wikiText = $frame->expand( $frame->virtualBracketedImplode( '{{', '|', '}}', $arg ) );
+ $parsed = $parser->recursiveTagParse( $wikiText, $frame );
+
+ $output->setLanguageLinks( $langLinks );
+ $output->setCategoryLinks( $catLinks );
+
+ return array( $parsed, 'isHTML' => true );
+ }
}
Index: languages/messages/MessagesEn.php
===================================================================
--- languages/messages/MessagesEn.php (revision 107718)
+++ languages/messages/MessagesEn.php (working copy)
@@ -348,6 +348,7 @@
'staticredirect' => array( 1, '__STATICREDIRECT__' ),
'protectionlevel' => array( 1, 'PROTECTIONLEVEL' ),
'formatdate' => array( 0, 'formatdate', 'dateformat' ),
+ 'nometa' => array( 0, 'NOMETA' ),
'url_path' => array( 0, 'PATH' ),
'url_wiki' => array( 0, 'WIKI' ),
'url_query' => array( 0, 'QUERY' ),

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1240
Default Alt Text
diff.patch (2 KB)

Event Timeline