1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-29 07:20:47 +00:00

Ignore edition filters if not running on node (#5222)

This commit is contained in:
Joshua Fontany 2020-12-07 07:59:32 -08:00 committed by GitHub
parent 85ff47366c
commit a878d82c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 15 deletions

View File

@ -16,14 +16,16 @@ Filter operator for returning the descriptions of the specified edition names
Export our filter function Export our filter function
*/ */
exports.editiondescription = function(source,operator,options) { exports.editiondescription = function(source,operator,options) {
var results = [], var results = [];
editionInfo = $tw.utils.getEditionInfo(); if($tw.node) {
if(editionInfo) { var editionInfo = $tw.utils.getEditionInfo();
source(function(tiddler,title) { if(editionInfo) {
if($tw.utils.hop(editionInfo,title)) { source(function(tiddler,title) {
results.push(editionInfo[title].description || ""); if($tw.utils.hop(editionInfo,title)) {
} results.push(editionInfo[title].description || "");
}); }
});
}
} }
return results; return results;
}; };

View File

@ -16,14 +16,16 @@ Filter operator for returning the names of the available editions in this wiki
Export our filter function Export our filter function
*/ */
exports.editions = function(source,operator,options) { exports.editions = function(source,operator,options) {
var results = [], var results = [];
editionInfo = $tw.utils.getEditionInfo(); if($tw.node) {
if(editionInfo) { var editionInfo = $tw.utils.getEditionInfo();
$tw.utils.each(editionInfo,function(info,name) { if(editionInfo) {
results.push(name); $tw.utils.each(editionInfo,function(info,name) {
}); results.push(name);
});
}
results.sort();
} }
results.sort();
return results; return results;
}; };