From 1150c87edb7478af6cc943eb0ef52fdf3051c121 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Mon, 16 Sep 2019 16:15:26 +0100 Subject: [PATCH] Add [is[binary]] operator --- core/modules/wiki.js | 10 ++++++++++ editions/tw5.com/tiddlers/filters/is.tid | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/modules/wiki.js b/core/modules/wiki.js index c531440a3..e7f84e13c 100755 --- a/core/modules/wiki.js +++ b/core/modules/wiki.js @@ -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 */ diff --git a/editions/tw5.com/tiddlers/filters/is.tid b/editions/tw5.com/tiddlers/filters/is.tid index bec256edf..b18dffe42 100644 --- a/editions/tw5.com/tiddlers/filters/is.tid +++ b/editions/tw5.com/tiddlers/filters/is.tid @@ -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 |