https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112117
Revision: 112117
Author: gwicke
Date: 2012-02-22 16:41:01 +0000 (Wed, 22 Feb 2012)
Log Message:
-----------
Follow-up to r112116, accidentally committed from subdirectory.
Modified Paths:
--------------
trunk/extensions/VisualEditor/modules/parser/ext.core.ParserFunctions.js
Modified:
trunk/extensions/VisualEditor/modules/parser/ext.core.ParserFunctions.js
===================================================================
--- trunk/extensions/VisualEditor/modules/parser/ext.core.ParserFunctions.js
2012-02-22 16:39:50 UTC (rev 112116)
+++ trunk/extensions/VisualEditor/modules/parser/ext.core.ParserFunctions.js
2012-02-22 16:41:01 UTC (rev 112117)
@@ -41,7 +41,7 @@
kv = kvs[i];
// XXX: tokensToString actually strips too much here! Anything
// non-stringish should not match at all.
- if ( this.manager.env.tokensToString( kv.v ).trim() === key ) {
+ if ( this.manager.env.tokensToString( kv.v ) === key ) {
// found. now look for the next entry with a non-empty
key.
for ( var j = i; j < l; j++) {
kv = kvs[j];
@@ -152,15 +152,31 @@
ParserFunctions.prototype['pf_currentmonthname'] = function ( target, argList,
argDict ) {
return this['pf_#time']( 'F', [], {} );
};
+// XXX Actually use genitive form!
+ParserFunctions.prototype['pf_currentmonthnamegen'] = function ( target,
argList, argDict ) {
+ return this['pf_#time']( 'F', [], {} );
+};
ParserFunctions.prototype['pf_currentmonthabbrev'] = function ( target,
argList, argDict ) {
return this['pf_#time']( 'M', [], {} );
};
+ParserFunctions.prototype['pf_currentweek'] = function ( target, argList,
argDict ) {
+ return this['pf_#time']( 'W', [], {} );
+};
+ParserFunctions.prototype['pf_currentdow'] = function ( target, argList,
argDict ) {
+ return this['pf_#time']( 'w', [], {} );
+};
ParserFunctions.prototype['pf_currentday'] = function ( target, argList,
argDict ) {
return this['pf_#time']( 'j', [], {} );
};
+ParserFunctions.prototype['pf_currentday2'] = function ( target, argList,
argDict ) {
+ return this['pf_#time']( 'd', [], {} );
+};
ParserFunctions.prototype['pf_currentdayname'] = function ( target, argList,
argDict ) {
return this['pf_#time']( 'l', [], {} );
};
+ParserFunctions.prototype['pf_currenttime'] = function ( target, argList,
argDict ) {
+ return this['pf_#time']( 'H:i', [], {} );
+};
// A first approximation of time stuff.
// TODO: Implement time spec (+ 1 day etc), check if formats are complete etc.
@@ -350,7 +366,7 @@
};
ParserFunctions.prototype['pf_localurl'] = function ( target, argList, argDict
) {
- return ( this.manager.env.wgScriptPath + '/index' +
+ return ( this.manager.env.wgScriptPath + 'index' +
this.manager.env.wgScriptExtension + '?title=' +
this.manager.env.normalizeTitle( target ) + '&'
+
argList.map(
@@ -394,7 +410,6 @@
return [target.trim()];
};
-
// The following items all depends on information from the Wiki, so are hard
// to implement independently. Some might require using action=parse in the
// API to get the value. See
@@ -414,9 +429,6 @@
ParserFunctions.prototype['pf_anchorencode'] = function ( target, argList,
argDict ) {
return [target];
};
-ParserFunctions.prototype['pf_namespace'] = function ( target, argList,
argDict ) {
- return ['Main'];
-};
ParserFunctions.prototype['pf_protectionlevel'] = function ( target, argList,
argDict ) {
return [''];
};
@@ -438,7 +450,23 @@
ParserFunctions.prototype['pf_contentlang'] = function ( target, argList,
argDict ) {
return ['en'];
};
+ParserFunctions.prototype['pf_numberoffiles'] = function ( target, argList,
argDict ) {
+ return ['2'];
+};
+ParserFunctions.prototype['pf_namespace'] = function ( target, argList,
argDict ) {
+ return [target.split(':').pop() || 'Main'];
+};
+ParserFunctions.prototype['pf_namespacee'] = function ( target, argList,
argDict ) {
+ return [target.split(':').pop() || 'Main'];
+};
+ParserFunctions.prototype['pf_pagename'] = function ( target, argList, argDict
) {
+ return ['Main page'];
+};
+ParserFunctions.prototype['pf_scriptpath'] = function ( target, argList,
argDict ) {
+ return [this.manager.env.wgScriptPath];
+};
+
if (typeof module == "object") {
module.exports.ParserFunctions = ParserFunctions;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs