MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/54509


Change subject: Add docs to BehaviorSwitchHandler
......................................................................

Add docs to BehaviorSwitchHandler

Change-Id: Id91b9a4016792dae02e1ec2fa583f486dc897571
---
M js/jsduck-conf.json
M js/lib/ext.core.BehaviorSwitchHandler.js
2 files changed, 40 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/09/54509/1

diff --git a/js/jsduck-conf.json b/js/jsduck-conf.json
index 1a1f32a..b66098d 100644
--- a/js/jsduck-conf.json
+++ b/js/jsduck-conf.json
@@ -8,6 +8,7 @@
                "./doc.basicTypes.js",
                "./lib/core-upgrade.js",
                "./lib/ext.core.AttributeExpander.js",
+               "./lib/ext.core.BehaviorSwitchHandler.js",
                "./lib/ext.core.LinkHandler.js",
                "./lib/ext.core.ParserFunctions.js",
                "./lib/ext.core.Sanitizer.js",
diff --git a/js/lib/ext.core.BehaviorSwitchHandler.js 
b/js/lib/ext.core.BehaviorSwitchHandler.js
index 5d51998..510a9d0 100644
--- a/js/lib/ext.core.BehaviorSwitchHandler.js
+++ b/js/lib/ext.core.BehaviorSwitchHandler.js
@@ -2,13 +2,36 @@
 
 var Util = require('./mediawiki.Util.js').Util;
 
+/**
+ * @class
+ *
+ * Handler for behavior switches, like '__TOC__' and similar.
+ *
+ * @constructor
+ * @param {Object} manager
+ * @param {Object} options
+ */
 function BehaviorSwitchHandler( manager, options ) {
        this.manager = manager;
        this.manager.addTransform( this.onBehaviorSwitch.bind( this ), 
"BehaviorSwitchHandler:onBehaviorSwitch", this.rank, 'tag', 'behavior-switch' );
 }
 
+/**
+ * @property {number} rank Indicates where in the pipeline this handler should 
be run.
+ */
 BehaviorSwitchHandler.prototype.rank = 2.14;
 
+/**
+ * @method
+ *
+ * Main handler.
+ *
+ * @param {Token} token
+ * @param {Object} manager
+ * @param {Function} cb
+ * @returns {Object}
+ * @returns {Token[]} return.tokens
+ */
 BehaviorSwitchHandler.prototype.onBehaviorSwitch = function ( token, manager, 
cb ) {
        var metaToken, magicWord = token.attribs[0].v,
                env = this.manager.env,
@@ -25,14 +48,30 @@
        return { tokens: [ metaToken ] };
 };
 
+/**
+ * @class
+ *
+ * Pre-process behavior switches, check to see that they're valid magic words.
+ *
+ * @constructor
+ * @param {Object} manager
+ * @param {Object} options
+ */
 function BehaviorSwitchPreprocessor( manager, options ) {
        this.manager = manager;
        this.manager.addTransform( this.onBehaviorSwitch.bind( this ), 
'BehaviorSwitchPreprocessor:onBehaviorSwitch',
                this.rank, 'tag', 'behavior-switch' );
 }
 
+/**
+ * @property {number} rank Specifies where in the pipeline this stage should 
run.
+ */
 BehaviorSwitchPreprocessor.prototype.rank = 0.05;
 
+/**
+ * @method
+ * @inheritdoc BehaviorSwitchHandler#onBehaviorSwitch
+ */
 BehaviorSwitchPreprocessor.prototype.onBehaviorSwitch = function ( token, 
manager, cb ) {
        var metaToken, switchType, env = this.manager.env,
                magicWord = token.attribs[0].v;

-- 
To view, visit https://gerrit.wikimedia.org/r/54509
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id91b9a4016792dae02e1ec2fa583f486dc897571
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to