From 64eb1be708e7a3a6ab088d786ebc8ba91dd4c71a Mon Sep 17 00:00:00 2001 From: springerspandrel <66639553+springerspandrel@users.noreply.github.com> Date: Thu, 11 Jul 2024 09:58:17 -0400 Subject: [PATCH 1/7] Improve view templates to show tag children (#8362) --- editions/tw5.com/tiddlers/empty-tag-node-template.tid | 11 +++++++++++ .../tw5.com/tiddlers/system/systemtag-template.tid | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 editions/tw5.com/tiddlers/empty-tag-node-template.tid diff --git a/editions/tw5.com/tiddlers/empty-tag-node-template.tid b/editions/tw5.com/tiddlers/empty-tag-node-template.tid new file mode 100644 index 000000000..cbc5864c7 --- /dev/null +++ b/editions/tw5.com/tiddlers/empty-tag-node-template.tid @@ -0,0 +1,11 @@ +created: 20240710161501472 +list-after: $:/core/ui/ViewTemplate/body +modified: 20240710165557977 +tags: $:/tags/ViewTemplate +title: $:/editions/tw5.com/empty-tag-node-template +type: + +<$list filter='[is[missing]] :filter[tagging[]]'> +The following tiddlers are tagged with <>: + +<is[missing]tagging[]]" class:"multi-columns">> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/system/systemtag-template.tid b/editions/tw5.com/tiddlers/system/systemtag-template.tid index 4b0120269..f2d3eee69 100644 --- a/editions/tw5.com/tiddlers/system/systemtag-template.tid +++ b/editions/tw5.com/tiddlers/system/systemtag-template.tid @@ -1,19 +1,19 @@ created: 20220719120233104 list-after: $:/core/ui/ViewTemplate/body -modified: 20220719120319922 +modified: 20240710163659672 tags: $:/tags/ViewTemplate title: $:/editions/tw5.com/systemtag-template <$list filter='[all[current]prefix[SystemTag: ]]'> -<$let tag={{{ [all[current]removeprefix[SystemTag: ]] }}} > +<$let thisTag={{{ [all[current]removeprefix[SystemTag: ]] }}} > -<$list filter='[all[tiddlers+shadows]taglimit[1]]' emptyMessage='(No tiddlers are currently tagged with <> )'> +<$list filter='[all[tiddlers+shadows]taglimit[1]]' emptyMessage='(No tiddlers are currently tagged with <> )'> -The following tiddlers are tagged with <> +The following tiddlers are tagged with <> -<$list filter='[all[tiddlers+shadows]tagsort[]]'> +<$list filter='[all[tiddlers+shadows]tagsort[]]'> From bfd06198fb37dbbbfd5ba05a252a2fe3fd85265b Mon Sep 17 00:00:00 2001 From: springerspandrel <66639553+springerspandrel@users.noreply.github.com> Date: Sat, 13 Jul 2024 07:58:36 -0400 Subject: [PATCH 2/7] Fix problem where view template disappears on interaction with tag pill (#8372) --- editions/tw5.com/tiddlers/empty-tag-node-template.tid | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/editions/tw5.com/tiddlers/empty-tag-node-template.tid b/editions/tw5.com/tiddlers/empty-tag-node-template.tid index cbc5864c7..a85a7f8d5 100644 --- a/editions/tw5.com/tiddlers/empty-tag-node-template.tid +++ b/editions/tw5.com/tiddlers/empty-tag-node-template.tid @@ -1,11 +1,11 @@ created: 20240710161501472 list-after: $:/core/ui/ViewTemplate/body -modified: 20240710165557977 +modified: 20240713020832439 tags: $:/tags/ViewTemplate title: $:/editions/tw5.com/empty-tag-node-template type: -<$list filter='[is[missing]] :filter[tagging[]]'> +<$list filter='[!has[text]] :filter[tagging[]]'> The following tiddlers are tagged with <>: -<is[missing]tagging[]]" class:"multi-columns">> \ No newline at end of file +<!has[text]tagging[]]" class:"multi-columns">> \ No newline at end of file From fcb28df82c9fa24c88ba93483f16ac5874657c44 Mon Sep 17 00:00:00 2001 From: Mohammad Rahmani <830394+kookma@users.noreply.github.com> Date: Thu, 18 Jul 2024 00:05:51 +0330 Subject: [PATCH 3/7] Update import.tid to delete the state tiddler for "select all" (#8399) The leftover after canceling import operation is deleted now by adding: ``` <$action-deletetiddler $tiddler="$:/state/import/select-all"/> ``` --- core/ui/ViewTemplate/body/import.tid | 1 + 1 file changed, 1 insertion(+) diff --git a/core/ui/ViewTemplate/body/import.tid b/core/ui/ViewTemplate/body/import.tid index a456e1a4f..d8618c7cf 100644 --- a/core/ui/ViewTemplate/body/import.tid +++ b/core/ui/ViewTemplate/body/import.tid @@ -6,6 +6,7 @@ title: $:/core/ui/ViewTemplate/body/import \whitespace trim <$action-confirm $message={{$:/language/Import/Listing/Cancel/Warning}} > <$action-deletetiddler $tiddler=<>/> +<$action-deletetiddler $tiddler="$:/state/import/select-all"/> <$action-sendmessage $message="tm-close-tiddler" title=<>/> \end From 67e7fa4b746e99b276a179bbdcd858d25d8fb4c4 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Wed, 17 Jul 2024 22:36:54 +0200 Subject: [PATCH 4/7] Improve :sort, sortsub, :sort examples and the railroad diagram (#8396) * Improve :sort, sortsub, :sort examples and the railroad diagram * Update Sort Filter Run Prefix (Examples).tid undo changes. --- .../tiddlers/filters/sortsub Operator.tid | 24 +++++++------ .../Sort Filter Run Prefix (Examples).tid | 2 +- .../filters/syntax/Sort Filter Run Prefix.tid | 34 +++++++++++++++---- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/editions/tw5.com/tiddlers/filters/sortsub Operator.tid b/editions/tw5.com/tiddlers/filters/sortsub Operator.tid index df7d99cfa..d6c244a07 100644 --- a/editions/tw5.com/tiddlers/filters/sortsub Operator.tid +++ b/editions/tw5.com/tiddlers/filters/sortsub Operator.tid @@ -1,6 +1,6 @@ caption: sortsub created: 20200424160155182 -modified: 20210522162521222 +modified: 20240717115735166 op-input: a [[selection of titles|Title Selection]] op-neg-output: the input, sorted into reverse order by the result of evaluating subfilter <<.param S>> op-output: the input, sorted into ascending order by the result of evaluating subfilter <<.param S>> @@ -15,19 +15,23 @@ type: text/vnd.tiddlywiki Each item in the list of input titles is passed to the subfilter in turn. The subfilter transforms the input titles into the form needed for sorting. For example, the subfilter `[length[]]` transforms each input title in the number representing its length, and thus sorts the input titles according to their length. -Note that within the subfilter, the "currentTiddler" variable is set to the title of the tiddler being processed. This permits subfilters like `[{!!value}divide{!!cost}]` to be used for computation. +Note that within the subfilter <<.place S>>, the <<.var currentTiddler>> variable is set to the title of the tiddler being processed. This permits subfilters like `[{!!value}divide{!!cost}]` to be used for computation. -The value of currentTiddler outside the subfilter is available in the variable "..currentTiddler". <<.from-version "5.2.0">> +The value of <<.var currentTiddler>> outside the subfilter is available in the variable <<.var ..currentTiddler>>. <<.from-version "5.2.0">> The suffix <<.place T>> determines how the items are compared and can be: -* "string" (the default) -* "number" - invalid numbers are interpreted as zero -* "integer" - invalid integers are interpreted as zero -* "date" - invalid dates are interpreted as 1st January 1970 -* "version" - invalid versions are interpreted as "v0.0.0" -* "alphanumeric" - treat items as alphanumerics <<.from-version "5.2.0">> +* ''string'' (the default) +* ''number'' - invalid numbers are interpreted as zero +* ''integer'' - invalid integers are interpreted as zero +* ''date'' - invalid dates are interpreted as 1st January 1970 +* ''version'' - invalid versions are interpreted as "v0.0.0" +* ''alphanumeric'' - treat items as alphanumerics <<.from-version "5.2.0">> -Note that subfilters should return the same number of items that they are passed. Any missing entries will be treated as zero or the empty string. In particular, when retrieving the value of a field with the [[get Operator]] it is helpful to guard against a missing field value using the [[else Operator]]. For example `[get[myfield]else[default-value]...`. +<<.tip """Note that subfilters <<.place S>> ''should return the same number of items that they are passed''. In particular, when retrieving the value of a field with the <<.olink get>> operator it is helpful to guard against a missing field value using the <<.olink else>> operator. For example `...[get[myfield]else[default-value]]`.

+ +Any ''missing'' entries will be treated as ''zero'' or the ''empty string''.""">> + +Also see: [[Sort Filter Run Prefix]] <<.operator-examples "sortsub">> diff --git a/editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix (Examples).tid b/editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix (Examples).tid index 16b9c9711..d16c31d55 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix (Examples).tid @@ -30,4 +30,4 @@ Sort as text with case sensitivity: <<.operator-example 7 "Apple Banana Orange Grapefruit guava DragonFruit Kiwi apple orange :sort:string:casesensitive[{!!title}]">> Sort as text ignoring case: -<<.operator-example 8 "Apple Banana Orange Grapefruit guava DragonFruit Kiwi apple orange :sort:string:caseinsensitive[{!!title}]">> \ No newline at end of file +<<.operator-example 8 "Apple Banana Orange Grapefruit guava DragonFruit Kiwi apple orange :sort:string:caseinsensitive[{!!title}]">> diff --git a/editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid index e17b88356..7df986274 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid @@ -1,10 +1,11 @@ created: 20210428083929749 from-version: 5.2.0 -modified: 20240312203002082 +modified: 20240717120111427 rp-input: the filter output of all previous runs so far rp-output: output titles replace the output of previous filter runs rp-purpose: sort the input titles by the result of evaluating this filter run for each item -rp-suffix: the <<.op :sort>> filter run prefix uses a rich suffix, see below for details +rp-suffix: the :sort filter run prefix uses a rich suffix, see below for details +rp-suffix-name: S tags: [[Named Filter Run Prefix]] title: Sort Filter Run Prefix type: text/vnd.tiddlywiki @@ -12,9 +13,19 @@ type: text/vnd.tiddlywiki <$railroad text=""" \start none \end none -( ( ":sort" ) -( : ":string" | ":alphanumeric" | ":number" | ":integer" | ":version" | ":date" ) -( : ":casesensitive" /"required for string and alphanumeric"/ | ":caseinsensitive" /"required for string and alphanumeric"/ | ":reverse" /"optional"/ | - ) | - ) +( ":sort" ) +( ":" ) +( : "string" | "alphanumeric" | "number" | "integer" | "version" | "date" ) +( ":" ) +{ + ( + ( + ( : "caseinsensitive" /"required for string and alphanumeric"/ | "casesensitive" /"required for string and alphanumeric"/) + | "reverse" /"optional"/ + ) + ) + +"," +} [[run|"Filter Run"]] """/> @@ -22,7 +33,7 @@ Each input title from previous runs is passed to this run in turn. The filter ru Note that within the filter run, the <<.var currentTiddler>> variable is set to the title of the tiddler being processed. This permits filter runs like `:sort:number[{!!value}divide{!!cost}]` to be used for computation. The value of <<.var currentTiddler>> outside the run is available in the variable <<.var "..currentTiddler">>. -The `:sort` filter run prefix uses an extended syntax that allows for multiple suffixes, some of which are required: +The `:sort` <<.place S>> filter run prefix uses an extended syntax that allows for multiple suffixes, some of which are required: ``` :sort::[...filter run...] @@ -30,10 +41,19 @@ The `:sort` filter run prefix uses an extended syntax that allows for multiple s ``` * ''type'': Required. Determines how the items are compared and can be any of: ''string'', ''alphanumeric'', ''number'', ''integer'', ''version'' or ''date''. + * ''flaglist'': comma separated list of the following flags: + ** ''casesensitive'' or ''caseinsensitive'' (required for types `string` and `alphanumeric`). +*** defaults to: //caseinsensitive// if the flag is missing. +*** for clarity this parameter should be always defined. + ** ''reverse'' to invert the order of the filter run (optional). -Note that filter runs used with the `:sort` prefix should return the same number of items that they are passed. Any missing entries will be treated as zero or the empty string. In particular, when retrieving the value of a field with the [[get Operator]] it is helpful to guard against a missing field value using the [[else Operator]]. For example `[get[myfield]else[default-value]...`. +<<.tip """Note that filter runs used with the `:sort` prefix ''should return the same number of items that they are passed''. In particular, when retrieving the value of a field with the [[get Operator]] it is helpful to guard against a missing field value using the [[else Operator]]. For example `...[get[myfield]else[default-value]]`.

+ +Any ''missing'' entries will be treated as ''zero'' or the ''empty string''.""">> + +Also see: <<.olink sortsub>> Operator [[Examples|Sort Filter Run Prefix (Examples)]] \ No newline at end of file From a4649490de813253634b0eb48885e41bcf122daf Mon Sep 17 00:00:00 2001 From: Leilei332 Date: Thu, 18 Jul 2024 04:37:27 +0800 Subject: [PATCH 5/7] Add more markdown toolbar buttons (#8395) --- .../markdown/EditorToolbar/strikethrough.tid | 15 +++++++++++++++ .../markdown/EditorToolbar/subscript.tid | 15 +++++++++++++++ .../markdown/EditorToolbar/superscript.tid | 15 +++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 plugins/tiddlywiki/markdown/EditorToolbar/strikethrough.tid create mode 100644 plugins/tiddlywiki/markdown/EditorToolbar/subscript.tid create mode 100644 plugins/tiddlywiki/markdown/EditorToolbar/superscript.tid diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/strikethrough.tid b/plugins/tiddlywiki/markdown/EditorToolbar/strikethrough.tid new file mode 100644 index 000000000..0befd9022 --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/strikethrough.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/strikethrough +list-after: $:/core/ui/EditorToolbar/strikethrough +tags: $:/tags/EditorToolbar +icon: $:/core/images/strikethrough +caption: {{$:/language/Buttons/Strikethrough/Caption}} (Markdown) +description: {{$:/language/Buttons/Strikethrough/Hint}} +condition: [type[text/x-markdown]] [type[text/markdown]] +shortcuts: ((strikethrough)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="~~" + suffix="~~" +/> diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/subscript.tid b/plugins/tiddlywiki/markdown/EditorToolbar/subscript.tid new file mode 100644 index 000000000..3a40facb7 --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/subscript.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/subscript +list-after: $:/core/ui/EditorToolbar/subscript +tags: $:/tags/EditorToolbar +icon: $:/core/images/subscript +caption: {{$:/language/Buttons/Subscript/Caption}} (Markdown) +description: {{$:/language/Buttons/Subscript/Hint}} +condition: [type[text/x-markdown]] [type[text/markdown]] +shortcuts: ((subscript)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="~" + suffix="~" +/> diff --git a/plugins/tiddlywiki/markdown/EditorToolbar/superscript.tid b/plugins/tiddlywiki/markdown/EditorToolbar/superscript.tid new file mode 100644 index 000000000..430cb397b --- /dev/null +++ b/plugins/tiddlywiki/markdown/EditorToolbar/superscript.tid @@ -0,0 +1,15 @@ +title: $:/plugins/tiddlywiki/markdown/EditorToolbar/superscript +list-after: $:/core/ui/EditorToolbar/superscript +tags: $:/tags/EditorToolbar +icon: $:/core/images/superscript +caption: {{$:/language/Buttons/Superscript/Caption}} (Markdown) +description: {{$:/language/Buttons/Superscript/Hint}} +condition: [type[text/x-markdown]] [type[text/markdown]] +shortcuts: ((superscript)) + +<$action-sendmessage + $message="tm-edit-text-operation" + $param="wrap-selection" + prefix="^" + suffix="^" +/> From da8b213be51f8a66752779fc5a1fc84658038db3 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Wed, 17 Jul 2024 22:49:40 +0200 Subject: [PATCH 6/7] fix RSOD if tm-copy-to-clipboard param is empty (#8393) --- core/modules/utils/dom/dom.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/modules/utils/dom/dom.js b/core/modules/utils/dom/dom.js index 4ba037ed5..0b71e128c 100644 --- a/core/modules/utils/dom/dom.js +++ b/core/modules/utils/dom/dom.js @@ -270,6 +270,7 @@ Copy plain text to the clipboard on browsers that support it */ exports.copyToClipboard = function(text,options) { options = options || {}; + text = text || ""; var textArea = document.createElement("textarea"); textArea.style.position = "fixed"; textArea.style.top = 0; @@ -289,7 +290,7 @@ exports.copyToClipboard = function(text,options) { var succeeded = false; try { succeeded = document.execCommand("copy"); - } catch (err) { + } catch(err) { } if(!options.doNotNotify) { var successNotification = options.successNotification || "$:/language/Notifications/CopiedToClipboard/Succeeded", @@ -326,7 +327,7 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) { variables["tv-popup-coords"] = Popup.buildCoordinates(Popup.coordinatePrefix.csOffsetParent,nodeRect); var absRect = $tw.utils.extend({}, nodeRect); - for (var currentNode = selectedNode.offsetParent; currentNode; currentNode = currentNode.offsetParent) { + for(var currentNode = selectedNode.offsetParent; currentNode; currentNode = currentNode.offsetParent) { absRect.left += currentNode.offsetLeft; absRect.top += currentNode.offsetTop; } From 2a8d664c0918690aa87f87935f011e49bd6187f6 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Wed, 17 Jul 2024 22:51:31 +0200 Subject: [PATCH 7/7] tags-operator: add new test (#8392) --- .../test/tiddlers/tests/test-tags-operator.js | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 editions/test/tiddlers/tests/test-tags-operator.js diff --git a/editions/test/tiddlers/tests/test-tags-operator.js b/editions/test/tiddlers/tests/test-tags-operator.js new file mode 100644 index 000000000..002040613 --- /dev/null +++ b/editions/test/tiddlers/tests/test-tags-operator.js @@ -0,0 +1,75 @@ +/*\ +title: test-tags-operator.js +type: application/javascript +tags: [[$:/tags/test-specX]] + +Tests the tagging mechanism. + +\*/ +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +describe("Tags Operator tests", function() { + +describe("With no indexers", function() { + var wikiOptions = {enableIndexers: []}, + wiki = setupWiki(wikiOptions); + runTests(wiki,wikiOptions); +}); + +describe("With all indexers", function() { + var wikiOptions = {}, + wiki = setupWiki(); + runTests(wiki,wikiOptions); +}); + +function setupWiki(wikiOptions) { + // Create a wiki + var wiki = new $tw.Wiki(wikiOptions); + + // Add a few tiddlers + wiki.addTiddler({ title: "aaa",text: "text aaa",color: "red"}); + wiki.addTiddler({ title: "1"}); + wiki.addTiddler({ title: "10"}); + wiki.addTiddler({ title: "bbb"}); + wiki.addTiddler({ title: "bb bb"}); + wiki.addTiddler({ title: "BBB"}); + wiki.addTiddler({ title: "AAA"}); + wiki.addTiddler({ title: "BB BB"}); + wiki.addTiddler({ title: "bb bb", text: "text bb bb"}); + return wiki; +} + + // Our tests +function runTests(wiki,wikiOptions) { + + var TAGS = "aaa 10 1 bbb AAA [[bb bb]] BBB [[BB BB]]"; + + // Tests before PR #8228 to make sure there are now incompatibilities + it("should apply tags ordering in SORT order up to TW v5.3.6", function () { + var wiki = new $tw.Wiki(wikiOptions); + var EXPECTED = "1,10,aaa,AAA,bb bb,BB BB,bbb,BBB"; + + wiki.addTiddler({ title: "test-tags-operator", text: "", tags: TAGS}); + expect(wiki.filterTiddlers("[[test-tags-operator]tags[]sort[title]]").join(',')).toBe(EXPECTED); + + wiki.addTiddler({ title: "$:/config/Tags/CustomSort/subfilter", text: "[{!!title}]"}); + expect(wiki.filterTiddlers("[[test-tags-operator]tags[]] :sort:alphanumeric:caseinsensitive[subfilter{$:/config/Tags/CustomSort/subfilter}]").join(',')).toBe(EXPECTED); + + // Due to the implementation of the tags[] operator with v5.3.6 we can not guarantee the order that `[tags[]]` returns + }); + + // The following test can be enabled once the core allows us to do so. + xit("should apply tags ordering in order of creation. TW v5.3.7+", function () { + var wiki = new $tw.Wiki(wikiOptions); + + wiki.addTiddler({ title: "$:/config/Tags/CustomSort/subfilter", text: ""}); + wiki.addTiddler({ title: "test-tags-operator", text: "", tags: TAGS}); + + var EXPECTED = "aaa,10,1,bbb,AAA,bb bb,BBB,BB BB" + expect(wiki.filterTiddlers("[[test-tags-operator]tags[]] :sort:alphanumeric:caseinsensitive[subfilter{$:/config/Tags/CustomSort/subfilter}]").join(',')).toBe(EXPECTED); + }); +} + +});
caption
<$link/> <$transclude field="caption"><$transclude field="description"><$view field="title"/>