2012-04-01 02:08:54 +00:00
|
|
|
/**
|
|
|
|
*/
|
|
|
|
|
|
|
|
function BehaviorSwitchHandler( manager, isInclude ) {
|
|
|
|
this.manager = manager;
|
|
|
|
this.manager.addTransform( this.onBehaviorSwitch.bind( this ), this.rank, 'tag', 'behavior-switch' );
|
|
|
|
}
|
|
|
|
|
2012-05-10 08:04:24 +00:00
|
|
|
BehaviorSwitchHandler.prototype.rank = 2.14;
|
2012-04-01 02:08:54 +00:00
|
|
|
|
|
|
|
BehaviorSwitchHandler.prototype.onBehaviorSwitch = function ( token, manager, cb ) {
|
|
|
|
var env = this.manager.env,
|
|
|
|
magic_word = token.attribs[0].v;
|
|
|
|
|
|
|
|
env.setVariable(magic_word, true);
|
|
|
|
|
2012-06-28 16:20:13 +00:00
|
|
|
return { tokens:
|
|
|
|
[
|
|
|
|
new SelfclosingTagTk( 'meta',
|
|
|
|
[ new KV( 'data-gen', 'both' ) ],
|
|
|
|
token.dataAttribs )
|
|
|
|
]
|
|
|
|
};
|
2012-04-01 02:08:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof module == "object") {
|
|
|
|
module.exports.BehaviorSwitchHandler = BehaviorSwitchHandler;
|
|
|
|
}
|