1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Add [is[binary]] operator

This commit is contained in:
Jeremy Ruston 2019-09-16 16:15:26 +01:00
parent 36498867d5
commit 1150c87edb
2 changed files with 12 additions and 1 deletions

View File

@ -221,6 +221,16 @@ exports.isImageTiddler = function(title) {
}
};
exports.isBinaryTiddler = function(title) {
var tiddler = this.getTiddler(title);
if(tiddler) {
var contentTypeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/vnd.tiddlywiki"];
return !!contentTypeInfo && contentTypeInfo.encoding === "base64";
} else {
return null;
}
};
/*
Like addTiddler() except it will silently reject any plugin tiddlers that are older than the currently loaded version. Returns true if the tiddler was imported
*/

View File

@ -1,5 +1,5 @@
created: 20140410103123179
modified: 20190225130632157
modified: 20190916151432497
tags: [[Filter Operators]] [[Common Operators]] [[Negatable Operators]]
title: is Operator
type: text/vnd.tiddlywiki
@ -16,6 +16,7 @@ The parameter <<.place C>> is one of the following fundamental categories:
|!Category |!Matches any tiddler title that... |
|^`current` |is the [[current tiddler|Current Tiddler]] |
|^`image` |has an image ContentType |
|^`binary` |has a binary ContentType |
|^`missing` |does not exist (other than possibly as a shadow tiddler), regardless of whether there are any links to it |
|^`orphan` |has no [[hard links|Hard and Soft Links]] to it |
|^`shadow` |is a [[shadow tiddler|ShadowTiddlers]], regardless of whether it has been overridden with a non-shadow tiddler |