jenkins-bot has submitted this change and it was merged.
Change subject: doc: Fix incorrect documentation in template data model
......................................................................
doc: Fix incorrect documentation in template data model
Per the TemplateData spec:
* Most message values can be null, though they're never undefined.
* 'deprecated' is actually {boolean|string}.
For us:
* Make #isParameterDeprecated always return a boolean
* Add #getParameterDeprecationDescription to get the explanation
of why a parameter is deprecated
* getParameterDescription doesn't need to pass 'null' for fallback
since that's the default fallback.
And it may return null or string.
* #getParameterSets returns an array of Set objects, not an array
of strings (see spec for more information).
Change-Id: Iee788bc8fa6f0545085a0f154b77b8176f770dd2
---
M modules/ve/dm/models/ve.dm.MWTemplateSpecModel.js
M modules/ve/ui/dialogs/ve.ui.MWTransclusionDialog.js
2 files changed, 20 insertions(+), 6 deletions(-)
Approvals:
Trevor Parscal: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ve/dm/models/ve.dm.MWTemplateSpecModel.js
b/modules/ve/dm/models/ve.dm.MWTemplateSpecModel.js
index 06a2d88..9330f43 100644
--- a/modules/ve/dm/models/ve.dm.MWTemplateSpecModel.js
+++ b/modules/ve/dm/models/ve.dm.MWTemplateSpecModel.js
@@ -10,6 +10,9 @@
/**
* MediaWiki template specification.
*
+ * See
https://raw.github.com/wikimedia/mediawiki-extensions-TemplateData/master/spec.templatedata.json
+ * for the latest version of the TemplateData specification.
+ *
* @class
*
* @constructor
@@ -33,7 +36,7 @@
*
* @method
* @static
- * @param {string|Object|undefined} val Messsage or object with messages keyed
by language
+ * @param {string|Object|null} val Messsage or object with messages keyed by
language
* @param {Mixed} [fallback=null] Value to use if message is not available
* @param {string} [lang] Language to prefer, user interface language will be
used by default
* @returns {string} Message text or fallback if not available
@@ -184,10 +187,10 @@
*
* @method
* @param {string} name Parameter name
- * @returns {string} Parameter description
+ * @returns {string|null} Parameter description
*/
ve.dm.MWTemplateSpecModel.prototype.getParameterDescription = function ( name
) {
- return this.constructor.getMessage( this.params[name].description, null
);
+ return this.constructor.getMessage( this.params[name].description );
};
/**
@@ -255,7 +258,18 @@
* @returns {boolean} Parameter is deprecated
*/
ve.dm.MWTemplateSpecModel.prototype.isParameterDeprecated = function ( name ) {
- return this.params[name].deprecated;
+ return this.params[name].deprecated !== false;
+};
+
+/**
+ * Get parameter deprecation description.
+ *
+ * @method
+ * @param {string} name Parameter name
+ * @returns {string} Explaining of why parameter is deprecated, empty if
parameter is not deprecated
+ */
+ve.dm.MWTemplateSpecModel.prototype.getParameterDeprecationDescription =
function ( name ) {
+ return this.params[name].deprecated || '';
};
/**
@@ -272,7 +286,7 @@
* Get parameter sets.
*
* @method
- * @returns {string[][]} Lists of parameter sets
+ * @returns {Object[]} Lists of parameter set descriptors
*/
ve.dm.MWTemplateSpecModel.prototype.getParameterSets = function () {
return this.sets;
diff --git a/modules/ve/ui/dialogs/ve.ui.MWTransclusionDialog.js
b/modules/ve/ui/dialogs/ve.ui.MWTransclusionDialog.js
index 2b3b813..fe5a815 100644
--- a/modules/ve/ui/dialogs/ve.ui.MWTransclusionDialog.js
+++ b/modules/ve/ui/dialogs/ve.ui.MWTransclusionDialog.js
@@ -8,7 +8,7 @@
/*global mw */
/**
- * Dialog for a MediaWiki content transclusion.
+ * Dialog for editing a MediaWiki transclusion.
*
* See
https://raw.github.com/wikimedia/mediawiki-extensions-TemplateData/master/spec.templatedata.json
* for the latest version of the TemplateData specification.
--
To view, visit https://gerrit.wikimedia.org/r/71266
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iee788bc8fa6f0545085a0f154b77b8176f770dd2
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits