jenkins-bot has submitted this change and it was merged.
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, 28 insertions(+), 0 deletions(-)
Approvals:
Subramanya Sastry: Looks good to me, approved
jenkins-bot: Verified
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 96d5644..f746f9f 100644
--- a/js/lib/ext.core.BehaviorSwitchHandler.js
+++ b/js/lib/ext.core.BehaviorSwitchHandler.js
@@ -6,13 +6,27 @@
var KV = defines.KV,
SelfclosingTagTk = defines.SelfclosingTagTk;
+/**
+ * @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' );
}
+// Indicates where in the pipeline this handler should be run.
BehaviorSwitchHandler.prototype.rank = 2.14;
+/**
+ * Main handler.
+ * See {@link TokenTransformManager#addTransform}'s transformation parameter
+ */
BehaviorSwitchHandler.prototype.onBehaviorSwitch = function ( token, manager,
cb ) {
var metaToken, magicWord = token.attribs[0].v,
env = this.manager.env,
@@ -29,14 +43,27 @@
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' );
}
+// Specifies where in the pipeline this stage should run.
BehaviorSwitchPreprocessor.prototype.rank = 0.05;
+/**
+ * See {@link TokenTransformManager#addTransform}'s transformation parameter
+ */
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: merged
Gerrit-Change-Id: Id91b9a4016792dae02e1ec2fa583f486dc897571
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits