From 2ed8df0d1f52126b63ad7aea52761db9d97149ac Mon Sep 17 00:00:00 2001 From: Jermolene Date: Tue, 25 Feb 2014 14:49:56 +0000 Subject: [PATCH] Add a new "commands" filter --- core/modules/filters/commands.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 core/modules/filters/commands.js diff --git a/core/modules/filters/commands.js b/core/modules/filters/commands.js new file mode 100644 index 000000000..5ab575a78 --- /dev/null +++ b/core/modules/filters/commands.js @@ -0,0 +1,27 @@ +/*\ +title: $:/core/modules/filters/commands.js +type: application/javascript +module-type: filteroperator + +Filter operator for returning the names of the commands available in this wiki + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Export our filter function +*/ +exports.commands = function(source,operator,options) { + var results = []; + $tw.utils.each($tw.commands,function(commandInfo,name) { + results.push(name); + }); + results.sort(); + return results; +}; + +})();