1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-25 23:03:15 +00:00
TiddlyWiki5/core/modules/filters/wikiparserrules.js
Tobias Beer f575389d89 Update wikiparserrules operator for no operand (#2193)
* return all wikiparserrules w/o operand

* simpler layout & code / updated instruction details

Also wanted to link each rule to the official docs using a dictionary at
`$:/language/Docs/ParserRules/`. However, without #2194 this is not
doable.
2016-10-08 13:04:11 +01:00

32 lines
632 B
JavaScript

/*\
title: $:/core/modules/filters/wikiparserrules.js
type: application/javascript
module-type: filteroperator
Filter operator for returning the names of the wiki parser rules in this wiki
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.wikiparserrules = function(source,operator,options) {
var results = [],
operand = operator.operand;
$tw.utils.each($tw.modules.types.wikirule,function(mod) {
var exp = mod.exports;
if(!operand || exp.types[operand]) {
results.push(exp.name);
}
});
results.sort();
return results;
};
})();