From eaa21589e65dd9fd685cd1a27f904f16a32719b9 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Wed, 31 Jan 2024 14:34:17 +0000 Subject: [PATCH 001/185] Fix link to Nicolas Petton's Notebook theme --- .../community/themes/Notebook theme by Nicolas Petton.tid | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editions/tw5.com/tiddlers/community/themes/Notebook theme by Nicolas Petton.tid b/editions/tw5.com/tiddlers/community/themes/Notebook theme by Nicolas Petton.tid index c31316239..4f86181d3 100644 --- a/editions/tw5.com/tiddlers/community/themes/Notebook theme by Nicolas Petton.tid +++ b/editions/tw5.com/tiddlers/community/themes/Notebook theme by Nicolas Petton.tid @@ -1,9 +1,9 @@ created: 20210101154635213 -modified: 20210110210929321 +modified: 20240131143350890 tags: [[Community Themes]] title: "Notebook theme" by Nicolas Petton type: text/vnd.tiddlywiki -url: https://nicolas.petton.fr/tw/notebook.html +url: https://saqimtiaz.github.io/sq-tw/notebook.html Notebook is a clean, uncluttered theme for ~TiddlyWiki. From bc3132ab2cddcf10895d494a1279a00f0510682c Mon Sep 17 00:00:00 2001 From: Mateusz Wilczek <36714554+mateuszwilczek@users.noreply.github.com> Date: Fri, 2 Feb 2024 18:15:51 +0100 Subject: [PATCH 002/185] Add explicit docs on temporary tiddlers (#7957) --- editions/tw5.com/tiddlers/Temporary Tiddlers.tid | 8 ++++++++ .../tw5.com/tiddlers/nodejs/Naming of System Tiddlers.tid | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 editions/tw5.com/tiddlers/Temporary Tiddlers.tid diff --git a/editions/tw5.com/tiddlers/Temporary Tiddlers.tid b/editions/tw5.com/tiddlers/Temporary Tiddlers.tid new file mode 100644 index 000000000..c138bf8a3 --- /dev/null +++ b/editions/tw5.com/tiddlers/Temporary Tiddlers.tid @@ -0,0 +1,8 @@ +created: 20240202112358997 +modified: 20240202120248326 +tags: Concepts +title: Temporary Tiddlers + +Temporary tiddlers are tiddlers that will be discarded when TiddlyWiki is saved. Under default configuration of the SavingMechanism (more specifically, the filter in [[$:/core/save/all]]), these are tiddlers prefixed with `$:/temp/`. This prefix makes them SystemTiddlers as well. + +One example usage of temporary tiddlers is storing the search queries. The query typed in the [[$:/AdvancedSearch]] is stored in [[$:/temp/advancedsearch]]. \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/nodejs/Naming of System Tiddlers.tid b/editions/tw5.com/tiddlers/nodejs/Naming of System Tiddlers.tid index f677c6cee..ff1a79c78 100644 --- a/editions/tw5.com/tiddlers/nodejs/Naming of System Tiddlers.tid +++ b/editions/tw5.com/tiddlers/nodejs/Naming of System Tiddlers.tid @@ -1,5 +1,5 @@ created: 20140112190154121 -modified: 20140912142655205 +modified: 20240202121048363 tags: SystemTiddlers title: Naming of System Tiddlers type: text/vnd.tiddlywiki @@ -17,11 +17,11 @@ The system tiddlers provided as part of the core are named according to the foll |`$:/core/wiki/*` |lowercase |Metadata about the entire wiki | |`$:/docs/*` |lowercase |Documentation tiddlers | |`$:/messages/*` |~CamelCase |System messages | -|`$:/plugins/*` |lowercase |Plugin tiddlers, and plugin content | +|`$:/plugins/*` |lowercase |[[Plugin|Plugins]] tiddlers, and plugin content | |`$:/snippets/*` |//inconsistent// |Reusable snippets (will be replaced by macros) | -|`$:/state/*` |lowercase |User interface state tiddlers | +|`$:/state/*` |lowercase |User interface state tiddlers (see StateMechanism) | |`$:/tags/*` |~CamelCase |User interface configuration tags | -|`$:/temp/*` |lowercase |Temporary tiddlers that shouldn't be saved | +|`$:/temp/*` |lowercase |[[Temporary tiddlers|Temporary Tiddlers]] that shouldn't be saved | |`$:/themes/*` |lowercase |Theme plugins | In the format column: From 2b1efac6eea82783c47cc2673b86aced4e9c0bdf Mon Sep 17 00:00:00 2001 From: lin onetwo Date: Tue, 6 Feb 2024 01:00:09 +0800 Subject: [PATCH 003/185] Fix: on Windows, tiddlywiki.files title source shoud use / instead of \ (#7949) * fix: on Windows, tiddlywiki.files title source shoud use / instead of \ * fix: split path.sep instead of / --- boot/boot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boot/boot.js b/boot/boot.js index 1965efb5c..7049b39b4 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -1967,10 +1967,10 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) { var value = tiddler[name]; switch(fieldInfo.source) { case "subdirectories": - value = path.relative(rootPath, filename).split('/').slice(0, -1); + value = path.relative(rootPath, filename).split(path.sep).slice(0, -1); break; case "filepath": - value = path.relative(rootPath, filename); + value = path.relative(rootPath, filename).split(path.sep).join('/'); break; case "filename": value = path.basename(filename); From 111f71bcf517f314644a6cb5b98698267b014451 Mon Sep 17 00:00:00 2001 From: lin onetwo Date: Tue, 6 Feb 2024 01:02:10 +0800 Subject: [PATCH 004/185] Add doc xls ppt file type information (#7927) * fix: add doc xls ppt type * Add application/vnd.ms-excel --- boot/boot.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/boot/boot.js b/boot/boot.js index 7049b39b4..64cedab77 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -2453,8 +2453,12 @@ $tw.boot.initStartup = function(options) { $tw.utils.registerFileType("text/x-markdown","utf8",[".md",".markdown"]); $tw.utils.registerFileType("application/enex+xml","utf8",".enex"); $tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.wordprocessingml.document","base64",".docx"); + $tw.utils.registerFileType("application/msword","base64",".doc"); $tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","base64",".xlsx"); + $tw.utils.registerFileType("application/excel","base64",".xls"); + $tw.utils.registerFileType("application/vnd.ms-excel","base64",".xls"); $tw.utils.registerFileType("application/vnd.openxmlformats-officedocument.presentationml.presentation","base64",".pptx"); + $tw.utils.registerFileType("application/mspowerpoint","base64",".ppt"); $tw.utils.registerFileType("text/x-bibtex","utf8",".bib",{deserializerType:"application/x-bibtex"}); $tw.utils.registerFileType("application/x-bibtex","utf8",".bib"); $tw.utils.registerFileType("application/epub+zip","base64",".epub"); From b0bb911103dfd113bb0608a8db3f75998127ae66 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Mon, 5 Feb 2024 17:47:43 +0000 Subject: [PATCH 005/185] Fix "introduction" edition Fixes #7965 --- .../tiddlers/slides/CecilyMap.tid | 24 +++++++++---------- .../introduction/tiddlers/slides/blank.json | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/editions/introduction/tiddlers/slides/CecilyMap.tid b/editions/introduction/tiddlers/slides/CecilyMap.tid index 01e969cad..3318198f0 100644 --- a/editions/introduction/tiddlers/slides/CecilyMap.tid +++ b/editions/introduction/tiddlers/slides/CecilyMap.tid @@ -4,17 +4,17 @@ type: application/json { "newTiddlerPosition": {"x": 360,"y": 100}, "positions": { - " ": {"x": 30,"y": 17,"w": 140,"h": 140, "r": -2}, - "Tiddlers": {"x": 60,"y": 15,"w": 140,"h": 140, "r": 10}, - "Links": {"x": 90,"y": 13,"w": 140,"h": 140, "r": -7}, - "Formatting": {"x": 120,"y": 18,"w": 140,"h": 140, "r": 5}, - "Images": {"x": 150,"y": 12,"w": 140,"h": 140, "r": -11}, - "Audio": {"x": 180,"y": 14,"w": 140,"h": 140, "r": 16}, - "Tags": {"x": 210,"y": 15,"w": 140,"h": 140, "r": 20}, - "Transclusion": {"x": 240,"y": 16,"w": 140,"h": 140, "r": -4}, - "Lists": {"x": 275,"y": 13,"w": 140,"h": 140, "r": 6}, - "Customisation": {"x": 310,"y": 19,"w": 140,"h": 140, "r": -5}, - "Plugins": {"x": 350,"y": 12,"w": 140,"h": 140, "r": 10}, - "Translations": {"x": 390,"y": 15,"w": 140,"h": 140, "r": 8} + " ": {"x": 30,"y": 17,"w": 120,"h": 120, "r": -2}, + "Tiddlers": {"x": 60,"y": 15,"w": 120,"h": 120, "r": 10}, + "Links": {"x": 90,"y": 13,"w": 120,"h": 120, "r": -7}, + "Formatting": {"x": 120,"y": 18,"w": 120,"h": 120, "r": 5}, + "Images": {"x": 150,"y": 12,"w": 120,"h": 120, "r": -11}, + "Audio": {"x": 180,"y": 14,"w": 120,"h": 120, "r": 16}, + "Tags": {"x": 210,"y": 15,"w": 120,"h": 120, "r": 20}, + "Transclusion": {"x": 240,"y": 16,"w": 120,"h": 120, "r": -4}, + "Lists": {"x": 275,"y": 13,"w": 120,"h": 120, "r": 6}, + "Customisation": {"x": 310,"y": 19,"w": 120,"h": 120, "r": -5}, + "Plugins": {"x": 350,"y": 12,"w": 120,"h": 120, "r": 10}, + "Translations": {"x": 390,"y": 15,"w": 120,"h": 120, "r": 8} } } \ No newline at end of file diff --git a/editions/introduction/tiddlers/slides/blank.json b/editions/introduction/tiddlers/slides/blank.json index 6d507401f..e523d48d4 100644 --- a/editions/introduction/tiddlers/slides/blank.json +++ b/editions/introduction/tiddlers/slides/blank.json @@ -1,3 +1,3 @@ [ -{"title": " ", "text": "TiddlyWiki"} +{"title": " ", "text": "[[TiddlyWiki]]"} ] From 0cf80e824f4dd8d557a6cb586dd3dc9ddcbc46dd Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Mon, 5 Feb 2024 22:50:01 +0000 Subject: [PATCH 006/185] Remove obsolete banner from Confetti plugin --- .../tw5.com/tiddlers/hellothere/HelloThere.tid | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/editions/tw5.com/tiddlers/hellothere/HelloThere.tid b/editions/tw5.com/tiddlers/hellothere/HelloThere.tid index 5f8d5fd34..91ee04e2f 100644 --- a/editions/tw5.com/tiddlers/hellothere/HelloThere.tid +++ b/editions/tw5.com/tiddlers/hellothere/HelloThere.tid @@ -5,21 +5,6 @@ tags: TableOfContents title: HelloThere type: text/vnd.tiddlywiki -
- - This is a build of ~TiddlyWiki 5 from the branch [[confetti-plugin|https://github.com/Jermolene/TiddlyWiki5/tree/confetti-plugin]]. Despite the name of the branch, it actually introduces two new plugins and brings updates to an existing one: - - * The ''Tour Plugin'' allows interactive learning tours to be created and presented in TiddlyWiki - ** Launch the tour in this wiki with the {{$:/plugins/tiddlywiki/tour/start-tour-button}} button in the sidebar - * The ''Confetti Plugin'' displays animated bursts of confetti - ** See the [[Confetti Plugin readme|$:/plugins/tiddlywiki/confetti/readme]] for examples - * The ''updated Dynannotate Plugin'' gains the ability to highlight screen elements using an animated spotlight effect - ** See the [[Dynannotate Spotlight Demo|$:/plugins/tiddlywiki/dynannotate/examples/spotlight]] - - A standalone demo of the tour functionality is [ext[available here|./tour.html]]. - -
- !!.tc-hero-heading ''Welcome to TiddlyWiki, a unique [[non-linear|Philosophy of Tiddlers]] notebook for [[capturing|Creating and editing tiddlers]], [[organising|Structuring TiddlyWiki]] and [[sharing|Sharing your tiddlers with others]] complex information'' Use it to keep your [[to-do list|TaskManagementExample]], to plan an [[essay or novel|"TiddlyWiki for Scholars" by Alberto Molina]], or to organise your wedding. Record every thought that crosses your brain, or build a flexible and responsive website. From abab9164c5934f99a570d9feb60b2e9f7718ccda Mon Sep 17 00:00:00 2001 From: eschlon Date: Sat, 10 Feb 2024 05:45:06 -0800 Subject: [PATCH 007/185] Signing the CLA (#7974) --- licenses/cla-individual.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/licenses/cla-individual.md b/licenses/cla-individual.md index 30136b6bb..5f7a833c3 100644 --- a/licenses/cla-individual.md +++ b/licenses/cla-individual.md @@ -559,3 +559,5 @@ Wang Ke, @Gk0Wk, 2023/10/17 @etardiff, 2023/12/10 John Long, @drevarr, 2023/12/12 + +Ed Holsinger, @eschlon, 2024/02/08 From 70f0a52842ef99512e56dd839983c8a0d75175f8 Mon Sep 17 00:00:00 2001 From: eschlon Date: Sat, 10 Feb 2024 06:41:56 -0800 Subject: [PATCH 008/185] Fix incorrect state reference in core/ui/AdvancedSearch/Standard (#7975) This PR fixes #7973 --- core/ui/AdvancedSearch/Standard.tid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/ui/AdvancedSearch/Standard.tid b/core/ui/AdvancedSearch/Standard.tid index 0690130e4..41ddcf4bc 100644 --- a/core/ui/AdvancedSearch/Standard.tid +++ b/core/ui/AdvancedSearch/Standard.tid @@ -54,7 +54,7 @@ caption: {{$:/language/Search/Standard/Caption}} variable="listItem"> <$vars userInput={{{ [[$:/temp/advancedsearch]get[text]] }}} - configTiddler={{{ [[$:/state/search/currentTab]!is[missing]get[text]] ~[{$:/config/SearchResults/Default}] }}} + configTiddler={{{ [[$:/state/advancedsearch/standard/currentTab]!is[missing]get[text]] ~[{$:/config/SearchResults/Default}] }}} searchListState="$:/temp/advancedsearch/selected-item"> <$list filter="[all[shadows+tiddlers]tag[$:/tags/SearchResults]!has[draft.of]butfirst[]limit[1]]" From aaad420c3f932636a680b6269653ca0739b236c4 Mon Sep 17 00:00:00 2001 From: lin onetwo Date: Sun, 11 Feb 2024 23:15:05 +0800 Subject: [PATCH 009/185] Docs: add contribution graph to readme (#7980) --- editions/tw5.com/tiddlers/about/Developers.tid | 1 + 1 file changed, 1 insertion(+) diff --git a/editions/tw5.com/tiddlers/about/Developers.tid b/editions/tw5.com/tiddlers/about/Developers.tid index 9b24b0c36..51c123ee7 100644 --- a/editions/tw5.com/tiddlers/about/Developers.tid +++ b/editions/tw5.com/tiddlers/about/Developers.tid @@ -8,6 +8,7 @@ There are several resources for developers to learn more about TiddlyWiki and to * [[tiddlywiki.com/dev|https://tiddlywiki.com/dev]] is the official developer documentation * Get involved in the [[development on GitHub|https://github.com/Jermolene/TiddlyWiki5]] +** [img[https://repobeats.axiom.co/api/embed/5a3bb51fd1ebe84a2da5548f78d2d74e456cebf3.svg]] ** [[Discussions|https://github.com/Jermolene/TiddlyWiki5/discussions]] are for Q&A and open-ended discussion ** [[Issues|https://github.com/Jermolene/TiddlyWiki5/issues]] are for raising bug reports and proposing specific, actionable new ideas * The older ~TiddlyWikiDev Google Group is now closed in favour of [[GitHub Discussions|https://github.com/Jermolene/TiddlyWiki5/discussions]] but remains a useful archive: https://groups.google.com/group/TiddlyWikiDev From a49436160d790fc4b0b4fd1dc57ce3c9c9466545 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Wed, 14 Feb 2024 17:20:32 +0100 Subject: [PATCH 010/185] Improve Filter Syntax documentation (#7368) * Improve Filter Syntax documentaion / navigation * update links and missing diagrams * rename legacy prefix to shortcut prefix * Update editions/tw5.com/tiddlers/filters/Filter Operators.tid Co-authored-by: yaisog * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog * Update editions/tw5.com/tiddlers/filters/syntax/Sort Filter Run Prefix.tid Co-authored-by: yaisog * Update editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid Co-authored-by: yaisog * Update editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid Co-authored-by: yaisog * add most changes a suggested by yaisog * fix copy / paste from-version * replace operand with parameter in the docs * fix typo * fix typos and improve railroad diagrams consistency * move "new from version" info for filter run prefixes below the table * fix typo transclusion and substitution * Move Filters tiddler to the top level in the TOC * wip-breadcrumbs * breadcrumbs & breadcrumbsList macro final * remove files that do not belong to this PR * restore release banner * add simple / story mode to breadcrumbs * .breadcrumbs macro update comments * new breadcrumbs CSS, woks with small screens * make CSS configurable using hidden-settings * improve CSS fro small screens * remove the initial: recursiveParentTag macro * improve location info for breadcrumbs nav. add "alt-text" for Edge ::after element * breadcrumbs add mode=field * bc add initial docs * breadcrumbsField will also respect the story ordering * add configurable global filterMode setting * improve arrow CSS for browser zooming * add bc links use bc-caption if caption field is non-empty * breadcrumbs improve comments * breadcrumbs aria-lable uses caption if there is one * breadcrumbs improve documentation * breadcrumbs improve docs for sort param * fix showArrows docs * remove .bc-link aria-label .. it's not needed if caption is resolved properly * use subfilter instead of enlist to evaluate the "excluded" variable. Be consistent with toc-macros * remove breadcrumbs macros - they have their own PR now * resolve conflict * add back doc-macros tiddler * integrate :then filter run prefix * remove .breadcrumbs macros and their config tiddlers * fix typos as requested --------- Co-authored-by: yaisog --- core/language/en-GB/Docs/ModuleTypes.multids | 2 +- core/language/en-GB/Misc.multids | 2 +- editions/tw5.com/tiddlers/$__StoryList.tid | 5 - .../tw5.com/tiddlers/concepts/Filters.tid | 6 +- .../tiddlers/concepts/TextReference.tid | 4 +- .../tw5.com/tiddlers/definitions/Legacy.tid | 9 ++ .../filters/Conditional Operators.tid | 10 +- .../tiddlers/filters/Filter Operators.tid | 19 ++- .../filters/Mathematics Operators.tid | 4 +- editions/tw5.com/tiddlers/filters/add.tid | 4 +- editions/tw5.com/tiddlers/filters/all.tid | 12 +- editions/tw5.com/tiddlers/filters/append.tid | 6 +- .../tw5.com/tiddlers/filters/charcode.tid | 4 +- .../tiddlers/filters/compare Operator.tid | 4 +- .../tiddlers/filters/cycle Operator.tid | 2 +- .../tiddlers/filters/divide Operator.tid | 2 +- .../tiddlers/filters/enlist Operator.tid | 4 +- .../filters/enlist-input Operator.tid | 2 +- .../tiddlers/filters/examples/prepend.tid | 4 +- .../subfilter Operator (Examples).tid | 2 +- editions/tw5.com/tiddlers/filters/field.tid | 22 ++-- editions/tw5.com/tiddlers/filters/format.tid | 12 +- .../tw5.com/tiddlers/filters/jsonextract.tid | 4 +- editions/tw5.com/tiddlers/filters/jsonget.tid | 4 +- .../tw5.com/tiddlers/filters/jsonindexes.tid | 4 +- .../tw5.com/tiddlers/filters/jsontype.tid | 4 +- .../tw5.com/tiddlers/filters/log Operator.tid | 2 +- .../tiddlers/filters/match Operator.tid | 11 +- .../tw5.com/tiddlers/filters/max Operator.tid | 4 +- .../tw5.com/tiddlers/filters/min Operator.tid | 2 +- .../filters/moduleproperty Operator.tid | 2 +- editions/tw5.com/tiddlers/filters/modules.tid | 2 +- .../tiddlers/filters/multiply Operator.tid | 2 +- .../tiddlers/filters/power Operator.tid | 2 +- editions/tw5.com/tiddlers/filters/prefix.tid | 21 ++-- editions/tw5.com/tiddlers/filters/prepend.tid | 4 +- editions/tw5.com/tiddlers/filters/range.tid | 22 ++-- editions/tw5.com/tiddlers/filters/reduce.tid | 4 +- .../tiddlers/filters/remainder Operator.tid | 2 +- editions/tw5.com/tiddlers/filters/remove.tid | 6 +- .../tw5.com/tiddlers/filters/removeprefix.tid | 19 ++- .../tw5.com/tiddlers/filters/removesuffix.tid | 19 ++- editions/tw5.com/tiddlers/filters/search.tid | 6 +- editions/tw5.com/tiddlers/filters/sortby.tid | 2 +- .../tiddlers/filters/subfilter Operator.tid | 6 +- .../tiddlers/filters/subtract Operator.tid | 2 +- editions/tw5.com/tiddlers/filters/suffix.tid | 21 ++-- .../filters/syntax/All Filter Run Prefix.tid | 18 +++ .../filters/syntax/And Filter Run Prefix.tid | 18 +++ .../Cascade Filter Run Prefix (Examples).tid | 4 +- .../syntax/Cascade Filter Run Prefix.tid | 23 ++-- .../filters/syntax/Else Filter Run Prefix.tid | 18 +++ .../syntax/Except Filter Run Prefix.tid | 18 +++ .../filters/syntax/Filter Expression.tid | 74 ++---------- .../Filter Filter Run Prefix (Examples).tid | 4 +- .../syntax/Filter Filter Run Prefix.tid | 33 ++--- .../filters/syntax/Filter Parameter.tid | 18 +-- .../syntax/Filter Run Prefix (Examples).tid | 4 +- .../filters/syntax/Filter Run Prefix.tid | 18 +++ .../tiddlers/filters/syntax/Filter Run.tid | 9 +- .../tiddlers/filters/syntax/Filter Step.tid | 32 +++-- .../tiddlers/filters/syntax/Filter Syntax.tid | 18 ++- .../filters/syntax/Filter Whitespace.tid | 8 +- .../Interchangeable Filter Run Prefixes.tid | 44 +++++++ ...ersection Filter Run Prefix (Examples).tid | 4 +- .../syntax/Intersection Filter Run Prefix.tid | 21 ++-- .../Map Filter Run Prefix (Examples).tid | 4 +- .../filters/syntax/Map Filter Run Prefix.tid | 37 +++--- .../syntax/Named Filter Run Prefix.tid | 38 +++++- .../filters/syntax/Or Filter Run Prefix.tid | 18 +++ .../Reduce Filter Run Prefix (Examples).tid | 4 +- .../syntax/Reduce Filter Run Prefix.tid | 37 +++--- .../syntax/Shortcut Filter Run Prefixes.tid | 29 +++++ .../Sort Filter Run Prefix (Examples).tid | 4 +- .../filters/syntax/Sort Filter Run Prefix.tid | 25 ++-- .../filters/syntax/then Filter Run Prefix.tid | 39 +----- .../tiddlers/filters/toggle Operator.tid | 4 +- .../tiddlers/system/TableOfContents.tid | 4 +- .../tiddlers/system/filter-run-template.tid | 49 ++++++++ .../tiddlers/system/operator-template.tid | 113 ++++++++---------- .../Transclusion and Substitution.tid | 4 +- 81 files changed, 669 insertions(+), 444 deletions(-) delete mode 100644 editions/tw5.com/tiddlers/$__StoryList.tid create mode 100644 editions/tw5.com/tiddlers/definitions/Legacy.tid create mode 100644 editions/tw5.com/tiddlers/filters/syntax/All Filter Run Prefix.tid create mode 100644 editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid create mode 100644 editions/tw5.com/tiddlers/filters/syntax/Else Filter Run Prefix.tid create mode 100644 editions/tw5.com/tiddlers/filters/syntax/Except Filter Run Prefix.tid create mode 100644 editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix.tid create mode 100644 editions/tw5.com/tiddlers/filters/syntax/Interchangeable Filter Run Prefixes.tid create mode 100644 editions/tw5.com/tiddlers/filters/syntax/Or Filter Run Prefix.tid create mode 100644 editions/tw5.com/tiddlers/filters/syntax/Shortcut Filter Run Prefixes.tid create mode 100644 editions/tw5.com/tiddlers/system/filter-run-template.tid diff --git a/core/language/en-GB/Docs/ModuleTypes.multids b/core/language/en-GB/Docs/ModuleTypes.multids index 9a03d8887..5d5902c76 100644 --- a/core/language/en-GB/Docs/ModuleTypes.multids +++ b/core/language/en-GB/Docs/ModuleTypes.multids @@ -9,7 +9,7 @@ config: Data to be inserted into `$tw.config`. filteroperator: Individual filter operator methods. global: Global data to be inserted into `$tw`. info: Publishes system information via the [[$:/temp/info-plugin]] pseudo-plugin. -isfilteroperator: Operands for the ''is'' filter operator. +isfilteroperator: Parameters for the ''is'' filter operator. library: Generic module type for general purpose JavaScript modules. macro: JavaScript macro definitions. parser: Parsers for different content types. diff --git a/core/language/en-GB/Misc.multids b/core/language/en-GB/Misc.multids index 2c10d1acb..b5e6e2374 100644 --- a/core/language/en-GB/Misc.multids +++ b/core/language/en-GB/Misc.multids @@ -30,7 +30,7 @@ Error/DeserializeOperator/UnknownDeserializer: Filter Error: Unknown deserialize Error/Filter: Filter error Error/FilterSyntax: Syntax error in filter expression Error/FilterRunPrefix: Filter Error: Unknown prefix for filter run -Error/IsFilterOperator: Filter Error: Unknown operand for the 'is' filter operator +Error/IsFilterOperator: Filter Error: Unknown parameter for the 'is' filter operator Error/FormatFilterOperator: Filter Error: Unknown suffix for the 'format' filter operator Error/LoadingPluginLibrary: Error loading plugin library Error/NetworkErrorAlert: `

''Network Error''

It looks like the connection to the server has been lost. This may indicate a problem with your network connection. Please attempt to restore network connectivity before continuing.

''Any unsaved changes will be automatically synchronised when connectivity is restored''.` diff --git a/editions/tw5.com/tiddlers/$__StoryList.tid b/editions/tw5.com/tiddlers/$__StoryList.tid deleted file mode 100644 index 37ea75152..000000000 --- a/editions/tw5.com/tiddlers/$__StoryList.tid +++ /dev/null @@ -1,5 +0,0 @@ -created: 20220728145919904 -list: Brackets Base64 HelloThere GettingStarted Community -modified: 20220728145919904 -title: $:/StoryList -type: text/vnd.tiddlywiki \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/concepts/Filters.tid b/editions/tw5.com/tiddlers/concepts/Filters.tid index b9fec39fc..3e7c0bd6a 100644 --- a/editions/tw5.com/tiddlers/concepts/Filters.tid +++ b/editions/tw5.com/tiddlers/concepts/Filters.tid @@ -1,7 +1,7 @@ created: 20130827080000000 list: [[Introduction to filter notation]] [[Filter Syntax]] -modified: 20220316145511797 -tags: Reference Concepts +modified: 20230710074511095 +tags: Reference Concepts TableOfContents title: Filters type: text/vnd.tiddlywiki @@ -15,7 +15,7 @@ You can think of TiddlyWiki as a database in which the records are tiddlers. A d A <<.def filter>> is a concise notation for selecting a particular [[set of tiddlers|Title Selection]], known as its <<.def "output">>. Whenever ~TiddlyWiki encounters a filter, it calculates the output. Further work can then be done with just those tiddlers, such as [[counting|CountWidget]] or [[listing|ListWidget]] them. -The following example passes a filter to the <<.mlink list-links>> macro to display a list of all tiddlers whose titles are <<.olink2 tagged tag>> with the word <<.word Filters>>: +The following example passes a filter to the <<.mlink list-links>> macro. It displays a list of all tiddlers using the <<.olink2 tag tag>> <<.word Filters>>: <>""" >> diff --git a/editions/tw5.com/tiddlers/concepts/TextReference.tid b/editions/tw5.com/tiddlers/concepts/TextReference.tid index 474149b88..cf2341a97 100644 --- a/editions/tw5.com/tiddlers/concepts/TextReference.tid +++ b/editions/tw5.com/tiddlers/concepts/TextReference.tid @@ -1,5 +1,5 @@ created: 20130827075900000 -modified: 20161216173541948 +modified: 20230321130421587 tags: Concepts title: TextReference type: text/vnd.tiddlywiki @@ -27,7 +27,7 @@ Text references can be used in several places: * As [[indirect parameters|Filter Parameter]] within [[Filters]] (eg, `<$list filter="[tag{MyTag!!name}]"/>`) * As [[indirect attributes|HTML in WikiText]] of an element or widget (eg, `<$widget attrib={{Title!!description}}/>`) -* As the operand of a shortcut transclusion (eg, `{{MyTiddler!!title}}`) +* As the parameter of a shortcut transclusion (eg, `{{MyTiddler!!title}}`) * As the `state` attribute of the RevealWidget and the LinkCatcherWidget <$macrocall $name=".tip" _="""Note the distinction between a text reference such as `foo!!bar` and a transclusion of a text reference such as `{{foo!!bar}}`"""/> diff --git a/editions/tw5.com/tiddlers/definitions/Legacy.tid b/editions/tw5.com/tiddlers/definitions/Legacy.tid new file mode 100644 index 000000000..325f9e809 --- /dev/null +++ b/editions/tw5.com/tiddlers/definitions/Legacy.tid @@ -0,0 +1,9 @@ +created: 20230319131443509 +modified: 20230319132235520 +tags: Definitions +title: Legacy +type: text/vnd.tiddlywiki + +>Legacy code is old computer source code that is no longer supported on the standard hardware and environments, and is a codebase that is in some respect obsolete or supporting something obsolete. Legacy code may be written in programming languages, use frameworks and external libraries, or use architecture and patterns that are no longer considered modern, increasing the mental burden and ramp-up time for software engineers who work on the codebase. +> +>https://en.wikipedia.org/wiki/Legacy_system \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/Conditional Operators.tid b/editions/tw5.com/tiddlers/filters/Conditional Operators.tid index 6d21e0864..a8dc5a1b2 100644 --- a/editions/tw5.com/tiddlers/filters/Conditional Operators.tid +++ b/editions/tw5.com/tiddlers/filters/Conditional Operators.tid @@ -1,10 +1,10 @@ created: 20190802113703788 -modified: 20230501175143648 +modified: 20230711082337975 tags: Filters title: Conditional Operators type: text/vnd.tiddlywiki -<<.from-version "5.1.20">>The conditional filter operators allow for ''if-then-else'' logic to be expressed within filters. +<<.from-version "5.1.20">> The conditional filter operators allow ''if-then-else'' logic to be expressed within filters. The foundation is the convention that an empty list can be used to represent the Boolean value <<.value false>> and a list with at one (or more) entries to represent <<.value true>>. @@ -25,6 +25,8 @@ The <<.olink else>> operator can be used to apply a defaults for missing values. <<.operator-example 2 "[[HelloThere]get[custom-field]else[default-value]]">> -! Filter Run Prefixes +''Filter Run Prefixes'' -The [[:then|:then Filter Run Prefix]] and [[:else|:else Filter Run Prefix]] filter run prefixes serve a similar purpose as the conditional operators. Refer to their documentation for more information. \ No newline at end of file +The [[:then|Then Filter Run Prefix]] and [[:else|Else Filter Run Prefix]] named filter run prefixes serve a similar purpose as the conditional operators. + +Also see: [[Named Filter Run Prefix]] diff --git a/editions/tw5.com/tiddlers/filters/Filter Operators.tid b/editions/tw5.com/tiddlers/filters/Filter Operators.tid index 0738c7103..35d80607f 100644 --- a/editions/tw5.com/tiddlers/filters/Filter Operators.tid +++ b/editions/tw5.com/tiddlers/filters/Filter Operators.tid @@ -1,5 +1,6 @@ +breadcrumbs: [[Filter Step]] created: 20140410103123179 -modified: 20211217141224284 +modified: 20230410114132501 tags: Filters title: Filter Operators type: text/vnd.tiddlywiki @@ -18,13 +19,19 @@ type: text/vnd.tiddlywiki $_$ \end -A <<.def "filter operator">> is a predefined keyword attached to an individual [[step|Filter Step]] of a [[filter|Filters]]. It defines the particular action of that step. +A <<.def "filter operator">> is a predefined keyword attached to an individual step of a [[filter|Filters]]. It defines the particular action of that step. -''Important:'' Each first [[step|Filter Step]] of a [[filter run|Filter Run]] not given any input titles receives the output of <$link to="all Operator">[all[tiddlers]] as its input. +''Important:'' In general, each first [[filter step|Filter Step]] of a [[filter run|Filter Run]] not given any input titles receives the output of <$link to="all Operator">[all[tiddlers]] as its input. -The following table lists all core operators, the most common ones marked ✓. The `!` column indicates whether an operator allows ''negation'' using the <$link to="Filter Step">! prefix. For specifics as to each operator's negated output please refer to its documentation. -Most steps process the [[selection of titles|Title Selection]] that are supplied as their input, but a few [[construct an entirely new selection|Selection Constructors]] instead, as indicated by the last column. A `C?` indicates it might construct a new selection, depending on usage. For specifics as to each operator's selection creation please refer to its documentation. +''Table legend:'' + +|tc-table-no-border tc-first-col-min-width|k +|^ ✓|^... |,Used to mark the most common ones | +|^ `!`|^... |,The column indicates whether an operator allows ''negation'' using the <$link to="Filter Step">! prefix.
For specifics as to each operator's negated output please refer to its documentation | +|^ `C`|^... |,Most steps process the [[selection of titles|Title Selection]] that are supplied as their input, but a few [[construct an entirely new selection|Selection Constructors]] instead, as indicated by the last column.
A `C?` indicates it might construct a new selection, depending on usage. For specifics as to each operator's selection creation please refer to its documentation | + +The following table lists all core operators: @@ -49,6 +56,6 @@ Most steps process the [[selection of titles|Title Selection]] that are supplied <<.operator-rows "[tag[Filter Operators]!tag[Order Operators]!tag[Mathematics Operators]!tag[String Operators]!tag[Tag Operators]tag[Special Operators]sort[]]">>
-A typical step is written as `[operator[parameter]]`, although not all of the operators need a [[parameter|Filter Parameter]]. +A typical step is written as `[operator[parameter]]`, although not all of the operators need a [[parameter|Filter Parameter]]. For the exact rules, see [[Filter Syntax]]. \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/Mathematics Operators.tid b/editions/tw5.com/tiddlers/filters/Mathematics Operators.tid index 94f89a267..4c0160b90 100644 --- a/editions/tw5.com/tiddlers/filters/Mathematics Operators.tid +++ b/editions/tw5.com/tiddlers/filters/Mathematics Operators.tid @@ -1,5 +1,5 @@ created: 20190206140446821 -modified: 20220330133748666 +modified: 20230321133008898 tags: Filters title: Mathematics Operators type: text/vnd.tiddlywiki @@ -22,7 +22,7 @@ The mathematics operators take three different forms: ** <<.inline-operator-example "=1 =2 =3 =4 +[negate[]]">> ** <<.inline-operator-example "=1.2 =2.4 =3.6 =4.8 +[trunc[]]">> ** <<.inline-operator-example "=1.2 =2.4 =3.6 =4.8 +[round[]]">> -* ''Binary operators'' apply an operation and operand to each number in the input list (e.g. add, multiply, remainder) +* ''Binary operators'' apply an operation and parameter to each number in the input list (e.g. add, multiply, remainder) ** <<.inline-operator-example "=1 =2 =3 =4 +[add[3]]">> ** <<.inline-operator-example "=1 =2 =3 =4 +[multiply[8]]">> * ''Reducing operators'' apply an operation to all of the numbers in the input list, returning a single result (e.g. sum, product) diff --git a/editions/tw5.com/tiddlers/filters/add.tid b/editions/tw5.com/tiddlers/filters/add.tid index 3bed37537..e808ced7c 100644 --- a/editions/tw5.com/tiddlers/filters/add.tid +++ b/editions/tw5.com/tiddlers/filters/add.tid @@ -1,11 +1,11 @@ caption: add created: 20190206140446821 -modified: 20190611125053329 +modified: 20230321130647487 op-input: a [[selection of titles|Title Selection]] op-output: the input as numbers, but with <<.place N>> added to each one op-parameter: a number op-parameter-name: N -op-purpose: treating each input title as a number, add to each the numeric value of the operand +op-purpose: treating each input title as a number, add to each the numeric value of the parameter tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]] title: add Operator type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/all.tid b/editions/tw5.com/tiddlers/filters/all.tid index 21b65e651..5d65ca6ab 100644 --- a/editions/tw5.com/tiddlers/filters/all.tid +++ b/editions/tw5.com/tiddlers/filters/all.tid @@ -1,6 +1,6 @@ caption: all created: 20140410103123179 -modified: 20211217135719266 +modified: 20230321131457669 op-input: ignored, unless the parameter is empty op-output: the titles that belong to all the specified categories op-parameter: zero or more categories @@ -9,10 +9,14 @@ tags: [[Filter Operators]] [[Common Operators]] [[Selection Constructors]] [[Sel title: all Operator type: text/vnd.tiddlywiki -The parameter specifies zero or more fundamental categories using the following syntax: +The parameter specifies zero or more fundamental categories using the following [[filter step|Filter Step]] syntax: <$railroad text=""" -[{: ("current" | "missing" |: "orphans" | "shadows" | "tags" | "tiddlers" ) +"+" }] +\start none +\end none +<-"all"-> ( "[" | "<" | "{" ) + [{: ("current" | "missing" |: "orphans" | "shadows" | "tags" | "tiddlers" ) +"+" }] + ( "]" | ">" | "}" ) """/> |!Category |!Members |!Sorted | @@ -25,7 +29,7 @@ The parameter specifies zero or more fundamental categories using the following If the parameter specifies more than one category, they are processed from left to right. The overall output is initially empty, and each category's output is [[dominantly appended|Dominant Append]] to it in turn. Unrecognised categories contribute nothing to the output. -As a special case, if the parameter is empty, the output is simply a copy of the input. This can be useful when the parameter is [[soft|Filter Parameter]]. +As a special case, if the parameter is empty, the output is simply a copy of the input. This can be useful when the parameter is a [[soft parameter|Filter Parameter]]. The <<.olink is>> operator is similar, but its scope is restricted to its input. diff --git a/editions/tw5.com/tiddlers/filters/append.tid b/editions/tw5.com/tiddlers/filters/append.tid index 881dfc257..840206aae 100644 --- a/editions/tw5.com/tiddlers/filters/append.tid +++ b/editions/tw5.com/tiddlers/filters/append.tid @@ -1,9 +1,9 @@ caption: append created: 20151017145358368 -modified: 20151108051540981 +modified: 20230321131631510 op-input: a list of items -op-neg-output: a list with items appended from the tail of the operand array -op-output: a list with items appended from the head of the operand array +op-neg-output: a list with items appended from the tail of the parameter array +op-output: a list with items appended from the head of the parameter array op-parameter: the array of items to be appended to the tail of the list op-parameter-name: list op-purpose: append a range of items from an array to the list diff --git a/editions/tw5.com/tiddlers/filters/charcode.tid b/editions/tw5.com/tiddlers/filters/charcode.tid index 3cb82bc68..2b64536b0 100644 --- a/editions/tw5.com/tiddlers/filters/charcode.tid +++ b/editions/tw5.com/tiddlers/filters/charcode.tid @@ -2,7 +2,7 @@ caption: charcode created: 20210622214425635 modified: 20210622214425635 op-input: ignored -op-output: a string formed from concatenating the characters specified by the numeric codes given in the operand(s) +op-output: a string formed from concatenating the characters specified by the numeric codes given in the parameter(s) op-parameter: numeric character code op-parameter-name: C op-purpose: generates string characters from their numeric character codes @@ -12,6 +12,6 @@ type: text/vnd.tiddlywiki <<.from-version "5.2.0">> -This operator returns a string formed from concatenating the characters specified by the numeric codes given in one or more operands. It is useful for generating special characters such as tab (`charcode[9]`) or new line (`charcode[13],[10]`). +This operator returns a string formed from concatenating the characters specified by the numeric codes given in one or more parameters. It is useful for generating special characters such as tab (`charcode[9]`) or new line (`charcode[13],[10]`). <<.operator-examples "charcode">> diff --git a/editions/tw5.com/tiddlers/filters/compare Operator.tid b/editions/tw5.com/tiddlers/filters/compare Operator.tid index 95bdce2a9..debf09ead 100644 --- a/editions/tw5.com/tiddlers/filters/compare Operator.tid +++ b/editions/tw5.com/tiddlers/filters/compare Operator.tid @@ -4,7 +4,7 @@ tags: [[Filter Operators]] [[Mathematics Operators]] [[String Operators]] [[Nega title: compare Operator type: text/vnd.tiddlywiki caption: compare -op-purpose: filter the input by comparing each item against the operand +op-purpose: filter the input by comparing each item against the parameter op-input: a [[selection of titles|Title Selection]] op-suffix: the <<.op compare>> operator uses a rich suffix, see below for details op-parameter: the value to compare @@ -16,7 +16,7 @@ op-neg-output: those input titles <<.em not>> matching the specified comparison The <<.op compare>> operator uses an extended syntax to specify all the options: ``` -[compare::[]] +[compare::[]] ``` The ''type'' can be: diff --git a/editions/tw5.com/tiddlers/filters/cycle Operator.tid b/editions/tw5.com/tiddlers/filters/cycle Operator.tid index f54316f29..7cf76c28d 100644 --- a/editions/tw5.com/tiddlers/filters/cycle Operator.tid +++ b/editions/tw5.com/tiddlers/filters/cycle Operator.tid @@ -4,7 +4,7 @@ modified: 20201118192136472 op-input: a list of items op-output: the input list with the titles specified in the parameter toggled in a cyclical manner op-parameter: the <<.op cycle>> operator accepts 1 or 2 parameters, see below for details -op-purpose: toggle in the input, the titles specified in the first operand in a cyclical manner +op-purpose: toggle the titles specified in the first parameter in a cyclical manner tags: [[Filter Operators]] [[Listops Operators]] [[Order Operators]] title: cycle Operator type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/divide Operator.tid b/editions/tw5.com/tiddlers/filters/divide Operator.tid index 9218c9a99..b8b357861 100644 --- a/editions/tw5.com/tiddlers/filters/divide Operator.tid +++ b/editions/tw5.com/tiddlers/filters/divide Operator.tid @@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]] op-output: the input as numbers, but with each one divided by <<.place N>> op-parameter: a number op-parameter-name: N -op-purpose: treating each input title as a number, divide them by the numeric value of the operand +op-purpose: treating each input title as a number, divide it by the numeric value of the parameter tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]] title: divide Operator type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/enlist Operator.tid b/editions/tw5.com/tiddlers/filters/enlist Operator.tid index e45e97c2a..a23a30e64 100644 --- a/editions/tw5.com/tiddlers/filters/enlist Operator.tid +++ b/editions/tw5.com/tiddlers/filters/enlist Operator.tid @@ -7,14 +7,14 @@ op-neg-output: those input titles that are <<.em not>> listed in <<.place L>> op-output: the titles stored as a [[title list|Title List]] at <<.place L>> op-parameter: a [[title list|Title List]] op-parameter-name: L -op-purpose: select titles from the operand interpreted as a [[title list|Title List]] +op-purpose: select titles from the parameter interpreted as a [[title list|Title List]] op-suffix: <<.from-version "5.1.20">> `dedupe` (the default) to remove duplicates, `raw` to leave duplicates untouched op-suffix-name: D tags: [[Filter Operators]] [[Field Operators]] [[Selection Constructors]] [[Negatable Operators]] title: enlist Operator type: text/vnd.tiddlywiki -<<.tip """Literal filter operands cannot contain square brackets but you can work around the issue by using a variable. ''Learn more at:'' [[SetWidget]] documentation under the heading "Filtered List Variable Assignment" """>> +<<.tip """Literal filter parameters cannot contain square brackets but you can work around the issue by using a variable. ''Learn more at:'' [[SetWidget]] documentation under the heading "Filtered List Variable Assignment" """>> ``` <$set name="myList" value="first [[second with a space]] third"> diff --git a/editions/tw5.com/tiddlers/filters/enlist-input Operator.tid b/editions/tw5.com/tiddlers/filters/enlist-input Operator.tid index 386723b51..aa35f8f1c 100644 --- a/editions/tw5.com/tiddlers/filters/enlist-input Operator.tid +++ b/editions/tw5.com/tiddlers/filters/enlist-input Operator.tid @@ -12,7 +12,7 @@ type: text/vnd.tiddlywiki <<.from-version "5.1.23">> -<<.tip " Compare with [[enlist|enlist Operator]] operator that interprets its operand as a title list">> +<<.tip " Compare with [[enlist|enlist Operator]] operator that interprets its parameter as a title list">> ``` <$vars days={{{ [[Days of the Week]get[list]] }}}> diff --git a/editions/tw5.com/tiddlers/filters/examples/prepend.tid b/editions/tw5.com/tiddlers/filters/examples/prepend.tid index 0c66d1002..57f73fc6f 100644 --- a/editions/tw5.com/tiddlers/filters/examples/prepend.tid +++ b/editions/tw5.com/tiddlers/filters/examples/prepend.tid @@ -1,5 +1,5 @@ created: 20151017151508135 -modified: 20151108051743531 +modified: 20230321130446467 tags: [[Operator Examples]] [[prepend Operator]] title: prepend Operator (Examples) type: text/vnd.tiddlywiki @@ -10,6 +10,6 @@ The operator may be used to prepend a number of items to the list. <<.operator-example 1 "[list[Days of the Week]prepend[Yesterday Today Tomorrow]]">> -The operand may list only items without spaces -- to include items with spaces, use a reference to an array e.g. prepend the last three short days of the week to the list +The parameter may list only items without spaces -- to include items with spaces, use a reference to an array, e.g. prepend the last three short days of the week to the list <<.operator-example 2 "[list[Days of the Week]!prepend:3{Days of the Week!!short}]">> diff --git a/editions/tw5.com/tiddlers/filters/examples/subfilter Operator (Examples).tid b/editions/tw5.com/tiddlers/filters/examples/subfilter Operator (Examples).tid index eac8828a3..2ebe37db2 100644 --- a/editions/tw5.com/tiddlers/filters/examples/subfilter Operator (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/examples/subfilter Operator (Examples).tid @@ -9,7 +9,7 @@ type: text/vnd.tiddlywiki ''<$text text=<<__name__>>/>'': <$text text={{{ [<__name__>getvariable[]] }}}/> \end -Literal filter operands can be used, but such cases are better rewritten without using <<.op subfilter>>: +Literal filter parameters can be used, but such cases are better rewritten without using <<.op subfilter>>: <<.operator-example 1 "[subfilter[one two three]addsuffix[!]]" "same as `one two three +[addsuffix[!]]`">> The <<.op subfilter>> operator can be used to dynamically define parts of a [[filter run|Filter Run]]. This is useful for sharing a common pieces of a filter across multiple filters. diff --git a/editions/tw5.com/tiddlers/filters/field.tid b/editions/tw5.com/tiddlers/filters/field.tid index 901f22feb..4f2f243e9 100644 --- a/editions/tw5.com/tiddlers/filters/field.tid +++ b/editions/tw5.com/tiddlers/filters/field.tid @@ -1,23 +1,23 @@ +caption: field created: 20140410103123179 -modified: 20150203184718000 +modified: 20230316111901766 +op-input: a [[selection of titles|Title Selection]] +op-neg-output: those input tiddlers in which field <<.place F>> does <<.em not>> have the value <<.place S>> +op-output: those input tiddlers in which field <<.place F>> has the value <<.place S>> +op-parameter: a possible value of field <<.place F>> +op-parameter-name: S +op-purpose: filter the input by field +op-suffix: the name of a [[field|TiddlerFields]] +op-suffix-name: F tags: [[Filter Operators]] [[Common Operators]] [[Field Operators]] [[Negatable Operators]] title: field Operator type: text/vnd.tiddlywiki -caption: field -op-purpose: filter the input by field -op-input: a [[selection of titles|Title Selection]] -op-suffix: the name of a [[field|TiddlerFields]] -op-suffix-name: F -op-parameter: a possible value of field <<.place F>> -op-parameter-name: S -op-output: those input tiddlers in which field <<.place F>> has the value <<.place S>> -op-neg-output: those input tiddlers in which field <<.place F>> does <<.em not>> have the value <<.place S>> If <<.place S>> is empty, <<.op field>> will match both of the following: * tiddlers that don't contain field <<.place F>> * tiddlers in which field <<.place F>> exists but has an empty value -The syntax of a [[filter step|Filter Step]] treats any unrecognised [[filter operator|Filter Operators]] as if it was the suffix to the <<.op field>> operator. See the <<.operator-examples "field" "examples">>. +The syntax of a [[filter step|Filter Step]] treats any unrecognised [[filter operator|Filter Operators]] as if it was the suffix to the <<.op field>> operator. <<.operator-examples "field">> diff --git a/editions/tw5.com/tiddlers/filters/format.tid b/editions/tw5.com/tiddlers/filters/format.tid index d62a82169..7d650ed0a 100644 --- a/editions/tw5.com/tiddlers/filters/format.tid +++ b/editions/tw5.com/tiddlers/filters/format.tid @@ -1,6 +1,6 @@ caption: format created: 20201020100834443 -modified: 20220611104737314 +modified: 20230321132245053 op-input: a [[selection of titles|Title Selection]] op-output: input strings formatted according to the specified suffix <<.place B>> op-parameter: optional format string for the formats @@ -16,11 +16,11 @@ type: text/vnd.tiddlywiki The suffix <<.place B>> is one of the following supported string formats: -|!Format |!Description | -|^`date` |The input string is interpreted as a UTC date and displayed according to the DateFormat specified in the optional operator operand. (Defaults to "YYYY MM DD 0hh:0mm") | -|^`json` |<<.from-version "5.2.4">> The input string is interpreted as JSON and displayed with standard formatting. The optional operator operand specifies the number of spaces to use for indenting, or a string to use for indenting. Nothing is returned if the input string is not valid JSON | -|^`relativedate` |The input string is interpreted as a UTC date and displayed as the interval from the present instant. Any operator parameters are ignored | -|^`timestamp` |<<.from-version "5.3.0">> The input string is interpreted as number of milliseconds since the [[ECMAScript epoch|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#the_ecmascript_epoch_and_timestamps]], 1 January 1970, and displayed according to the DateFormat specified in the optional operator operand. (Defaults to "[UTC]YYYY0MM0DD0hh0mm0ss0XXX") | +|Format |Description |h +|^`date` |The input string is interpreted as a UTC date and displayed according to the DateFormat specified in the optional parameter <<.place C>>. (Defaults to "YYYY MM DD 0hh:0mm") | +|^`json` |<<.from-version "5.2.4">> The input string is interpreted as JSON and displayed with standard formatting. The optional parameter <<.place C>> specifies the number of spaces to use for indenting, or a string to use for indenting. Nothing is returned if the input string is not valid JSON | +|^`relativedate` |The input string is interpreted as a UTC date and displayed as the interval from the present instant. Any operator parameters <<.place C>> are ignored | +|^`timestamp` |<<.from-version "5.3.0">> The input string is interpreted as number of milliseconds since the [[ECMAScript epoch|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#the_ecmascript_epoch_and_timestamps]], 1 January 1970, and displayed according to the DateFormat specified in the optional operator parameter. (Defaults to "[UTC]YYYY0MM0DD0hh0mm0ss0XXX") | |^`titlelist` |<<.from-version "5.2.0">> The input string wrapped in double square brackets if it contains a space. Appropriate for use in a [[title list|Title List]]. | Invalid input strings are dropped by the <<.op format>> operator. diff --git a/editions/tw5.com/tiddlers/filters/jsonextract.tid b/editions/tw5.com/tiddlers/filters/jsonextract.tid index 27724205f..a899ac6e6 100644 --- a/editions/tw5.com/tiddlers/filters/jsonextract.tid +++ b/editions/tw5.com/tiddlers/filters/jsonextract.tid @@ -43,7 +43,7 @@ Properties within a JSON object are identified by a sequence of indexes. In the The following examples assume that this JSON data is contained in a variable called `jsondata`. -The <<.op jsonextract>> operator uses multiple operands to specify the indexes of the property to retrieve. Values are returned as literal JSON strings: +The <<.op jsonextract>> operator uses multiple parameters to specify the indexes of the property to retrieve. Values are returned as literal JSON strings: ``` [jsonextract[a]] --> "one" @@ -67,7 +67,7 @@ Indexes can be dynamically composed from variables and transclusions: [jsonextract,{!!field},[0]] ``` -A subtlety is that the special case of a single blank operand is used to identify the root object. Thus: +A subtlety is that the special case of a single blank parameter is used to identify the root object. Thus: ``` [jsonextract[]] --> {"a":"one","b":"","c":"three","d":{"e":"four","f":["five","six",true,false,null],"g":{"x":"max","y":"may","z":"maize"}}} diff --git a/editions/tw5.com/tiddlers/filters/jsonget.tid b/editions/tw5.com/tiddlers/filters/jsonget.tid index c50cbd6f2..b1db4e308 100644 --- a/editions/tw5.com/tiddlers/filters/jsonget.tid +++ b/editions/tw5.com/tiddlers/filters/jsonget.tid @@ -43,7 +43,7 @@ Properties within a JSON object are identified by a sequence of indexes. In the The following examples assume that this JSON data is contained in a variable called `jsondata`. -The <<.op jsonget>> operator uses multiple operands to specify the indexes of the property to retrieve: +The <<.op jsonget>> operator uses multiple parameters to specify the indexes of the property to retrieve: ``` [jsonget[a]] --> "one" @@ -94,7 +94,7 @@ If the object or array contains nested child objects or arrays then the values a [jsonget[d]] --> "four","five","six","true","false","null","max","may","maize" ``` -A subtlety is that the special case of a single blank operand is used to identify the root object. Thus: +A subtlety is that the special case of a single blank parameter is used to identify the root object. Thus: ``` [jsonindexes[]] --> "a", "b", "c", "d" diff --git a/editions/tw5.com/tiddlers/filters/jsonindexes.tid b/editions/tw5.com/tiddlers/filters/jsonindexes.tid index 605936a2f..3b9962b5f 100644 --- a/editions/tw5.com/tiddlers/filters/jsonindexes.tid +++ b/editions/tw5.com/tiddlers/filters/jsonindexes.tid @@ -43,7 +43,7 @@ Properties within a JSON object are identified by a sequence of indexes. In the The following examples assume that this JSON data is contained in a variable called `jsondata`. -The <<.op jsonindexes>> operator uses multiple operands to specify the indexes of the property to retrieve: +The <<.op jsonindexes>> operator uses multiple parameters to specify the indexes of the property to retrieve: ``` [jsonindexes[d],[f]] --> "0", "1", "2", "3", "4" @@ -58,7 +58,7 @@ Indexes can be dynamically composed from variables and transclusions: Retrieving the indexes of JSON properties that are not objects or arrays will return nothing. -A subtlety is that the special case of a single blank operand is used to identify the root object. Thus: +A subtlety is that the special case of a single blank parameter is used to identify the root object. Thus: ``` [jsonindexes[]] --> "a", "b", "c", "d" diff --git a/editions/tw5.com/tiddlers/filters/jsontype.tid b/editions/tw5.com/tiddlers/filters/jsontype.tid index 6bff01914..d4561f0f5 100644 --- a/editions/tw5.com/tiddlers/filters/jsontype.tid +++ b/editions/tw5.com/tiddlers/filters/jsontype.tid @@ -52,7 +52,7 @@ Properties within a JSON object are identified by a sequence of indexes. In the The following examples assume that this JSON data is contained in a variable called `jsondata`. -The <<.op jsontype>> operator uses multiple operands to specify the indexes of the property whose type is to be retrieved: +The <<.op jsontype>> operator uses multiple parameters to specify the indexes of the property whose type is to be retrieved: ``` [jsontype[a]] --> "string" @@ -75,7 +75,7 @@ Indexes can be dynamically composed from variables and transclusions: [jsontype,{!!field},[0]] ``` -A subtlety is that the special case of a single blank operand is used to identify the root object. Thus: +A subtlety is that the special case of a single blank parameter is used to identify the root object. Thus: ``` [jsontype[]] --> "object" diff --git a/editions/tw5.com/tiddlers/filters/log Operator.tid b/editions/tw5.com/tiddlers/filters/log Operator.tid index bfca18853..bea10c539 100644 --- a/editions/tw5.com/tiddlers/filters/log Operator.tid +++ b/editions/tw5.com/tiddlers/filters/log Operator.tid @@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]] op-output: the logarithm of each input title as numbers, with base <<.place N>> if specified otherwise base `e` op-parameter: a number op-parameter-name: N -op-purpose: treating each input title as a number, return its logarithm with base equal to the numeric value of the operand if specified, otherwise base `e` +op-purpose: treating each input title as a number, return its logarithm with base equal to the numeric value of the parameter if specified, otherwise base `e` tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]] title: log Operator type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/match Operator.tid b/editions/tw5.com/tiddlers/filters/match Operator.tid index 6e9997d3f..46b6e04f3 100644 --- a/editions/tw5.com/tiddlers/filters/match Operator.tid +++ b/editions/tw5.com/tiddlers/filters/match Operator.tid @@ -1,11 +1,11 @@ caption: match created: 20190731080209404 -modified: 20190731081047732 +modified: 20230711082432865 op-input: a [[selection of titles|Title Selection]] -op-neg-output: each item in the input list that does not match the operand string -op-output: each item in the input list that matches the operand string (potentially including duplicates) +op-neg-output: each item in the input list that does not match the parameter string +op-output: each item in the input list that matches the parameter string (potentially including duplicates) op-parameter: the string to be matched -op-purpose: returns each item in the list that matches the operand string +op-purpose: returns each item in the list that matches the parameter string op-suffix: the <<.op match>> operator uses a rich suffix, see below for details tags: [[Filter Operators]] title: match Operator @@ -16,11 +16,10 @@ type: text/vnd.tiddlywiki The <<.op match>> operator uses an extended syntax that permits multiple flags to be passed: ``` -[match:[]] +[match:[]] ``` * ''flag list'': a comma delimited list of flags -* ''operand'': filter operand The available flags are: diff --git a/editions/tw5.com/tiddlers/filters/max Operator.tid b/editions/tw5.com/tiddlers/filters/max Operator.tid index 837c456ce..5d92b44cf 100644 --- a/editions/tw5.com/tiddlers/filters/max Operator.tid +++ b/editions/tw5.com/tiddlers/filters/max Operator.tid @@ -1,11 +1,11 @@ caption: max created: 20190611130631390 -modified: 20190611131047026 +modified: 20230321133057297 op-input: a [[selection of titles|Title Selection]] op-output: the input as numbers, with any that are less than <<.place N>> being replaced by <<.place N>> op-parameter: a number op-parameter-name: N -op-purpose: treating each input title as a number, take the maximum of its value and the numeric value of the operand +op-purpose: treating each input title as a number, take the maximum of its value and the numeric value of the parameter tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]] title: max Operator type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/min Operator.tid b/editions/tw5.com/tiddlers/filters/min Operator.tid index 097cf376e..f9c569a3b 100644 --- a/editions/tw5.com/tiddlers/filters/min Operator.tid +++ b/editions/tw5.com/tiddlers/filters/min Operator.tid @@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]] op-output: the input as numbers, with any that are greater than <<.place N>> being replaced by <<.place N>> op-parameter: a number op-parameter-name: N -op-purpose: treating each input title as a number, take the minimum of its value and the numeric value of the operand +op-purpose: treating each input title as a number, take the minimum of its value and the numeric value of the parameter tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]] title: min Operator type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/moduleproperty Operator.tid b/editions/tw5.com/tiddlers/filters/moduleproperty Operator.tid index 2ee4071d6..a62ddf4a5 100644 --- a/editions/tw5.com/tiddlers/filters/moduleproperty Operator.tid +++ b/editions/tw5.com/tiddlers/filters/moduleproperty Operator.tid @@ -2,7 +2,7 @@ caption: modulesproperty created: 20210919201126246 modified: 20210919201347702 op-input: a [[selection|Title Selection]] of modules -op-output: the value of the module property as specified in the operand +op-output: the value of the module property as specified in the parameter op-parameter: module property to retrieve op-purpose: retrieve a module property tags: [[Filter Operators]] [[Special Operators]] diff --git a/editions/tw5.com/tiddlers/filters/modules.tid b/editions/tw5.com/tiddlers/filters/modules.tid index fdc7f5cbe..3b42bc5d7 100644 --- a/editions/tw5.com/tiddlers/filters/modules.tid +++ b/editions/tw5.com/tiddlers/filters/modules.tid @@ -9,6 +9,6 @@ tags: [[Filter Operators]] [[Special Operators]] title: modules Operator type: text/vnd.tiddlywiki -<<.from-version "5.2.0">>The <<.op modules>> filter allows two optional operands. When both are specified, it returns the modules with the module property specified in the first operand which has the value in the second operand. +<<.from-version "5.2.0">>The <<.op modules>> filter allows two optional parameters. When both are specified, it returns the modules with the module property specified in the first parameter which has the value in the second parameter. <<.operator-examples "modules">> diff --git a/editions/tw5.com/tiddlers/filters/multiply Operator.tid b/editions/tw5.com/tiddlers/filters/multiply Operator.tid index 6eb92b7ad..bc91f9f27 100644 --- a/editions/tw5.com/tiddlers/filters/multiply Operator.tid +++ b/editions/tw5.com/tiddlers/filters/multiply Operator.tid @@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]] op-output: the input as numbers, but with each one multiplied by <<.place N>> op-parameter: a number op-parameter-name: N -op-purpose: treating each input title as a number, multiply it by the numeric value of the operand +op-purpose: treating each input title as a number, multiply it by the numeric value of the parameter tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]] title: multiply Operator type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/power Operator.tid b/editions/tw5.com/tiddlers/filters/power Operator.tid index d4afb67ce..2611049dc 100644 --- a/editions/tw5.com/tiddlers/filters/power Operator.tid +++ b/editions/tw5.com/tiddlers/filters/power Operator.tid @@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]] op-output: the input as numbers, but with each one raised to the power of <<.place N>> op-parameter: a number op-parameter-name: N -op-purpose: treating each input title as a number, raise it to the power of the numeric value of the operand +op-purpose: treating each input title as a number, raise it to the power of the numeric value of the parameter tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]] title: power Operator type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/prefix.tid b/editions/tw5.com/tiddlers/filters/prefix.tid index b96cdc599..6e2633f2d 100644 --- a/editions/tw5.com/tiddlers/filters/prefix.tid +++ b/editions/tw5.com/tiddlers/filters/prefix.tid @@ -1,27 +1,26 @@ +caption: prefix created: 20140410103123179 -modified: 20220218023400000 +modified: 20230711082821266 +op-input: a [[selection of titles|Title Selection]] +op-neg-output: those input tiddlers that do <<.em not>> start with <<.place S>> +op-output: those input titles that start with <<.place S>> +op-parameter: a string of characters +op-parameter-name: S +op-purpose: filter the input titles by how they start +op-suffix: the <<.op prefix>> operator uses a rich suffix, see below for details tags: [[Filter Operators]] [[String Operators]] [[Negatable Operators]] title: prefix Operator type: text/vnd.tiddlywiki -caption: prefix -op-purpose: filter the input titles by how they start -op-input: a [[selection of titles|Title Selection]] -op-parameter: a string of characters -op-parameter-name: S -op-output: those input titles that start with <<.place S>> -op-neg-output: those input tiddlers that do <<.em not>> start with <<.place S>> -op-suffix: the <<.op prefix>> operator uses a rich suffix, see below for details <<.from-version "5.2.2">> The <<.op prefix>> operator uses an extended syntax that permits multiple flags to be passed: ``` -[prefix:[]] +[prefix:[] ``` * ''flag list'': a comma delimited list of flags -* ''operand'': filter operand The available flags are: diff --git a/editions/tw5.com/tiddlers/filters/prepend.tid b/editions/tw5.com/tiddlers/filters/prepend.tid index 5f6cc102d..bd16c78d9 100644 --- a/editions/tw5.com/tiddlers/filters/prepend.tid +++ b/editions/tw5.com/tiddlers/filters/prepend.tid @@ -2,8 +2,8 @@ caption: prepend created: 20151017145439292 modified: 20151108051701587 op-input: a list of items -op-neg-output: a list with items prepended from the tail of the operand array -op-output: a list with items prepended from the head of the operand array +op-neg-output: a list with items prepended from the tail of the parameter array +op-output: a list with items prepended from the head of the parameter array op-parameter: the array of items to be prepended to the head of the list op-parameter-name: list op-purpose: prepend a range of items from an array to the list diff --git a/editions/tw5.com/tiddlers/filters/range.tid b/editions/tw5.com/tiddlers/filters/range.tid index 12813a5b9..48dfa2366 100644 --- a/editions/tw5.com/tiddlers/filters/range.tid +++ b/editions/tw5.com/tiddlers/filters/range.tid @@ -1,15 +1,15 @@ +caption: range created: 20171221184734665 -modified: 20210907170339891 +modified: 20230321133838310 +op-input: ignored +op-neg-output: a series of evenly spaced numbers ranging from `` to `` in reverse order +op-output: a series of evenly spaced numbers ranging from `` to `` +op-parameter: a range specification, like `[1],[5]` +op-parameter-name: N +op-purpose: generate a range of numbers tags: [[Filter Operators]] [[Negatable Operators]] [[Selection Constructors]] title: range Operator type: text/vnd.tiddlywiki -caption: range -op-purpose: generate a range of numbers -op-input: ignored -op-parameter: a range specification, like `[1],[5]` -op-parameter-name: N -op-output: a series of evenly spaced numbers ranging from `` to `` -op-neg-output: a series of evenly spaced numbers ranging from `` to `` in reverse order \define range_example(range) ``` @@ -21,7 +21,7 @@ op-neg-output: a series of evenly spaced numbers ranging from `` to `> The range operator has been updated to use multiple operands to specify its parameters. Prior to this version, the range operator only had one operand, with the three parts delimited by `,`, `;` or `:`. +<<.from-version "5.2.0">> The range operator has been updated to use multiple parameters. Prior to this version, the range operator only had one parameter, with the three parts delimited by `,`, `;` or `:`. ``` [range[]] @@ -29,7 +29,7 @@ The `range` operator produces a list of numbers counting up or down. It is usef [range[],[],[]] ``` -The behaviour depends on the number of operands: +The behaviour depends on the number of parameters: |Parameter |Output |h |`` |Whole numbers up to `` | @@ -47,7 +47,7 @@ Each part must be a number, and works as follows: ** Cannot be zero. ** We always count from `` toward ``, whether `` is positive or negative. -The number of decimal points in the output is fixed, and based on the operand with the //most// decimal points. +The number of decimal points in the output is fixed, and based on the parameter with the //most// decimal points. To prevent the browser from freezing, `range` is currently limited to 10,000 values. diff --git a/editions/tw5.com/tiddlers/filters/reduce.tid b/editions/tw5.com/tiddlers/filters/reduce.tid index 66b62a8b0..06c28825c 100644 --- a/editions/tw5.com/tiddlers/filters/reduce.tid +++ b/editions/tw5.com/tiddlers/filters/reduce.tid @@ -1,6 +1,6 @@ caption: reduce created: 20201004154131193 -modified: 20210522162536854 +modified: 20230321133918020 op-input: a [[selection of titles|Title Selection]] passed as input to the filter op-output: the final result of running the subfilter <<.place S>> op-parameter: a [[filter expression|Filter Expression]]. Optional second parameter for initial value for accumulator @@ -25,7 +25,7 @@ The following variables are available within the subfilter: If the <<.op reduce>> operator receives no input, its output will be empty. The [[else Operator]] can be useful in such cases. -<<.tip "Literal filter operands cannot contain square brackets but you can work around the issue by using a variable:">> +<<.tip "Literal filter parameters cannot contain square brackets but you can work around the issue by using a variable:">> ``` <$set name="sum-input" value="[add]"> diff --git a/editions/tw5.com/tiddlers/filters/remainder Operator.tid b/editions/tw5.com/tiddlers/filters/remainder Operator.tid index ede8b314c..40ca29b9a 100644 --- a/editions/tw5.com/tiddlers/filters/remainder Operator.tid +++ b/editions/tw5.com/tiddlers/filters/remainder Operator.tid @@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]] op-output: the input as numbers, but with each replaced by the remainder when dividing it by <<.place N>> op-parameter: a number op-parameter-name: N -op-purpose: treating each input title as a number, return the remainder when divided by the numeric value of the operand +op-purpose: treating each input title as a number, return the remainder when divided by the numeric value of the parameter tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]] title: remainder Operator type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/remove.tid b/editions/tw5.com/tiddlers/filters/remove.tid index ed41c3db4..8c0b5afa3 100644 --- a/editions/tw5.com/tiddlers/filters/remove.tid +++ b/editions/tw5.com/tiddlers/filters/remove.tid @@ -2,12 +2,12 @@ caption: remove created: 20151017144531676 modified: 20170125200005000 op-input: a list of items -op-neg-output: items removed from current list that appear at the tail of the operand array -op-output: items removed from current list that appear at the head of the operand array +op-neg-output: items removed from current list that appear at the tail of the parameter array +op-output: items removed from current list that appear at the head of the parameter array op-parameter: an array of items to remove op-parameter-name: array op-prefix: causes N items from the end of the array to be removed -op-purpose: remove a list of titles specified in the operand from the input +op-purpose: remove a list of titles specified in the parameter from the input op-suffix: an integer N, defaulting to all tags: [[Filter Operators]] [[Order Operators]] [[Listops Operators]] title: remove Operator diff --git a/editions/tw5.com/tiddlers/filters/removeprefix.tid b/editions/tw5.com/tiddlers/filters/removeprefix.tid index 0b6156052..9fc2fd399 100644 --- a/editions/tw5.com/tiddlers/filters/removeprefix.tid +++ b/editions/tw5.com/tiddlers/filters/removeprefix.tid @@ -1,15 +1,15 @@ +caption: removeprefix created: 20140410103123179 -modified: 20220218023400000 +modified: 20230711082842515 +op-input: a [[selection of titles|Title Selection]] +op-output: those input titles that start with <<.place S>>, but with those characters discarded +op-parameter: a string of characters +op-parameter-name: S +op-purpose: filter the input titles by how they start, deleting that prefix +op-suffix: the <<.op removeprefix>> operator uses a rich suffix, see below for details tags: [[Filter Operators]] [[String Operators]] title: removeprefix Operator type: text/vnd.tiddlywiki -caption: removeprefix -op-purpose: filter the input titles by how they start, deleting that prefix -op-input: a [[selection of titles|Title Selection]] -op-parameter: a string of characters -op-parameter-name: S -op-output: those input titles that start with <<.place S>>, but with those characters discarded -op-suffix: the <<.op removeprefix>> operator uses a rich suffix, see below for details <<.tip " This filters out input titles that do not start with S. For removing S without filtering out input titles that don't start with S, see [[trim|trim Operator]].">> @@ -18,11 +18,10 @@ op-suffix: the <<.op removeprefix>> operator uses a rich suffix, see below for d The <<.op removeprefix>> operator uses an extended syntax that permits multiple flags to be passed: ``` -[removeprefix:[]] +[removeprefix:[]] ``` * ''flag list'': a comma delimited list of flags -* ''operand'': filter operand The available flags are: diff --git a/editions/tw5.com/tiddlers/filters/removesuffix.tid b/editions/tw5.com/tiddlers/filters/removesuffix.tid index 4a1812ae0..bde911d06 100644 --- a/editions/tw5.com/tiddlers/filters/removesuffix.tid +++ b/editions/tw5.com/tiddlers/filters/removesuffix.tid @@ -1,15 +1,15 @@ +caption: removesuffix created: 20140828133830424 -modified: 20220218023400000 +modified: 20230711082859816 +op-input: a [[selection of titles|Title Selection]] +op-output: those input titles that end with <<.place S>>, but with those characters discarded +op-parameter: a string of characters +op-parameter-name: S +op-purpose: filter the input titles by how they end, deleting that suffix +op-suffix: the <<.op removesuffix>> operator uses a rich suffix, see below for details tags: [[Filter Operators]] [[String Operators]] title: removesuffix Operator type: text/vnd.tiddlywiki -caption: removesuffix -op-purpose: filter the input titles by how they end, deleting that suffix -op-input: a [[selection of titles|Title Selection]] -op-parameter: a string of characters -op-parameter-name: S -op-output: those input titles that end with <<.place S>>, but with those characters discarded -op-suffix: the <<.op removesuffix>> operator uses a rich suffix, see below for details <<.tip " This filters out input titles that do not end with S. For removing S without filtering out input titles that don't end with S, see [[trim|trim Operator]].">> @@ -18,11 +18,10 @@ op-suffix: the <<.op removesuffix>> operator uses a rich suffix, see below for d The <<.op removesuffix>> operator uses an extended syntax that permits multiple flags to be passed: ``` -[removesuffix:[]] +[removesuffix:[]] ``` * ''flag list'': a comma delimited list of flags -* ''operand'': filter operand The available flags are: diff --git a/editions/tw5.com/tiddlers/filters/search.tid b/editions/tw5.com/tiddlers/filters/search.tid index 6a6438b9f..79d323a93 100644 --- a/editions/tw5.com/tiddlers/filters/search.tid +++ b/editions/tw5.com/tiddlers/filters/search.tid @@ -1,6 +1,6 @@ caption: search created: 20140410103123179 -modified: 20211129120739275 +modified: 20230711084359603 op-input: a [[selection of titles|Title Selection]] op-neg-output: those input tiddlers in which <<.em not>> all of the search terms can be found op-output: those input tiddlers in which <<.em all>> of the search terms can be found in the value of field <<.place F>> @@ -16,7 +16,7 @@ type: text/vnd.tiddlywiki The <<.op search>> operator uses an extended syntax that permits multiple fields and flags to be passed: ``` -[search::[]] +[search::[]] ``` * ''field list'': a comma delimited list of field names to restrict the search @@ -24,7 +24,7 @@ The <<.op search>> operator uses an extended syntax that permits multiple fields ** an asterisk `*` instead of the field list causes the search to be performed across all fields available on each tiddler ** preceding the list with a minus sign `-` reverses the order so that the search is performed on all fields except the listed fields * ''flag list'': a comma delimited list of flags (defaults to `words` if blank) -* ''operand'': filter operand +* ''parameter'': filter parameter This example searches the fields <<.field title>> and <<.field caption>> for a case-sensitive match for the literal string <<.op-word "The first">>: diff --git a/editions/tw5.com/tiddlers/filters/sortby.tid b/editions/tw5.com/tiddlers/filters/sortby.tid index d6555ae4d..773c6a598 100644 --- a/editions/tw5.com/tiddlers/filters/sortby.tid +++ b/editions/tw5.com/tiddlers/filters/sortby.tid @@ -5,7 +5,7 @@ op-input: a list of items op-output: all items sorted by lookup list op-parameter: a list specifying the order in which to sort the current list op-parameter-name: order -op-purpose: sort the current list in the order of the list referenced in the operand +op-purpose: sort the current list in the order of the list referenced in the parameter tags: [[Filter Operators]] [[Order Operators]] [[Listops Operators]] title: sortby Operator type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/subfilter Operator.tid b/editions/tw5.com/tiddlers/filters/subfilter Operator.tid index aaf7b731c..096560ae2 100644 --- a/editions/tw5.com/tiddlers/filters/subfilter Operator.tid +++ b/editions/tw5.com/tiddlers/filters/subfilter Operator.tid @@ -7,14 +7,14 @@ op-neg-output: those input titles that are <<.em not>> returned from the subfilt op-output: the [[selection of titles|Title Selection]] returned from the subfilter <<.place S>> op-parameter: a [[filter expression|Filter Expression]] op-parameter-name: S -op-purpose: select titles from the operand interpreted as a [[filter expression|Filter Expression]] +op-purpose: select titles from the parameter interpreted as a [[filter expression|Filter Expression]] tags: [[Filter Operators]] [[Field Operators]] [[Selection Constructors]] [[Negatable Operators]] [[Selection Constructors: Conditional]] title: subfilter Operator type: text/vnd.tiddlywiki <<.from-version "5.1.18">> Note that the <<.op subfilter>> operator was introduced in version 5.1.18 and is not available in earlier versions. -<<.tip " Literal filter operands cannot contain square brackets but you can work around the issue by using a variable:">> +<<.tip " Literal filter parameters cannot contain square brackets but you can work around the issue by using a variable:">> ``` <$set name="myFilter" value="[tag[one]]"> @@ -24,6 +24,6 @@ type: text/vnd.tiddlywiki <<.tip "Compare with the similar [[filter|filter Operator]] operator which runs a subfilter against each title, returning those titles that return a non-empty list (and discards the results of the subfilter)">> -The <<.op subfilter>> operator will act as a [[constructor|Selection Constructors]] whenever the filter defined by its operand is a [[constructor|Selection Constructors]]. Otherwise, it will act as a [[modifier|Selection Constructors]]. +The <<.op subfilter>> operator will act as a [[constructor|Selection Constructors]] whenever the filter defined by its parameter is a [[constructor|Selection Constructors]]. Otherwise, it will act as a [[modifier|Selection Constructors]]. <<.operator-examples "subfilter">> diff --git a/editions/tw5.com/tiddlers/filters/subtract Operator.tid b/editions/tw5.com/tiddlers/filters/subtract Operator.tid index c386b90ff..30bd28fa2 100644 --- a/editions/tw5.com/tiddlers/filters/subtract Operator.tid +++ b/editions/tw5.com/tiddlers/filters/subtract Operator.tid @@ -5,7 +5,7 @@ op-input: a [[selection of titles|Title Selection]] op-output: the input as numbers, but with <<.place N>> subtracted from each one op-parameter: a number op-parameter-name: N -op-purpose: treating each input title as a number, subtract from each the numeric value of the operand +op-purpose: treating each input title as a number, subtract from each the numeric value of the parameter tags: [[Filter Operators]] [[Mathematics Operators]] [[Binary Mathematics Operators]] title: subtract Operator type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/suffix.tid b/editions/tw5.com/tiddlers/filters/suffix.tid index 1c1a7bb9b..a7ff4eabb 100644 --- a/editions/tw5.com/tiddlers/filters/suffix.tid +++ b/editions/tw5.com/tiddlers/filters/suffix.tid @@ -1,27 +1,26 @@ +caption: suffix created: 20140828133830424 -modified: 20220218023400000 +modified: 20230711083049169 +op-input: a [[selection of titles|Title Selection]] +op-neg-output: those input tiddlers that do <<.em not>> end with <<.place S>> +op-output: those input titles that end with <<.place S>> +op-parameter: a string of characters +op-parameter-name: S +op-purpose: filter the input titles by how they end +op-suffix: the <<.op suffix>> operator uses a rich suffix, see below for details tags: [[Filter Operators]] [[String Operators]] [[Negatable Operators]] title: suffix Operator type: text/vnd.tiddlywiki -caption: suffix -op-purpose: filter the input titles by how they end -op-input: a [[selection of titles|Title Selection]] -op-parameter: a string of characters -op-parameter-name: S -op-output: those input titles that end with <<.place S>> -op-neg-output: those input tiddlers that do <<.em not>> end with <<.place S>> -op-suffix: the <<.op suffix>> operator uses a rich suffix, see below for details <<.from-version "5.2.2">> The <<.op suffix>> operator uses an extended syntax that permits multiple flags to be passed: ``` -[suffix:[]] +[suffix:[]] ``` * ''flag list'': a comma delimited list of flags -* ''operand'': filter operand The available flags are: diff --git a/editions/tw5.com/tiddlers/filters/syntax/All Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/All Filter Run Prefix.tid new file mode 100644 index 000000000..b1f123f82 --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/All Filter Run Prefix.tid @@ -0,0 +1,18 @@ +created: 20230316150731234 +from-version: 5.1.23 +modified: 20230711084644541 +rp-input: all titles from previous filter runs +rp-output: output titles are appended to the output of previous filter runs without de-duplication. +rp-purpose: union of sets without de-duplication +tags: [[Named Filter Run Prefix]] +title: All Filter Run Prefix +type: text/vnd.tiddlywiki + +<$railroad text=""" +\start none +\end none +( ":all" | - ) +[[run|"Filter Run"]] +"""/> + +This prefix has an optional [[shortcut syntax|Shortcut Filter Run Prefix]] symbol `=run` \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid new file mode 100644 index 000000000..ee76ed636 --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/And Filter Run Prefix.tid @@ -0,0 +1,18 @@ +created: 20230318142752854 +from-version: 5.1.23 +modified: 20230711084712170 +op-purpose: accumulation of filter steps +rp-input: the filter output of all previous runs so far +rp-output: output titles replace the output of previous filter runs +tags: [[Named Filter Run Prefix]] +title: And Filter Run Prefix +type: text/vnd.tiddlywiki + +<$railroad text=""" +\start none +\end none +( ":and" | - ) +[[run|"Filter Run"]] +"""/> + +This prefix has an optional [[shortcut syntax|Shortcut Filter Run Prefix]] symbol `+run` \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix (Examples).tid b/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix (Examples).tid index d64ef3a5e..ef8ca679c 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix (Examples).tid @@ -2,8 +2,8 @@ created: 20211130114857532 filter1: [prefix[ca]then[ca]] filter2: [suffix[at]then[at]] filter3: other -modified: 20211204010918504 -tags: [[Filter Run Prefix Examples]] [[Filter Syntax]] [[Cascade Filter Run Prefix]] +modified: 20230305125250563 +tags: [[Cascade Filter Run Prefix]] title: Cascade Filter Run Prefix (Examples) type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid index 3e6f48cb0..72d66c463 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Cascade Filter Run Prefix.tid @@ -1,20 +1,25 @@ created: 20211130114043280 -modified: 20211130121544118 -tags: [[Filter Syntax]] [[Filter Run Prefix]] +from-version: 5.2.1 +modified: 20230710073343947 +rp-input: the filter output of all previous runs so far +rp-output: the input titles as modified by the filters returned by this filter run +rp-purpose: modify input titles by successively evaluating a list of filters and applying the first result +tags: [[Named Filter Run Prefix]] title: Cascade Filter Run Prefix type: text/vnd.tiddlywiki -<<.from-version "5.2.1">> - -|''purpose'' |modify input titles by evaluating in turn a list of filters - as returned by the filter expression for this run - for each input title. | -|''input'' |all titles from previous filter runs | -|''output''|the input titles as modified by the filters returned by this filter run | +<$railroad text=""" +\start none +\end none +( ":cascade" | - ) +[[run|"Filter Run"]] +"""/> The [[filter expression|Filter Expression]] for this [[filter run|Filter Run]] is evaluated to return a list of filters. Each input title is then evaluated against each of the filters in turn, and the input title is replaced with the first result of the first filter that returns a non-empty list. If none of the filters return a result for an input title, it is replaced with an empty string. The following variables are available within the filter run: * <<.var currentTiddler>> - the input title -* <<.var ..currentTiddler>> - the value of the variable `currentTiddler` outside the filter run. +* <<.var ..currentTiddler>> - the value of the variable <<.var currentTiddler>> outside the filter run. -[[Examples|Cascade Filter Run Prefix (Examples)]] +[[Cascade Filter Run Prefix (Examples)]] diff --git a/editions/tw5.com/tiddlers/filters/syntax/Else Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Else Filter Run Prefix.tid new file mode 100644 index 000000000..dee5fc7be --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/Else Filter Run Prefix.tid @@ -0,0 +1,18 @@ +created: 20230318142408662 +from-version: 5.1.23 +modified: 20230322140756821 +rp-input: all titles from previous filter runs +rp-output: if the filter output so far is an empty list then the output titles of the run are [[dominantly appended|Dominant Append]] to the filter's output.
if the filter output so far is not an empty list then the run is ignored. +rp-purpose: the filter run is only evaluated if the filter output of all previous runs so far is an empty list +tags: [[Named Filter Run Prefix]] +title: Else Filter Run Prefix +type: text/vnd.tiddlywiki + +<$railroad text=""" +\start none +\end none +( ":else" | - ) +[[run|"Filter Run"]] +"""/> + +This prefix has a [[Shortcut Filter Run Prefix]] symbol `~run` \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/syntax/Except Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Except Filter Run Prefix.tid new file mode 100644 index 000000000..aa28c7f8f --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/Except Filter Run Prefix.tid @@ -0,0 +1,18 @@ +created: 20230318142056008 +from-version: 5.1.23 +modified: 20230322140643066 +rp-input: all titles from previous filter runs +rp-output: output titles are removed from the filter's output (if such tiddlers exist) +rp-purpose: if output titles of this filter run are contained in the output of previous filter runs, they are removed, and otherwise ignored +tags: [[Named Filter Run Prefix]] +title: Except Filter Run Prefix +type: text/vnd.tiddlywiki + +<$railroad text=""" +\start none +\end none +( ":except" | - ) +[[run|"Filter Run"]] +"""/> + +This prefix has a [[Shortcut Filter Run Prefix]] symbol `-run` \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid index 8521859ac..739be62bf 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Expression.tid @@ -1,73 +1,21 @@ created: 20150124182421000 -modified: 20211129014550442 +modified: 20230710074507466 tags: [[Filter Syntax]] title: Filter Expression type: text/vnd.tiddlywiki +A <<.def "filter expression">> is the outermost level of the [[filter syntax|Filter Syntax]]. It consists of [[filter runs|Filter Run]] with optional [[filter run prefixes|Filter Run Prefix]]. Multiple filter runs are separated by [[whitespace|Filter Whitespace]]. + <$railroad text=""" -[{: - [: [[whitespace|"Filter Whitespace"]] ] - ("+"|"~"|:-|"-"|"="|":"[[named-prefix|"Named Filter Run Prefix"]]) +{ ( + - | + : [[<"prefix">|"Filter Run Prefix"]] + ) [[run|"Filter Run"]] -}] + + [[whitespace|"Filter Whitespace"]] +} """/> -A <<.def "filter expression">> is the outermost level of the [[filter syntax|Filter Syntax]]. It consists of one or more [[runs|Filter Run]]. +<<.tip """If the diagram has a single start and end line, as shown above, it means there is more info in the linked level above. The breadcrumbs can be used to navigate""">> -If a run has: - -* no prefix, its output titles are [[dominantly appended|Dominant Append]] to the filter's output -* the prefix `=`, output titles are appended to the filter's output without de-duplication. <<.from-version "5.1.20">> -* the prefix `-`, output titles are <<.em removed>> from the filter's output (if such tiddlers exist) -* the prefix `+`, it receives the filter output so far as its input; its output then <<.em "replaces">> all filter output so far and forms the input for the next run -* the prefix `~`, if the filter output so far is an empty list then the output titles of the run are [[dominantly appended|Dominant Append]] to the filter's output. If the filter output so far is not an empty list then the run is ignored. <<.from-version "5.1.18">> -* named prefixes for filter runs are available. <<.from-version "5.1.23">> -* named prefix `:filter`, it receives the filter output so far as its input. The next run is evaluated for each title of the input, removing every input title for which the output is an empty list. <<.from-version "5.1.23">> -** See [[Filter Filter Run Prefix]]. -* named prefix `:intersection` replaces all filter output so far with titles that are present in the output of this run, as well as the output from previous runs. Forms the input for the next run. <<.from-version "5.1.23">> -** See [[Intersection Filter Run Prefix]]. -* named prefix `:reduce` replaces all filter output so far with a single item by repeatedly applying a formula to each input title. A typical use is to add up the values in a given field of each input title. <<.from-version "5.1.23">> -** See [[Reduce Filter Run Prefix]]. -* named prefix `:sort` sorts all filter output so far by applying this run to each input title and sorting according to that output. <<.from-version "5.2.0">> -** See [[Sort Filter Run Prefix]]. -* named prefix `:map` transforms all filter output so far by applying this run to each input title and replacing the input title with the output of this run for that title. -** See [[Map Filter Run Prefix]]. <<.from-version "5.2.0">> - - -<<.tip "Compare named filter run prefix `:filter` with [[filter Operator]] which applies a subfilter to every input title, removing the titles that return an empty result from the subfilter">> - -<<.tip "Compare named filter run prefix `:reduce` with [[reduce Operator]] which is used to used to flatten a list of items down to a single item by repeatedly applying a subfilter.">> - -<<.tip """Within the filter runs prefixed with `:reduce`, `:sort`, `:map` and `:filter`, the "currentTiddler" variable is set to the title of the tiddler being processed. The value of currentTiddler outside the subfilter is available in the variable "..currentTiddler".<<.from-version "5.2.0">>""" >> - -In technical / logical terms: - -|!Run |!Equivalent named prefix |!Interpretation |!Output | -|`run` |`:or[run]` |de-duplicated union of sets |... OR run | -|`=run` |`:all[run]` |union of sets without de-duplication |... OR run | -|`+run` |`:and[run]` |accumulation of filter steps |... AND run | -|`-run` |`:except[run]` |difference of sets |... AND NOT run | -|`~run` |`:else[run]` |else |... ELSE run | -||`:intersection`|intersection of sets|| - -For the difference between `+` and `:intersection`, see [[Intersection Filter Run Prefix (Examples)]]. - -The input of a run is normally a list of all the non-[[shadow|ShadowTiddlers]] tiddler titles in the wiki (in no particular order). But the `+` prefix can change this: - -|Prefix|Input|h -|`-`, `~`, `=`, `:intersection` or none| <$link to="all Operator">`[all[]]` tiddler titles, unless otherwise determined by the first [[filter operator|Filter Operators]]| -|`+`, `:filter`, `:reduce`,`:sort`|the filter output of all previous runs so far| - -Precisely because of varying inputs, be aware that both prefixes `-` and `+` do not behave inverse to one another! - -For example, in both of the following, `$:/baz` will only be removed if it actually exists: - -* <$link to="is Operator"> `foo bar $:/baz -[is[system]]` -* <$link to="prefix Operator">`foo bar $:/baz -[prefix[$:/]]` - -To understand why, consider the input for both final runs with their `-` prefix. - -In order to remove `$:/baz` in any case, existing or not, simply use the `+` prefix with [[negated filter operators|Filter Operators]]: - -* <$link to="is Operator">`foo bar $:/baz +[!is[system]]` -* <$link to="prefix Operator">`foo bar $:/baz +[!prefix[$:/]]` +<<.tip """If the diagram has no start and no end, as used in lower levels, it means that higher level syntax elements have been removed, to increase readability and simplicity. The breadcrumbs can be used to navigate""">> diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix (Examples).tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix (Examples).tid index dd1e98e63..2e3272ff9 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix (Examples).tid @@ -1,6 +1,6 @@ created: 20211129022707404 -modified: 20211204154839890 -tags: [[Filter Syntax]] [[Filter Run Prefix Examples]] [[Filter Filter Run Prefix]] +modified: 20230305125338118 +tags: [[Filter Filter Run Prefix]] title: Filter Filter Run Prefix (Examples) type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix.tid index f8eb66847..88eaedc42 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Filter Run Prefix.tid @@ -1,27 +1,32 @@ created: 20211129022455873 -modified: 20211129022550425 -tags: [[Filter Syntax]] [[Filter Run Prefix]] +from-version: 5.1.23 +modified: 20230710073334078 +rp-input: the filter output of all previous runs so far +rp-output: the input titles for which the filter run is not empty +rp-purpose: remove every input title for which the filter run output is an empty list +tags: [[Named Filter Run Prefix]] title: Filter Filter Run Prefix type: text/vnd.tiddlywiki -<<.from-version "5.1.23">> - -|''purpose'' |remove every input title for which the filter run output is an empty list | -|''input'' |all titles from previous filter runs | -|''output''|the input titles for which the filter run is not empty | +<$railroad text=""" +\start none +\end none +( ":filter" | - ) +[[run|"Filter Run"]] +"""/> It receives the filter output so far as its input. The next run is evaluated for each title of the input, removing every input title for which the output is an empty list. -Note that within the filter run, the "currentTiddler" variable is set to the title of the tiddler being processed. This permits filter runs like `:filter[{!!price}multiply{!!cost}compare:integer:gteq[5]]` to be used for computation. The value of currentTiddler outside the run is available in the variable "..currentTiddler". +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 `:filter[{!!price}multiply{!!cost}compare:integer:gteq[5]]` to be used for computation. The value of currentTiddler outside the run is available in the variable <<.var ..currentTiddler>>. The following variables are available within the filter run: -* ''currentTiddler'' - the input title -* ''..currentTiddler'' - the value of the variable `currentTiddler` outside the filter run. -* ''index'' - <<.from-version "5.2.1">> the numeric index of the current list item (with zero being the first item in the list). -* ''revIndex'' - <<.from-version "5.2.1">> the reverse numeric index of the current list item (with zero being the last item in the list). -* ''length'' - <<.from-version "5.2.1">> the total length of the input list. +* <<.var currentTiddler>> - the input title +* <<.var ..currentTiddler>> - the value of the variable `currentTiddler` outside the filter run. +* <<.var index>> - <<.from-version "5.2.1">> the numeric index of the current list item (with zero being the first item in the list). +* <<.var revIndex>> - <<.from-version "5.2.1">> the reverse numeric index of the current list item (with zero being the last item in the list). +* <<.var length>> - <<.from-version "5.2.1">> the total length of the input list. <<.tip "Compare named filter run prefix `:filter` with [[filter Operator]] which applies a subfilter to every input title, removing the titles that return an empty result from the subfilter">> -[[Examples|Filter Filter Run Prefix (Examples)]] +[[Filter Filter Run Prefix (Examples)]] diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Parameter.tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Parameter.tid index d394f1900..9334fd069 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Parameter.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Parameter.tid @@ -1,15 +1,17 @@ created: 20150220152540000 -modified: 20210629215024053 -tags: [[Filter Syntax]] +modified: 20230710074423650 +tags: [[Filter Step]] title: Filter Parameter type: text/vnd.tiddlywiki <$railroad text=""" -( "[" [:{/"anything but ]"/}] "]" +\start none +\end none +( "[" [: <-"hard"-> /"anything but ]"/] "]" | - "{" [:{/"anything but }"/}] "}" + "{" [: <-"indirect"-> /"anything but }"/] "}" | - "<" [:{/"anything but >"/}] ">" + "<" [: <-"variable"-> /"anything but >"/] ">" ) """/> @@ -24,9 +26,11 @@ The parameter to a [[filter operator|Filter Operators]] can be: :: The parameter is the text indicated by the [[text reference|TextReference]] whose name appears between the curly brackets, i.e. a [[field|TiddlerFields]] of a specified tiddler, or the value of a property of a specified [[data tiddler|DataTiddlers]]. : <<.def variable>> :: `` -:: The parameter is the current value of the [[variable|Variables]] whose name appears between the angle brackets. Macro parameters are <<.em not>> supported up to and including ~TiddlyWiki v5.1.23. +:: The parameter is the current value of the [[variable|Variables]] whose name appears between the angle brackets. Macro parameters are <<.em not>> supported up to v5.2.0 ::<<.from-version "5.2.0">> Literal macro parameters are supported. For example: `[]`. -<<.from-version "5.1.23">> Filter operators support multiple parameters which are separated by a ` , ` character. +--- + +<<.from-version "5.1.23">> [[Filter Step]]s support multiple parameters which are separated by a `,` character. For example: `[param1],[param2]` or `,{param2}` diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix (Examples).tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix (Examples).tid index dc39c948d..ddbb94c5c 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix (Examples).tid @@ -1,6 +1,6 @@ created: 20201117073343969 -modified: 20211129032537195 -tags: [[Filter Syntax]] [[Filter Run Prefix Examples]] +modified: 20230315152812472 +tags: title: Filter Run Prefix (Examples) type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix.tid new file mode 100644 index 000000000..4387ba9cb --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix.tid @@ -0,0 +1,18 @@ +created: 20230305130600148 +modified: 20230711090913687 +tags: [[Filter Expression]] +title: Filter Run Prefix +type: text/vnd.tiddlywiki + +There are 2 types of filter run prefixes that are interchangeable. Named prefixes and shortcut prefixes. + +<$railroad text=""" +\start none +\end none +( + - | +: [[<":named prefix"> /"starting with v5.1.23"/ |"Named Filter Run Prefix"]] | + [[<"shortcut prefix"> /"prior to v5.1.23"/ |"Shortcut Filter Run Prefix"]] +) +[[run|"Filter Run"]] +"""/> diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Run.tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Run.tid index e3843b492..c5e9c8a34 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Run.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Run.tid @@ -1,11 +1,13 @@ created: 20150124182117000 -modified: 20150129133716000 -tags: [[Filter Syntax]] +modified: 20230710074357002 +tags: [[Filter Expression]] title: Filter Run type: text/vnd.tiddlywiki <$railroad text=""" -( "[" { [[step|"Filter Step"]] } "]" +\start none +\end none +( "[" { [[<"Filter Step">|"Filter Step"]] } "]" | [:{/"anything but [ ] or whitespace"/}] | @@ -19,7 +21,6 @@ A <<.def run>> consists of [[steps|Filter Step]], and it outputs a [[selection|T The steps are processed from left to right. The input to the first step is same as the input to the run. For each subsequent step, the input is the output of the previous step. -{{Selection Constructors}} The lower three options in the diagram match syntax like `HelloThere`, `"HelloThere"`, `'HelloThere'` and `"Filter Operators"`. They are short for `[title[...]]`. diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Step.tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Step.tid index b569ec4d6..73b58524a 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Step.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Step.tid @@ -1,23 +1,35 @@ created: 20150124182127000 -modified: 20201103111044922 -tags: [[Filter Syntax]] +modified: 20230710074414361 +tags: [[Filter Run]] title: Filter Step type: text/vnd.tiddlywiki +A <<.def "filter step">> represents a single operation within a <<.def "filter run">>. + +In programming terms, it is akin to a function call to which the step's input is passed as a parameter. A step's output is a [[title selection|Title Selection]] that contributes to a [[filter run|Filter Run]] and hence to the entire [[filter expression|Filter Expression]] that contains it. + <$railroad text=""" +\start none +\end none [:"!"] -[: [[operator|"Filter Operators"]] [:":" suffix] ] -[[parameter|"Filter Parameter"]] +( / "if omitted, defaults to: title" /|: +( - | :[[operator|"Filter Operators"]] ) +{ [:":" [[suffix|"Filter Operators"]] ] } ) +{ [[parameter|"Filter Parameter"]] + "," } """/> -A <<.def step>> represents a single operation within a [[filter|Filter Syntax]]. +The step's <<.def operator>> is drawn from a list of predefined keywoards which are known as [[filter operators|Filter Operators]]. -In programming terms, it is akin to a function call to which [[the step's input|Filter Run]] is passed as an implicit parameter. A step's output is a [[selection|Title Selection]] that contributes to a [[run|Filter Run]] and hence to the entire [[filter expression|Filter Expression]] that contains it. - -The step's <<.def operator>> is drawn from a list of [[predefined keywords|Filter Operators]], which can be extended by plugins. Any unrecognised operator is treated as if it was the suffix to the <<.olink field>> operator. If a step's operator is omitted altogether, it defaults to `title`. +Many steps require an explicit <<.def parameter>>, that further defines what the step is to do. The <<.def suffix>> is additional text, often the name of a [[field|TiddlerFields]], that extends the meaning of certain operators. -Many steps require an explicit <<.def parameter>> value, also known as an <<.def operand>>, that further defines what the step is to do. +If a step's <<.def operator>> and <<.def suffix>> are //omitted// altogether, it defaults to the [[title|title Operator]] operator. -<<.from-version "5.1.23">> Some steps accept multiple parameters which are separated by a ` , ` character. +<<.from-version "5.1.23">> Some steps accept multiple <<.def parameter>>s which are separated by a `,` character. + +Any unrecognised operator is treated as if it was the suffix to the <<.olink field>> operator. + +Filter operators can be extended by plugins. + +{{Selection Constructors}} diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Syntax.tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Syntax.tid index 0190aabab..58a03aa20 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Syntax.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Syntax.tid @@ -1,18 +1,24 @@ created: 20140210141217955 -modified: 20150124184229000 +list: [[Filter Expression]] [[Filter Run]] [[Filter Step]] [[Filter Parameter]] [[Filter Whitespace]] +modified: 20230710074340943 tags: Filters title: Filter Syntax type: text/vnd.tiddlywiki -list: [[Filter Expression]] [[Filter Run]] [[Filter Step]] [[Filter Parameter]] [[Filter Whitespace]] <<.preamble """[[Filters]] follow a grammar that is presented here, using [[railroad diagrams|Railroad Diagrams]], for those who find formal syntax descriptions helpful. However, you can [[learn to write filters|Introduction to filter notation]] without needing to understand this group of tiddlers.""">> -A <<.def filter>> is a pipeline for transforming an <<.def input>> into an <<.def output>>. Both the input and the output are [[ordered sets of titles|Title Selection]] of things like tiddlers and fields. +A <<.def filter>> is a pipeline for transforming an <<.def input>> into an <<.def output>>. Both the input and the output are [[ordered sets of titles|Title Selection]] of tiddlers and fields. -Filters are [[expressions|Filter Expression]] constructed from smaller building blocks, called [[runs|Filter Run]] and [[steps|Filter Step]], each of which also transforms an input to an output. +Filters are ''expressions'' constructed from smaller building blocks, called ''runs'', which are built using ''steps''. Eeach of which also transforms an input to an output. A filter starts with an empty output. Its runs are processed from left to right, progressively modifying the output. -Here are details of the various building blocks involved: +The "Filter Syntax" description starts with: -<> +<$railroad text=""" +\start double +\end double +[[<"Filter Expression">|"Filter Expression"]] +"""/> + +<<.tip "The railroad boxes as the one above can be used to navigate">> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Whitespace.tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Whitespace.tid index f31422b3d..f33092e9c 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Whitespace.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Whitespace.tid @@ -1,11 +1,13 @@ created: 20150124182304000 -modified: 20150125105243000 -tags: [[Filter Syntax]] +modified: 20230710074447240 +tags: [[Filter Expression]] title: Filter Whitespace type: text/vnd.tiddlywiki <$railroad text=""" +\start none +\end none {( "space" | "tab" | "linefeed" | "return" | "vertical tab" | "formfeed" )} """/> -Whitespace characters can appear between each [[run|Filter Run]] of a [[filter expression|Filter Expression]]. +Whitespace characters can appear between each run of a [[filter expression|Filter Expression]]. diff --git a/editions/tw5.com/tiddlers/filters/syntax/Interchangeable Filter Run Prefixes.tid b/editions/tw5.com/tiddlers/filters/syntax/Interchangeable Filter Run Prefixes.tid new file mode 100644 index 000000000..0313f543a --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/Interchangeable Filter Run Prefixes.tid @@ -0,0 +1,44 @@ +created: 20230316151518640 +modified: 20230327130626715 +tags: [[Filter Run Prefix]] +title: Interchangeable Filter Run Prefixes +type: text/vnd.tiddlywiki + +!! Interchangeable Filter Run Prefixes + +In technical / logical terms: + +|!Run |!Equivalent named prefix |!Interpretation |!Output | +|`[run]` |`:or[run]` |de-duplicated union of sets |... OR run | +|`+[run]` |`:and[run]` |accumulation of filter steps |... AND run | +|`-[run]` |`:except[run]` |difference of sets |... AND NOT run | +|`~[run]` |`:else[run]` |else |... ELSE run | +|`=[run]` |`:all[run]` |union of sets without de-duplication |... OR run | + +The input of a run is normally a list of all the non-[[shadow|ShadowTiddlers]] tiddler titles in the wiki (in no particular order).
But the `+` prefix can change this: + +|Prefix|Input|h +|`-`, `~`, `=`, `:intersection` or none| <$link to="all Operator">`[all[]]` tiddler titles, unless otherwise determined by the first [[filter operator|Filter Operators]]| +|`+`, `:filter`, `:map`, `:reduce`,`:sort` |the filter output of all previous runs so far| + +Precisely because of varying inputs, be aware that both prefixes `-` and `+` do not behave inverse to one another! + +For example, in both of the following, `$:/baz` will only be removed if it actually exists: + +* <$link to="is Operator"> `foo bar $:/baz -[is[system]]` +* <$link to="prefix Operator">`foo bar $:/baz -[prefix[$:/]]` + +To understand why, consider the input for both final runs with their `-` prefix. + +In order to remove `$:/baz` in any case, existing or not, simply use the `+` prefix with [[negated filter operators|Filter Operators]]: + +* <$link to="is Operator">`foo bar $:/baz +[!is[system]]` +* <$link to="prefix Operator">`foo bar $:/baz +[!prefix[$:/]]` + +!! Difference between + and intersection + +For the difference between `+` and `:intersection`, see [[Intersection Filter Run Prefix (Examples)]]. + +!! For Developers + +To create a new filter run prefix, create a [[Javascript module|Modules]] with a [[module-type|ModuleType]] of `filterrunprefix`. diff --git a/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix (Examples).tid b/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix (Examples).tid index d074eb247..fa9bba322 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix (Examples).tid @@ -1,6 +1,6 @@ created: 20211128212902292 -modified: 20211128233320674 -tags: [[Filter Syntax]] [[Filter Run Prefix Examples]] [[Intersection Filter Run Prefix]] +modified: 20230305125354209 +tags: [[Intersection Filter Run Prefix]] title: Intersection Filter Run Prefix (Examples) type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix.tid index 2fc8dd40f..2f2f718b3 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Intersection Filter Run Prefix.tid @@ -1,15 +1,20 @@ created: 20211128212902292 -modified: 20211128212904721 -tags: [[Filter Syntax]] [[Filter Run Prefix]] +from-version: 5.1.23 +modified: 20230710073322863 +rp-input: all titles from previous filter runs +rp-output: the titles that are present in both the result of this filter run and the output from previous runs +rp-purpose: find the intersection of titles from previous runs with titles in this filter +tags: [[Named Filter Run Prefix]] title: Intersection Filter Run Prefix type: text/vnd.tiddlywiki -<<.from-version "5.1.23">> - -|''purpose'' |find the intersection of titles from previous runs with titles in this filter run | -|''input'' |all titles from previous filter runs | -|''output''|the titles that are present in both the result of this filter run and the output from previous runs | +<$railroad text=""" +\start none +\end none +( ":intersection" | - ) +[[run|"Filter Run"]] +"""/> The filter output from previous runs is set aside. The `:intersection` filter run is started with all tiddler titles as input. Once this latest filter run has completed, the latest output is compared to the set-aside output. A new output is produced that contains only titles that appeared in both the set-aside output and the latest output. -[[Examples|Intersection Filter Run Prefix (Examples)]] +[[Intersection Filter Run Prefix (Examples)]] diff --git a/editions/tw5.com/tiddlers/filters/syntax/Map Filter Run Prefix (Examples).tid b/editions/tw5.com/tiddlers/filters/syntax/Map Filter Run Prefix (Examples).tid index 8d5631983..bd8152ce8 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Map Filter Run Prefix (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Map Filter Run Prefix (Examples).tid @@ -1,6 +1,6 @@ created: 20210618134753828 -modified: 20220724162340642 -tags: [[Filter Syntax]] [[Filter Run Prefix Examples]] [[Map Filter Run Prefix]] +modified: 20230305125405422 +tags: [[Map Filter Run Prefix]] title: Map Filter Run Prefix (Examples) type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/syntax/Map Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Map Filter Run Prefix.tid index ad36fcade..fdce6ab39 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Map Filter Run Prefix.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Map Filter Run Prefix.tid @@ -1,28 +1,33 @@ created: 20210618133745003 -modified: 20220720190146771 -tags: [[Filter Syntax]] [[Filter Run Prefix]] +from-version: 5.2.0 +modified: 20230710073315595 +rp-input: the filter output of all previous runs so far +rp-output: the input titles as modified by the result of this filter run +rp-purpose: modify input titles by the result of evaluating this filter run for each item +rp-suffix: <<.from-version "5.2.3">> <<.value flat>> to return all results from the filter run, or omit (default) to return only the first result +tags: [[Named Filter Run Prefix]] title: Map Filter Run Prefix type: text/vnd.tiddlywiki -<<.from-version "5.2.0">> - -|''purpose'' |modify input titles by the result of evaluating this filter run for each item | -|''input'' |all titles from previous filter runs | -|''suffix''|<<.from-version "5.2.3">> `flat` to return all results from the filter run, If omitted (default), only the first result is returned.| -|''output''|the input titles as modified by the result of this filter run | +<$railroad text=""" +\start none +\end none +( ":map" | - ) +[[run|"Filter Run"]] +"""/> Each input title from previous runs is passed to this run in turn. The filter run transforms the input titles and the output of this run replaces the input title. For example, the filter run `[get[caption]else{!!title}]` replaces each input title with its caption field, unless the field does not exist in which case the title is preserved. -Note that within the filter run, the "currentTiddler" variable is set to the title of the tiddler being processed. This permits filter runs like `:map[{!!price}multiply{!!cost}]` to be used for computation. The value of currentTiddler outside the run is available in the variable "..currentTiddler". +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 `:map[{!!price}multiply{!!cost}]` to be used for computation. The following variables are available within the filter run: -* ''currentTiddler'' - the input title -* ''..currentTiddler'' - the value of the variable `currentTiddler` outside the filter run. -* ''index'' - <<.from-version "5.2.1">> the numeric index of the current list item (with zero being the first item in the list). -* ''revIndex'' - <<.from-version "5.2.1">> the reverse numeric index of the current list item (with zero being the last item in the list). -* ''length'' - <<.from-version "5.2.1">> the total length of the input list. +* <<.var currentTiddler>> - the input title +* <<.var ..currentTiddler>> - the value of the variable `currentTiddler` outside the filter run. +* <<.var index>> - <<.from-version "5.2.1">> the numeric index of the current list item (with zero being the first item in the list). +* <<.var revIndex>> - <<.from-version "5.2.1">> the reverse numeric index of the current list item (with zero being the last item in the list). +* <<.var length>> - <<.from-version "5.2.1">> the total length of the input list. -Filter runs used with the `:map` prefix should return at least the same number of items that they are passed. Any missing entries will be treated as an 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]...`. +Filter runs used with the `:map` prefix should return at least the same number of items that they are passed. Input titles for which the filter run returns no output are replaced by an 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]...`. -[[Examples|Map Filter Run Prefix (Examples)]] \ No newline at end of file +[[Map Filter Run Prefix (Examples)]] \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/syntax/Named Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Named Filter Run Prefix.tid index 72a4bec8d..ed389b987 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Named Filter Run Prefix.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Named Filter Run Prefix.tid @@ -1,10 +1,36 @@ created: 20201214044413473 -modified: 20211118025845599 -tags: [[Filter Syntax]] +modified: 20230711090833212 +tags: [[Filter Run Prefix]] title: Named Filter Run Prefix +type: text/vnd.tiddlywiki -<$set name="prefixlist" filter="""[all[shadows+tiddlers]has[module-type]module-type[filterrunprefix]trim:prefix[$:/core/modules/filterrunprefixes/]trim:suffix[.js]addprefix["]addsuffix["]join[|]addprefix[(]addsuffix[)]]"""> -<$railroad text=<>/> - +In <<.from-version "5.1.23">> the named filter run prefixes where implemented. `:cascade`, `:map` and `:sort` have been added later as shown in the diagrams. -A named filter run prefix can precede any [[run|Filter Run]] of a [[filter expression|Filter Expression]] in place of a single-character prefix (`+`, `-` and so on). To create a new filter run prefix, create a [[Javascript module|Modules]] with a [[module-type|ModuleType]] of `filterrunprefix`. +A named filter run prefix can precede any [[run|Filter Run]] of a [[filter expression|Filter Expression]] in place of a [[shortcut run prefix|Shortcut Filter Run Prefix]]. + +<$railroad text=""" +\start none +\end none +( +[[<":all"> |"All Filter Run Prefix"]] | +[[<":and"> |"And Filter Run Prefix"]] | +[[<":cascade"> /"v5.2.1"/ |"Cascade Filter Run Prefix"]] | +[[<":else"> |"Else Filter Run Prefix"]] | +[[<":except"> |"Except Filter Run Prefix"]] | +[[<":filter"> |"Filter Filter Run Prefix"]] | +[[<":intersection"> |"Intersection Filter Run Prefix"]] | +[[<":map"> /"v5.2.0"/ |"Map Filter Run Prefix"]] | +[[<":or"> |"Or Filter Run Prefix"]] | +[[<":reduce"> |"Reduce Filter Run Prefix"]] | +[[<":sort"> /"v5.2.0"/ |"Sort Filter Run Prefix"]] | +[[<":then"> /"v5.3.0"/ |"Then Filter Run Prefix"]]) [[run|"Filter Run"]] +"""/> + + +<<.tip "Compare named filter run prefix `:filter` with [[filter Operator]] which applies a subfilter to every input title, removing the titles that return an empty result from the subfilter">> + +<<.tip "Compare named filter run prefix `:reduce` with [[reduce Operator]] which is used to used to flatten a list of items down to a single item by repeatedly applying a subfilter">> + +<<.tip """Within the filter runs prefixed with `:reduce`, `:sort`, `:map` and `:filter`, the <<.var currentTiddler>> variable is set to the title of the tiddler being processed.
The value of currentTiddler outside the subfilter is available in the variable <<.var "..currentTiddler">> <<.from-version "5.2.0">>""" >> + +Also see: [[Interchangeable Filter Run Prefixes]] diff --git a/editions/tw5.com/tiddlers/filters/syntax/Or Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Or Filter Run Prefix.tid new file mode 100644 index 000000000..4cb9a94ec --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/Or Filter Run Prefix.tid @@ -0,0 +1,18 @@ +created: 20230318135743766 +from-version: 5.1.23 +modified: 20230322140708372 +rp-input: all titles from previous filter runs +rp-output: output titles are [[dominantly appended|Dominant Append]] to the output of previous filter runs +rp-purpose: de-duplicated union of tiddler sets +tags: [[Named Filter Run Prefix]] +title: Or Filter Run Prefix +type: text/vnd.tiddlywiki + +<$railroad text=""" +\start none +\end none +( ":or" | - ) +[[run|"Filter Run Prefix"]] +"""/> + +The :or prefix is equivalent to using no prefix at all. See `run` at [[Shortcut Filter Run Prefix]] \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/syntax/Reduce Filter Run Prefix (Examples).tid b/editions/tw5.com/tiddlers/filters/syntax/Reduce Filter Run Prefix (Examples).tid index c88472216..bb17b9c8e 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Reduce Filter Run Prefix (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Reduce Filter Run Prefix (Examples).tid @@ -1,6 +1,6 @@ created: 20211124151912931 -modified: 20211124160747921 -tags: [[Filter Syntax]] [[Reduce Filter Run Prefix]] [[Filter Run Prefix Examples]] +modified: 20230305125430544 +tags: [[Reduce Filter Run Prefix]] title: Reduce Filter Run Prefix (Examples) type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/syntax/Reduce Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Reduce Filter Run Prefix.tid index 3a9fd8a82..6799d8e05 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Reduce Filter Run Prefix.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Reduce Filter Run Prefix.tid @@ -1,25 +1,34 @@ created: 20211124151912931 -modified: 20211124170117511 -tags: [[Filter Syntax]] [[Filter Run Prefix]] +from-version: 5.1.23 +modified: 20230710073305239 +rp-input: the filter output of all previous runs so far +rp-output: the accumulated single item +rp-purpose: replaces all filter output so far with a single item by repeatedly applying a filter run to each input title +tags: [[Named Filter Run Prefix]] title: Reduce Filter Run Prefix type: text/vnd.tiddlywiki -<<.from-version "5.1.23">> -|''purpose'' |replaces all filter output so far with a single item by repeatedly applying a filter run to each input title | -|''input'' |all titles from previous filter runs | -|''output''|the accumulated single item | +<$railroad text=""" +\start none +\end none +( ":reduce" | - ) +[[run|"Filter Run"]] +"""/> -Each input title from previous runs is passed to this run in turn. The result of each previous call to this run is made available in the next call via the variable named "accumulator". The result of the last call to this run is returned as the output. A typical use is to add up the values in a given field of each input title. + +Each input title from previous runs is passed to this run in turn. The result of each previous call to this run is made available in the next call via the variable named <<.var accumulator>>. The result of the last call to this run is returned as the output. A typical use is to add up the values in a given field of each input title. + +Replaces all filter output so far with a single item by repeatedly applying a formula, as described above, to each input title. The following variables are available within the filter run: -* ''accumulator'' - the result of the previous filter run -* ''currentTiddler'' - the input title -* ''..currentTiddler'' - the value of the variable `currentTiddler` outside the filter run. <<.from-version "5.2.0">> -* ''index'' - the numeric index of the current list item (with zero being the first item in the list) -* ''revIndex'' - the reverse numeric index of the current list item (with zero being the last item in the list) -* ''length'' - the total length of the input list +* <<.var accumulator>> - the result of the previous filter run +* <<.var currentTiddler>> - the input title +* <<.var ..currentTiddler>> - the value of the variable `currentTiddler` outside the filter run. <<.from-version "5.2.0">> +* <<.var index>> - the numeric index of the current list item (with zero being the first item in the list) +* <<.var revIndex>> - the reverse numeric index of the current list item (with zero being the last item in the list) +* <<.var length>> - the total length of the input list <<.tip "Compare named filter run prefix `:reduce` with [[reduce Operator]] which is used to flatten a list of items down to a single item by repeatedly applying a subfilter.">> @@ -35,4 +44,4 @@ is equivalent to: [tag[shopping]reduce] ``` -[[Examples|Reduce Filter Run Prefix (Examples)]] \ No newline at end of file +[[Reduce Filter Run Prefix (Examples)]] \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/syntax/Shortcut Filter Run Prefixes.tid b/editions/tw5.com/tiddlers/filters/syntax/Shortcut Filter Run Prefixes.tid new file mode 100644 index 000000000..fa8bc26e1 --- /dev/null +++ b/editions/tw5.com/tiddlers/filters/syntax/Shortcut Filter Run Prefixes.tid @@ -0,0 +1,29 @@ +created: 20230305131705188 +modified: 20230710074438655 +tags: [[Filter Run Prefix]] +title: Shortcut Filter Run Prefix +type: text/vnd.tiddlywiki + +Shortcut prefixes are commonly used by advanced users because they are fast to type but they are harder to read by less experienced users. That's why [[named prefixes|Named Filter Run Prefix]] have been created, which are more verbose. Shortcut and named filter run prefixes are interchangeable as shown in the table below. + +<$railroad text=""" +\start none +\end none +(-|:"+"|"-"|"~"|"=") +[[run|"Filter Run"]] +"""/> + +If a run has: + +* no prefix, its output titles are [[dominantly appended|Dominant Append]] to the filter's output + +* the prefix `+`, it receives the filter output so far as its input; its output then <<.em "replaces">> all filter output so far and forms the input for the next run + +* the prefix `-`, output titles are <<.em removed>> from the filter's output (if such tiddlers exist) + +* the prefix `~`, if the filter output so far is an empty list then the output titles of the run are [[dominantly appended|Dominant Append]] to the filter's output. If the filter output so far is not an empty list then the run is ignored. <<.from-version "5.1.18">> + +* the prefix `=`, output titles are appended to the filter's output without de-duplication. <<.from-version "5.1.20">> + + +{{Interchangeable Filter Run Prefixes}} \ No newline at end of file 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 73c95643e..16b9c9711 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 @@ -1,6 +1,6 @@ created: 20210428074912172 -modified: 20210428085746041 -tags: [[Filter Syntax]] [[Sort Filter Run Prefix]] [[Filter Run Prefix Examples]] +modified: 20230315165343329 +tags: [[Sort Filter Run Prefix]] title: Sort Filter Run Prefix (Examples) type: text/vnd.tiddlywiki 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 ec5e032dd..0197425ad 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,19 +1,26 @@ created: 20210428083929749 -modified: 20210522162628946 -tags: [[Filter Syntax]] [[Filter Run Prefix]] +from-version: 5.2.0 +modified: 20230322140722470 +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 +tags: [[Named Filter Run Prefix]] title: Sort Filter Run Prefix type: text/vnd.tiddlywiki -<<.from-version "5.2.0">> - -|''purpose'' |sort the input titles by the result of evaluating this filter run for each item | -|''input'' |all titles from previous filter runs | -|''suffix'' |the `:sort` filter run prefix uses a rich suffix, see below for details | -|''output''|the sorted result of previous filter runs | +<$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"/ | - ) +[[run|"Filter Run"]] +"""/> Each input title from previous runs is passed to this run in turn. The filter run transforms the input titles into the form needed for sorting. For example, the filter run `[length[]]` transforms each input title in to the number representing its length, and thus sorts the input titles according to their length. -Note that within the filter run, the "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 currentTiddler outside the run is available in the variable "..currentTiddler". +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: diff --git a/editions/tw5.com/tiddlers/filters/syntax/then Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/then Filter Run Prefix.tid index 2584bd65b..b74000b5a 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/then Filter Run Prefix.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/then Filter Run Prefix.tid @@ -1,45 +1,14 @@ created: 20210618133745003 from-version: 5.3.0 -modified: 20230506172920710 +modified: 20230710074225410 rp-input: <<.olink all>> tiddler titles rp-output: the output of this filter run replaces the output of previous runs unless it is an empty list (see below) rp-purpose: replace any input to this filter run with its output, only evaluating the run when there is any input search: -tags: [[Filter Run Prefix]] [[Filter Syntax]] +tags: [[Named Filter Run Prefix]] title: Then Filter Run Prefix type: text/vnd.tiddlywiki -\define .op-row() -<$macrocall $name=".if" - cond="""$(op-body)$""" - then="""$(op-head)$<<.op-place>>$(op-body)$""" - else=""/> -\end - -<$list filter="[all[current]has[from-version]]" variable="listItem"> - <$macrocall $name=".from-version" version={{!!from-version}}/> - -<$let op-head="" op-body="" op-name=""> - - - <$let op-head="purpose" op-body={{!!rp-purpose}}> - <<.op-row>> - - - <$let op-head="[[input|Filter Expression]]" op-body={{!!rp-input}}> - <<.op-row>> - - - <$let op-head="suffix" op-body={{!!rp-suffix}} op-name={{!!rp-suffix-name}}> - <<.op-row>> - - - <$let op-head="output" op-body={{!!rp-output}}> - <<.op-row>> - -
- - <$railroad text=""" \start none \end none @@ -47,8 +16,6 @@ type: text/vnd.tiddlywiki [[run|"Filter Run"]] """/> -!Introduction - The <<.op :then>> filter run prefix is used to replace the result of all previous filter runs with its output. If the result of all previous runs is an empty list, the <<.op :then>> prefixed filter run is not evaluated. @@ -67,5 +34,5 @@ The major difference between the <<.op then>> operator and a <<.op :then>> prefi |^<<.operator-example m1-1 "[tag[WikiText]] :then[[true]]">>|^<<.operator-example m1-2 "[tag[WikiText]then[true]]">>

To make them equivalent, additional filter steps may be added:

<<.operator-example m1-3 "[tag[WikiText]count[]compare:number:gt[0]then[true]]">>| -! [[Examples|Then Filter Run Prefix (Examples)]] +[[Then Filter Run Prefix (Examples)]] diff --git a/editions/tw5.com/tiddlers/filters/toggle Operator.tid b/editions/tw5.com/tiddlers/filters/toggle Operator.tid index 13e971990..10fbadf2c 100644 --- a/editions/tw5.com/tiddlers/filters/toggle Operator.tid +++ b/editions/tw5.com/tiddlers/filters/toggle Operator.tid @@ -4,7 +4,7 @@ modified: 20201118192155504 op-input: a list of items op-output: the input list with the title specified in the parameter toggled op-parameter: the <<.op toggle>> operator accepts 1 or more parameters, see below for details -op-purpose: toggle the title specified in the operand in the input +op-purpose: toggle the title specified in the parameter in the input tags: [[Filter Operators]] [[Listops Operators]] [[Order Operators]] title: toggle Operator type: text/vnd.tiddlywiki @@ -19,7 +19,7 @@ The <<.op toggle>> operator requires at least one parameter and can accept addit * ''title1'' : a title to toggle in the input list. If it is already present, it is removed. Otherwise, it is added. * ''title2'': (optional). When the second parameter is provided, the operator toggles between the two values in the input list. If neither is present, the first parameter takes precedence is added to the list. -With more than two parameters, the <<.op toggle>> behaves similar to the [[cycle|cycle Operator]] and can be used to cycle through a list of values. Note that all operands should be unique. +With more than two parameters, the <<.op toggle>> behaves similar to the [[cycle|cycle Operator]] and can be used to cycle through a list of values. Note that all parameters should be unique. <$macrocall $name=".tip" _="While the <<.op cycle>> operator interprets its first parameter as a list of titles to cycle through and offers similar functionality, the <<.op toggle>> operator accepts an unlimited number of distinct parameters."/> diff --git a/editions/tw5.com/tiddlers/system/TableOfContents.tid b/editions/tw5.com/tiddlers/system/TableOfContents.tid index aada8d741..d22420a9f 100644 --- a/editions/tw5.com/tiddlers/system/TableOfContents.tid +++ b/editions/tw5.com/tiddlers/system/TableOfContents.tid @@ -1,8 +1,8 @@ caption: {{$:/language/SideBar/Contents/Caption}} created: 20140809114010378 -list: HelloThere Learning [[Working with TiddlyWiki]] [[Customise TiddlyWiki]] Features Languages Editions Plugins Platforms Reference Community About +list: HelloThere Learning [[Working with TiddlyWiki]] [[Customise TiddlyWiki]] Features Filters Languages Editions Plugins Platforms Reference Community About list-after: $:/core/ui/SideBar/Open -modified: 20150414070242411 +modified: 20230322150307580 tags: $:/tags/SideBar title: TableOfContents type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/system/filter-run-template.tid b/editions/tw5.com/tiddlers/system/filter-run-template.tid new file mode 100644 index 000000000..f812cdb96 --- /dev/null +++ b/editions/tw5.com/tiddlers/system/filter-run-template.tid @@ -0,0 +1,49 @@ +code-body: yes +created: 20230316112235083 +list-before: $:/core/ui/ViewTemplate/body +modified: 20230326145802667 +tags: $:/tags/ViewTemplate +title: $:/editions/tw5.com/filter-run-template +type: text/vnd.tiddlywiki + +\define .op-place() +<$macrocall $name=".if" + cond="""$(op-name)$""" + then="<<.place '$(op-name)$'>> = " + else=""/> +\end + +\define .op-row() +<$macrocall $name=".if" + cond="""$(op-body)$""" + then="""$(op-head)$<<.op-place>>$(op-body)$""" + else=""/> +\end + +\whitespace trim + +<$list filter="[all[current]tag[Named Filter Run Prefix]]"> + <$let op-head="" op-body="" op-name=""> + + + <$let op-head="purpose" op-body={{!!rp-purpose}}> + <<.op-row>> + + + <$let op-head="[[input|Filter Expression]]" op-body={{!!rp-input}}> + <<.op-row>> + + + <$let op-head="[[suffix|Filter Run Prefix]]" op-body={{!!rp-suffix}} op-name={{!!rp-suffix-name}}> + <<.op-row>> + + + <$let op-head="output" op-body={{!!rp-output}}> + <<.op-row>> + +
+ <$list filter="[all[current]has[from-version]]" variable="listItem"> + <$macrocall $name=".from-version" version={{!!from-version}}/> + + + diff --git a/editions/tw5.com/tiddlers/system/operator-template.tid b/editions/tw5.com/tiddlers/system/operator-template.tid index 4d7abc334..88bee6a24 100644 --- a/editions/tw5.com/tiddlers/system/operator-template.tid +++ b/editions/tw5.com/tiddlers/system/operator-template.tid @@ -2,82 +2,63 @@ created: 20150203173506000 list-before: $:/core/ui/ViewTemplate/body modified: 20230602181119360 tags: $:/tags/ViewTemplate +code-body: yes title: $:/editions/tw5.com/operator-template \define .op-place() <$macrocall $name=".if" - cond="""$(op-name)$""" - then="<<.place '$(op-name)$'>> = " - else=""/> + cond="""$(op-name)$""" + then="<<.place '$(op-name)$'>> = " + else=""/> \end \define .op-row() <$macrocall $name=".if" - cond="""$(op-body)$""" - then="""$(op-head)$<<.op-place>>$(op-body)$""" - else=""/> + cond="""$(op-body)$""" + then="""$(op-head)$<<.op-place>>$(op-body)$""" + else=""/> \end -<$set name="op-head" value=""> -<$set name="op-body" value=""> -<$set name="op-name" value=""> +\whitespace trim + <$list filter="[all[current]tag[Filter Operators]]"> - - -<$set name="op-head" value="purpose"> -<$set name="op-body" value={{!!op-purpose}}> -<<.op-row>> - - - -<$set name="op-head" value="[[input|Filter Syntax]]"> -<$set name="op-body" value={{!!op-input}}> -<<.op-row>> - - - -<$set name="op-head" value="`!` input"> -<$set name="op-body" value={{!!op-neg-input}}> -<<.op-row>> - - - -<$set name="op-head" value="[[suffix|Filter Step]]"> -<$set name="op-body" value={{!!op-suffix}}> -<$set name="op-name" value={{!!op-suffix-name}}> -<<.op-row>> - - - - -<$set name="op-head" value="[[parameter|Filter Parameter]]"> -<$set name="op-body" value={{!!op-parameter}}> -<$set name="op-name" value={{!!op-parameter-name}}> -<<.op-row>> - - - - -<$set name="op-head" value="output"> -<$set name="op-body" value={{!!op-output}}> -<<.op-row>> - - - -<$set name="op-head" value="`!` output"> -<$set name="op-body" value={{!!op-neg-output}}> -<<.op-row>> - - - -
+ <$let op-head="" op-body="" op-name=""> + + + <$let op-head="purpose" op-body={{!!op-purpose}}> + <<.op-row>> + + + <$let op-head="[[input|Filter Syntax]]" op-body={{!!op-input}}> + <<.op-row>> + + + <$let op-head="`!` input" op-body={{!!op-neg-input}}> + <<.op-row>> + + + <$let op-head="[[suffix|Filter Step]]" op-body={{!!op-suffix}} op-name={{!!op-suffix-name}}> + <<.op-row>> + + + <$let op-head="[[parameter|Filter Parameter]]" op-body={{!!op-parameter}} op-name={{!!op-parameter-name}}> + <<.op-row>> + + + <$let op-head="output" op-body={{!!op-output}}> + <<.op-row>> + + + <$let op-head="`!` output" op-body={{!!op-neg-output}}> + <<.op-row>> + +
+

+ [[Learn more about how to use Filters|Filters]] +

-

[[Learn more about how to use Filters|Filters]]

- -<$list filter="[all[current]has[from-version]]" variable="listItem"> -

<$macrocall $name=".from-version" version={{!!from-version}}/>

+ <$list filter="[all[current]has[from-version]]" variable="listItem"> + <$macrocall $name=".from-version" version={{!!from-version}}/> + + - - - - diff --git a/editions/tw5.com/tiddlers/wikitext/Transclusion and Substitution.tid b/editions/tw5.com/tiddlers/wikitext/Transclusion and Substitution.tid index 15dd9b4cc..b63d9a0a0 100644 --- a/editions/tw5.com/tiddlers/wikitext/Transclusion and Substitution.tid +++ b/editions/tw5.com/tiddlers/wikitext/Transclusion and Substitution.tid @@ -27,7 +27,7 @@ As described in [[HTML in WikiText]], you can also transclude tiddler field valu <$text text={{MyTiddler}}/> ``` -As described in [[Introduction to filter notation]], you can also transclude tiddler field values as filter operands. For example: +As described in [[Introduction to filter notation]], you can also transclude tiddler field values using the [[filter syntax|Filter Syntax]]. For example: ``` {{{ [tag{TiddlerContainingMyTag}] }}} @@ -47,7 +47,7 @@ As described in [[HTML in WikiText]], you can also transclude a variable as the <$text text=<>/> ``` -As described in [[Introduction to filter notation]], you can also transclude a variable as the value of a filter operand. For example: +As described in [[Introduction to filter notation]], you can also transclude a variable as the value of a filter parameter using the [[filter syntax|Filter Syntax]]. For example: ``` {{{ [tag] }}} From d4f6befb9b199aa5c2e94101870aa4b927084879 Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Wed, 14 Feb 2024 17:21:08 +0100 Subject: [PATCH 011/185] Remove overflow: auto from tiddler preview (#7985) This removes `overflow: auto` from the tiddler preview. I'm not sure anymore why it was added. It causes some problems in the preview with popups for example, see screenshots --- themes/tiddlywiki/vanilla/base.tid | 4 ---- 1 file changed, 4 deletions(-) diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index 618afc695..1ca85c6a7 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -1577,10 +1577,6 @@ html body.tc-body.tc-single-tiddler-window { padding-left: 4px; } -.tc-tiddler-preview { - overflow: auto; -} - .tc-tiddler-editor { display: grid; } From a3521eb67d68503e502b6f99cbf85e6849cc85d2 Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Wed, 14 Feb 2024 17:22:54 +0100 Subject: [PATCH 012/185] Use qualified-preview-state in default body-editor for reuse in preview button (#7795) * Use qualified-preview-state to reuse in preview button Somehow the editor-body template and the preview button don't qualify the same showeditpreview anymore * Update preview.tid to use qualified-preview-state * Update preview.tid * Update default.tid * Update preview.tid --- core/ui/EditTemplate/body/default.tid | 9 +++++++-- core/ui/EditorToolbar/preview.tid | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/ui/EditTemplate/body/default.tid b/core/ui/EditTemplate/body/default.tid index 04cc64436..d004032f1 100644 --- a/core/ui/EditTemplate/body/default.tid +++ b/core/ui/EditTemplate/body/default.tid @@ -1,5 +1,9 @@ title: $:/core/ui/EditTemplate/body/default +\function edit-preview-state() +[{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[] +[get[text]] :else[[no]] +\end + \define config-visibility-title() $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$ \end @@ -10,12 +14,13 @@ $:/config/EditorToolbarButtons/Visibility/$(currentTiddler)$ \whitespace trim <$let - editPreviewStateTiddler={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[] }}} + qualified-preview-state=<> + editPreviewStateTiddler={{{ [{$:/config/ShowEditPreview/PerTiddler}!match[yes]then[$:/state/showeditpreview]] :else[] }}} importTitle=<> importState=<> > <$dropzone importTitle=<> autoOpenOnImport="no" contentTypesFilter={{$:/config/Editor/ImportContentTypesFilter}} class="tc-dropzone-editor" enable={{{ [{$:/config/DragAndDrop/Enable}match[no]] :else[subfilter{$:/config/Editor/EnableImportFilter}then[yes]else[no]] }}} filesOnly="yes" actions=<> >
-
get[text]match[yes]then[tc-tiddler-preview]else[tc-tiddler-preview-hidden]] [[tc-tiddler-editor]] +[join[ ]] }}}> +
match[yes]then[tc-tiddler-preview]else[tc-tiddler-preview-hidden]] [[tc-tiddler-editor]] +[join[ ]] }}}> <$transclude tiddler="$:/core/ui/EditTemplate/body/editor" mode="inline"/> diff --git a/core/ui/EditorToolbar/preview.tid b/core/ui/EditorToolbar/preview.tid index ea49c971a..d5c63eb5f 100644 --- a/core/ui/EditorToolbar/preview.tid +++ b/core/ui/EditorToolbar/preview.tid @@ -10,7 +10,7 @@ shortcuts: ((preview)) \whitespace trim - <$transclude $tiddler={{{ [get[text]match[yes]then[$:/core/images/preview-open]else[$:/core/images/preview-closed]] }}} /> + <$transclude $tiddler={{{ [match[yes]then[$:/core/images/preview-open]else[$:/core/images/preview-closed]] }}} /> <$action-setfield $tiddler=<> $value={{{ [get[text]toggle[yes],[no]] }}} /> -<$action-sendmessage $message="tm-edit-text-operation" $param="focus-editor"/> \ No newline at end of file +<$action-sendmessage $message="tm-edit-text-operation" $param="focus-editor"/> From 53ccc29209fd6dec6df1735ad02e0357394818c9 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Wed, 14 Feb 2024 19:36:32 +0100 Subject: [PATCH 013/185] Copy-to-clipboard macro - change tags to $:/tags/Global (#7988) * copy-to-clipboard-macors -- new v5.3.x syntax * copy-to-clipboard - change tags to $:/tags/Global --- core/wiki/macros/copy-to-clipboard.tid | 28 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/core/wiki/macros/copy-to-clipboard.tid b/core/wiki/macros/copy-to-clipboard.tid index 910e955a9..8903e6722 100644 --- a/core/wiki/macros/copy-to-clipboard.tid +++ b/core/wiki/macros/copy-to-clipboard.tid @@ -1,20 +1,26 @@ title: $:/core/macros/copy-to-clipboard -tags: $:/tags/Macro +tags: $:/tags/Global -\define copy-to-clipboard(src,class:"tc-btn-invisible",style) \whitespace trim -<$button class=<<__class__>> style=<<__style__>> message="tm-copy-to-clipboard" param=<<__src__>> tooltip={{$:/language/Buttons/CopyToClipboard/Hint}}> -{{$:/core/images/copy-clipboard}} - -<$text text={{$:/language/Buttons/CopyToClipboard/Caption}}/> + +\procedure copy-to-clipboard(src,class:"tc-btn-invisible",style) +<$button message="tm-copy-to-clipboard" + param=<> + class=<> + style=< + +
] [] +[join[ ]] }}}> + +
diff --git a/plugins/tiddlywiki/github-fork-ribbon/usage.tid b/plugins/tiddlywiki/github-fork-ribbon/usage.tid index c6d5311e0..aea2e3dba 100644 --- a/plugins/tiddlywiki/github-fork-ribbon/usage.tid +++ b/plugins/tiddlywiki/github-fork-ribbon/usage.tid @@ -1,26 +1,81 @@ title: $:/plugins/tiddlywiki/github-fork-ribbon/usage -Copy appropriate chunks on a new tiddler and tag it `$:/tags/PageControls`. Name of the new tiddler does not matter. Only the tag matters. +\procedure ribbonCode() +\whitespace trim +<$transclude $tiddler="$:/plugins/tiddlywiki/github-fork-ribbon/template" top="30px" fixed=fixed color="green"/> +\end -``` - - - +\procedure ribbonCreateActions() +<% if [[$:/github-ribbon]!is[tiddler]] %> + <$action-setfield $tiddler="$:/github-ribbon" $field="text" $value=<> + tags="$:/tags/PageTemplate" + code-body="yes" /> +<% endif %> +<$action-navigate $to="$:/github-ribbon" /> +\end - - - +\procedure createRibbon() +<$button actions=<> > +<%if [[$:/github-ribbon]!is[tiddler]] %> +Create +<% else %> +Show +<% endif %> ~$:/github-ribbon + +\end + +\procedure ribbonToggleTagActions() +<$action-listops $tiddler="$:/github-ribbon" $field="tags" $subfilter="+[toggle[$:/tags/PageTemplate]]" /> +\end + +\procedure ribbonToggleTag() <$button actions=<> >Toggle Tag - - - +`$:/plugins/tiddlywiki/github-fork-ribbon/template` is a template tiddler, that can be used with a transclusion and parameters. - - - -``` +!! Usage + +* Create a new tiddler eg: $:/github-ribbon +* Tag it `$:/tags/PageTemplate` +* Copy the code below + +
<$text text=<>/>
+ +<> <> + +!! Parameters + +; position +: "right" (default), "left", "right-bottom" and "left-bottom" + +; url +: Target URL, default: https://github.com/Jermolene/TiddlyWiki5 + +; text +: Ribbon text. default: `Fork me on ~GitHub` + +; color +: Ribbon background color: default: `#aa0000` + +; top +: Offset from the top if postion is top. default: `0` eg: `30px`, if the menu-toolbar plugin is installed + +; bottom +: Offset from the bottom in px + +; left +: Offset from the left in px + +; right +: Offset from the right in px + +; fixed +: If position is ''top'', the ribbon will scroll out of the viewport by default +: If the parameter `fixed="fixed"` it will be fixed + +!! Remove the Ribbon + +* Disable the plugin +* ''Remove the tag'' from $:/github-ribbon tiddler +* Delete the $:/github-ribbon tiddler +* <> \ No newline at end of file From e43cd2d989bd564fa983ad0a28369345e20855d7 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Thu, 28 Mar 2024 20:29:16 +0100 Subject: [PATCH 090/185] Use v5.3.x syntax for $:/core/ui/PageTemplate/pagecontrols (#8088) --- core/ui/PageControls.tid | 16 +++++++--------- themes/tiddlywiki/vanilla/base.tid | 1 + 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/core/ui/PageControls.tid b/core/ui/PageControls.tid index 2b579050c..833b4cbcb 100644 --- a/core/ui/PageControls.tid +++ b/core/ui/PageControls.tid @@ -1,16 +1,14 @@ title: $:/core/ui/PageTemplate/pagecontrols \whitespace trim -\define config-title() $:/config/PageControlButtons/Visibility/$(listItem)$ +\function config-title() [[$:/config/PageControlButtons/Visibility/$(listItem)$]substitute[]]
<$list filter="[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]]" variable="listItem"> - <$set name="hidden" value=<>> - <$list filter="[!text[hide]]" storyview="pop" variable="ignore"> - <$set name="tv-config-toolbar-class" filter="[] [encodeuricomponent[]addprefix[tc-btn-]]"> - <$transclude tiddler=<> mode="inline"/> - - - + <$list filter="[!text[hide]]" storyview="pop" variable="ignore"> + <$let tv-config-toolbar-class={{{ [enlist] [encodeuricomponent[]addprefix[tc-btn-]] +[join[ ]] }}}> + <$transclude $tiddler=<> $mode="inline"/> + + -
+
\ No newline at end of file diff --git a/themes/tiddlywiki/vanilla/base.tid b/themes/tiddlywiki/vanilla/base.tid index 5b19dd61f..69ba8e680 100644 --- a/themes/tiddlywiki/vanilla/base.tid +++ b/themes/tiddlywiki/vanilla/base.tid @@ -931,6 +931,7 @@ button.tc-btn-invisible.tc-remove-tag-button { .tc-page-controls { margin-top: 14px; + margin-bottom: 14px; font-size: 1.5em; } From 9cd6affcae382be8081990eda1abc572f4689fde Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Thu, 28 Mar 2024 20:29:57 +0100 Subject: [PATCH 091/185] Minor changes to Widgets tiddler (#8107) --- editions/tw5.com/tiddlers/widgets/Widgets.tid | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/editions/tw5.com/tiddlers/widgets/Widgets.tid b/editions/tw5.com/tiddlers/widgets/Widgets.tid index 5b682766f..66793f47d 100644 --- a/editions/tw5.com/tiddlers/widgets/Widgets.tid +++ b/editions/tw5.com/tiddlers/widgets/Widgets.tid @@ -1,14 +1,14 @@ created: 20140908130500000 -modified: 20150219182745000 +modified: 20240326164134356 tags: Concepts Reference title: Widgets type: text/vnd.tiddlywiki ~TiddlyWiki's display is driven by an underlying collection of <<.def widgets>>. These are organised into a tree structure: each widget has a parent widget and zero or more child widgets. -~TiddlyWiki generates this <<.def "widget tree">> by parsing the WikiText of tiddlers. Each component of the WikiText syntax, including even the trivial case of ordinary text, generates a corresponding widget. The widget tree is an intermediate representation that is subsequently rendered into the actual display. +~TiddlyWiki generates this <<.def "widget tree">> by parsing the ~WikiText of tiddlers. Each component of the ~WikiText syntax, including even the trivial case of ordinary text, generates a corresponding widget. The widget tree is an intermediate representation that is subsequently rendered into the actual display. -Widgets are analogous to elements in an HTML document. Indeed, HTML tags in WikiText generate dedicated <<.def "element widgets">>. +Widgets are analogous to elements in an HTML document. Indeed, HTML tags in ~WikiText generate dedicated <<.def "element widgets">>. Each class of widget contributes a specific ability to the overall functionality, such as the ability to <<.wlink2 "display an image" ImageWidget>> or <<.wlink2 "a button" ButtonWidget>>, to <<.wlink2 "call a macro" MacroCallWidget>> or <<.wlink2 "transclude text from elsewhere" TranscludeWidget>>, or to [[mark a piece of text as a heading|HTML in WikiText]]. @@ -16,4 +16,4 @@ The more specialised widgets use a general-purpose [[widget syntax|Widgets in Wi The following classes of widget are built into the core: -<> +<> From b595651fe12817902e014dcf3e0058c94fc66e6d Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Thu, 28 Mar 2024 22:50:22 +0100 Subject: [PATCH 092/185] Fix hide-show button code needs to be transcluded mode=block (#8082) --- editions/tw5.com/tiddlers/system/doc-macros.tid | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/editions/tw5.com/tiddlers/system/doc-macros.tid b/editions/tw5.com/tiddlers/system/doc-macros.tid index 5f83c75a8..d0574fe5f 100644 --- a/editions/tw5.com/tiddlers/system/doc-macros.tid +++ b/editions/tw5.com/tiddlers/system/doc-macros.tid @@ -1,8 +1,8 @@ +code-body: yes created: 20150117152607000 -modified: 20240229155550000 +modified: 20240317091700545 tags: $:/tags/Macro title: $:/editions/tw5.com/doc-macros -code-body: yes type: text/vnd.tiddlywiki \whitespace trim @@ -165,7 +165,7 @@ This is an example tiddler. See [[Table-of-Contents Macros (Examples)]].
<$button set=<<.state>> setTo="">Hide
- <> + <$transclude $variable="eg" $mode="block"/>
From 993975969062a49f213b9c9c7ded291e1d20d257 Mon Sep 17 00:00:00 2001 From: Rob Hoelz Date: Fri, 29 Mar 2024 09:47:22 -0500 Subject: [PATCH 093/185] Report throttled refreshes (#8116) Fixes GH #6054 --- core/modules/startup/render.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/modules/startup/render.js b/core/modules/startup/render.js index e50512463..caa8db2ef 100644 --- a/core/modules/startup/render.js +++ b/core/modules/startup/render.js @@ -81,6 +81,8 @@ exports.startup = function() { deferredChanges = Object.create(null); $tw.hooks.invokeHook("th-page-refreshed"); } + var throttledRefresh = $tw.perf.report("throttledRefresh",refresh); + // Add the change event handler $tw.wiki.addEventListener("change",$tw.perf.report("mainRefresh",function(changes) { // Check if only tiddlers that are throttled have changed @@ -101,7 +103,7 @@ exports.startup = function() { if(isNaN(timeout)) { timeout = THROTTLE_REFRESH_TIMEOUT; } - timerId = setTimeout(refresh,timeout); + timerId = setTimeout(throttledRefresh,timeout); $tw.utils.extend(deferredChanges,changes); } else { $tw.utils.extend(deferredChanges,changes); From 804f227815e22ca5a1adc0a0e02fb62b7f5bfb29 Mon Sep 17 00:00:00 2001 From: Crystal Person <135565126+jinix6@users.noreply.github.com> Date: Sun, 31 Mar 2024 21:38:09 +0530 Subject: [PATCH 094/185] Signing CLA (#8126) --- licenses/cla-individual.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/licenses/cla-individual.md b/licenses/cla-individual.md index 3dafcf352..5db3cddfc 100644 --- a/licenses/cla-individual.md +++ b/licenses/cla-individual.md @@ -563,3 +563,5 @@ John Long, @drevarr, 2023/12/12 Ed Holsinger, @eschlon, 2024/02/08 Kim I. McKinley, @PotOfCoffee2Go, 2024/03/16 + +@Jinix6, 2024/03/31 \ No newline at end of file From 7ce85a2ddb50ca7b4ef262c4cda31aa3ccc1f70c Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Tue, 2 Apr 2024 18:35:10 +0200 Subject: [PATCH 095/185] Update reset.tid to use modern-normalize 2.0.0 (#8120) This PR updates the vanilla/reset stylesheet to use the newer `modern-normalize 2.0.0` --- themes/tiddlywiki/vanilla/reset.tid | 146 ++++++++++++---------------- 1 file changed, 61 insertions(+), 85 deletions(-) diff --git a/themes/tiddlywiki/vanilla/reset.tid b/themes/tiddlywiki/vanilla/reset.tid index 0f7d24eab..938ecc7b1 100644 --- a/themes/tiddlywiki/vanilla/reset.tid +++ b/themes/tiddlywiki/vanilla/reset.tid @@ -1,7 +1,7 @@ title: $:/themes/tiddlywiki/vanilla/reset type: text/css -/*! modern-normalize v1.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */ +/*! modern-normalize v2.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */ /* Document @@ -13,28 +13,26 @@ Use a better box model (opinionated). */ *, -*::before, -*::after { - box-sizing: border-box; +::before, +::after { + box-sizing: border-box; } -/** -Use a more readable tab size (opinionated). -*/ - -:root { - -moz-tab-size: 4; - tab-size: 4; -} - -/** -1. Correct the line height in all browsers. -2. Prevent adjustments of font size after orientation changes in iOS. -*/ - html { - line-height: 1.15; /* 1 */ - -webkit-text-size-adjust: 100%; /* 2 */ + /* Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) */ + font-family: + system-ui, + 'Segoe UI', + Roboto, + Helvetica, + Arial, + sans-serif, + 'Apple Color Emoji', + 'Segoe UI Emoji'; + line-height: 1.15; /* 1. Correct the line height in all browsers. */ + -webkit-text-size-adjust: 100%; /* 2. Prevent adjustments of font size after orientation changes in iOS. */ + -moz-tab-size: 4; /* 3. Use a more readable tab size (opinionated). */ + tab-size: 4; /* 3 */ } /* @@ -42,29 +40,8 @@ Sections ======== */ -/** -Remove the margin in all browsers. -*/ - body { - margin: 0; -} - -/** -Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) -*/ - -body { - font-family: - system-ui, - -apple-system, /* Firefox supports this but not yet `system-ui` */ - 'Segoe UI', - Roboto, - Helvetica, - Arial, - sans-serif, - 'Apple Color Emoji', - 'Segoe UI Emoji'; + margin: 0; /* Remove the margin in all browsers. */ } /* @@ -78,8 +55,8 @@ Grouping content */ hr { - height: 0; /* 1 */ - color: inherit; /* 2 */ + height: 0; /* 1 */ + color: inherit; /* 2 */ } /* @@ -92,7 +69,7 @@ Add the correct text decoration in Chrome, Edge, and Safari. */ abbr[title] { - text-decoration: underline dotted; + text-decoration: underline dotted; } /** @@ -101,7 +78,7 @@ Add the correct font weight in Edge and Safari. b, strong { - font-weight: bolder; + font-weight: bolder; } /** @@ -113,14 +90,14 @@ code, kbd, samp, pre { - font-family: - ui-monospace, - SFMono-Regular, - Consolas, - 'Liberation Mono', - Menlo, - monospace; /* 1 */ - font-size: 1em; /* 2 */ + font-family: + ui-monospace, + SFMono-Regular, + Consolas, + 'Liberation Mono', + Menlo, + monospace; /* 1 */ + font-size: 1em; /* 2 */ } /** @@ -128,7 +105,7 @@ Add the correct font size in all browsers. */ small { - font-size: 80%; + font-size: 80%; } /** @@ -137,18 +114,18 @@ Prevent 'sub' and 'sup' elements from affecting the line height in all browsers. sub, sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; } sub { - bottom: -0.25em; + bottom: -0.25em; } sup { - top: -0.5em; + top: -0.5em; } /* @@ -158,12 +135,12 @@ Tabular data /** 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) -2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) +2. Correct table border color inheritance in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) */ table { - text-indent: 0; /* 1 */ - border-color: inherit; /* 2 */ + text-indent: 0; /* 1 */ + border-color: inherit; /* 2 */ } /* @@ -181,20 +158,19 @@ input, optgroup, select, textarea { - font-family: inherit; /* 1 */ - font-size: 100%; /* 1 */ - line-height: 1.15; /* 1 */ - margin: 0; /* 2 */ + font-family: inherit; /* 1 */ + font-size: 100%; /* 1 */ + line-height: 1.15; /* 1 */ + margin: 0; /* 2 */ } /** Remove the inheritance of text transform in Edge and Firefox. -1. Remove the inheritance of text transform in Firefox. */ button, -select { /* 1 */ - text-transform: none; +select { + text-transform: none; } /** @@ -205,7 +181,7 @@ button, [type='button'], [type='reset'], [type='submit'] { - -webkit-appearance: button; + -webkit-appearance: button; } /** @@ -213,8 +189,8 @@ Remove the inner border and padding in Firefox. */ ::-moz-focus-inner { - border-style: none; - padding: 0; + border-style: none; + padding: 0; } /** @@ -222,7 +198,7 @@ Restore the focus styles unset by the previous rule. */ :-moz-focusring { - outline: 1px dotted ButtonText; + outline: 1px dotted ButtonText; } /** @@ -231,7 +207,7 @@ See: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d4 */ :-moz-ui-invalid { - box-shadow: none; + box-shadow: none; } /** @@ -239,7 +215,7 @@ Remove the padding so developers are not caught out when they zero out 'fieldset */ legend { - padding: 0; + padding: 0; } /** @@ -247,7 +223,7 @@ Add the correct vertical alignment in Chrome and Firefox. */ progress { - vertical-align: baseline; + vertical-align: baseline; } /** @@ -256,7 +232,7 @@ Correct the cursor style of increment and decrement buttons in Safari. ::-webkit-inner-spin-button, ::-webkit-outer-spin-button { - height: auto; + height: auto; } /** @@ -265,8 +241,8 @@ Correct the cursor style of increment and decrement buttons in Safari. */ [type='search'] { - -webkit-appearance: textfield; /* 1 */ - outline-offset: -2px; /* 2 */ + -webkit-appearance: textfield; /* 1 */ + outline-offset: -2px; /* 2 */ } /** @@ -274,7 +250,7 @@ Remove the inner padding in Chrome and Safari on macOS. */ ::-webkit-search-decoration { - -webkit-appearance: none; + -webkit-appearance: none; } /** @@ -283,8 +259,8 @@ Remove the inner padding in Chrome and Safari on macOS. */ ::-webkit-file-upload-button { - -webkit-appearance: button; /* 1 */ - font: inherit; /* 2 */ + -webkit-appearance: button; /* 1 */ + font: inherit; /* 2 */ } /* @@ -297,5 +273,5 @@ Add the correct display in Chrome and Safari. */ summary { - display: list-item; + display: list-item; } From eeb4e7a7f70d62ebc4feec391363fbb35bc9a62d Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Wed, 3 Apr 2024 10:58:56 +0200 Subject: [PATCH 096/185] Add a "Refresh Browser" keyboard shortcut (#8121) * Create a `refresh` keyboard shortcut This creates a `refresh` keyboard shortcut that refreshes the page. In TiddlyDesktop ctrl-R doesn't work * Update refresh.tid * Update shortcuts-not-mac.multids * Update shortcuts-mac.multids * Update ShortcutInfo.multids --- core/ui/KeyboardShortcuts/refresh.tid | 5 +++++ core/wiki/config/ShortcutInfo.multids | 1 + core/wiki/config/shortcuts/shortcuts-mac.multids | 1 + core/wiki/config/shortcuts/shortcuts-not-mac.multids | 1 + 4 files changed, 8 insertions(+) create mode 100644 core/ui/KeyboardShortcuts/refresh.tid diff --git a/core/ui/KeyboardShortcuts/refresh.tid b/core/ui/KeyboardShortcuts/refresh.tid new file mode 100644 index 000000000..6776c9d73 --- /dev/null +++ b/core/ui/KeyboardShortcuts/refresh.tid @@ -0,0 +1,5 @@ +title: $:/core/ui/KeyboardShortcuts/refresh +tags: $:/tags/KeyboardShortcut +key: ((refresh)) + +<$action-sendmessage $message="tm-browser-refresh"/> diff --git a/core/wiki/config/ShortcutInfo.multids b/core/wiki/config/ShortcutInfo.multids index 1f903dcad..bebd02dea 100644 --- a/core/wiki/config/ShortcutInfo.multids +++ b/core/wiki/config/ShortcutInfo.multids @@ -35,6 +35,7 @@ new-tiddler: {{$:/language/Buttons/NewTiddler/Hint}} picture: {{$:/language/Buttons/Picture/Hint}} preview: {{$:/language/Buttons/Preview/Hint}} quote: {{$:/language/Buttons/Quote/Hint}} +refresh: {{$:/language/Buttons/Refresh/Hint}} save-tiddler: {{$:/language/Buttons/Save/Hint}} save-wiki: {{$:/language/Buttons/SaveWiki/Hint}} sidebar-search: {{$:/language/Buttons/SidebarSearch/Hint}} diff --git a/core/wiki/config/shortcuts/shortcuts-mac.multids b/core/wiki/config/shortcuts/shortcuts-mac.multids index fc3fc060f..bc7e50fda 100644 --- a/core/wiki/config/shortcuts/shortcuts-mac.multids +++ b/core/wiki/config/shortcuts/shortcuts-mac.multids @@ -6,4 +6,5 @@ underline: meta-U new-image: ctrl-I new-journal: ctrl-J new-tiddler: ctrl-N +refresh: meta-R save-wiki: meta-S diff --git a/core/wiki/config/shortcuts/shortcuts-not-mac.multids b/core/wiki/config/shortcuts/shortcuts-not-mac.multids index a50563f2d..272169552 100644 --- a/core/wiki/config/shortcuts/shortcuts-not-mac.multids +++ b/core/wiki/config/shortcuts/shortcuts-not-mac.multids @@ -6,3 +6,4 @@ underline: ctrl-U new-image: alt-I new-journal: alt-J new-tiddler: alt-N +refresh: ctrl-R From e9aa3c6c931da5537e36e92c3c30f1e3c4b72fd4 Mon Sep 17 00:00:00 2001 From: Rob Hoelz Date: Thu, 4 Apr 2024 10:03:15 -0500 Subject: [PATCH 097/185] Add $timestamp argument for <$action-deletefield> widget (#8115) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Start on some tests for <$action-deletefield /> * Only update modified field if we actually delete a field …in the <$action-deletefield /> widget. Fixes a bug where <$action-deletefield foo /> would update the modified field if the "foo" field wasn't present on a tiddler. * action-deletefield: Test when modified does and doesn't exist * Add $timestamp argument to action-deletefield To make it more consistent with other tiddler-manipulating action widgets * Add docs for action-deletefield $timestamp --- core/modules/widgets/action-deletefield.js | 9 +- .../tiddlers/tests/test-action-deletefield.js | 176 ++++++++++++++++++ .../widgets/ActionDeleteFieldWidget.tid | 1 + 3 files changed, 184 insertions(+), 2 deletions(-) create mode 100644 editions/test/tiddlers/tests/test-action-deletefield.js diff --git a/core/modules/widgets/action-deletefield.js b/core/modules/widgets/action-deletefield.js index 54068471e..00f06562d 100644 --- a/core/modules/widgets/action-deletefield.js +++ b/core/modules/widgets/action-deletefield.js @@ -37,6 +37,7 @@ Compute the internal state of the widget DeleteFieldWidget.prototype.execute = function() { this.actionTiddler = this.getAttribute("$tiddler",this.getVariable("currentTiddler")); this.actionField = this.getAttribute("$field",null); + this.actionTimestamp = this.getAttribute("$timestamp","yes") === "yes"; }; /* @@ -69,11 +70,15 @@ DeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) { $tw.utils.each(this.attributes,function(attribute,name) { if(name.charAt(0) !== "$" && name !== "title") { removeFields[name] = undefined; - hasChanged = true; + if(name in tiddler.fields) { + hasChanged = true; + } } }); if(hasChanged) { - this.wiki.addTiddler(new $tw.Tiddler(this.wiki.getCreationFields(),tiddler,removeFields,this.wiki.getModificationFields())); + var creationFields = this.actionTimestamp ? this.wiki.getCreationFields() : {}; + var modificationFields = this.actionTimestamp ? this.wiki.getModificationFields() : {}; + this.wiki.addTiddler(new $tw.Tiddler(creationFields,tiddler,removeFields,modificationFields)); } } return true; // Action was invoked diff --git a/editions/test/tiddlers/tests/test-action-deletefield.js b/editions/test/tiddlers/tests/test-action-deletefield.js new file mode 100644 index 000000000..876f44d8e --- /dev/null +++ b/editions/test/tiddlers/tests/test-action-deletefield.js @@ -0,0 +1,176 @@ +/*\ +title: test-action-deletefield.js +type: application/javascript +tags: [[$:/tags/test-spec]] + +Tests <$action-deletefield />. + +\*/ +(function(){ + +/* jslint node: true, browser: true */ +/* eslint-env node, browser, jasmine */ +/* eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/ +/* global $tw, require */ +"use strict"; + +describe("<$action-deletefield /> tests", function() { + +const TEST_TIDDLER_TITLE = "TargetTiddler"; +const TEST_TIDDLER_MODIFIED = "20240313114828368"; + +function setupWiki(condition, targetField, wikiOptions) { + // Create a wiki + var wiki = new $tw.Wiki({}); + var tiddlers = [{ + title: "Root", + text: "Some dummy content" + }]; + var tiddler; + if(condition.targetTiddlerExists) { + var fields = { + title: TEST_TIDDLER_TITLE, + }; + if(condition.modifiedFieldExists) { + fields.modified = TEST_TIDDLER_MODIFIED; + } + if(condition.targetFieldExists) { + fields[targetField] = "some text"; + } + var tiddler = new $tw.Tiddler(fields); + tiddlers.push(tiddler); + } + wiki.addTiddlers(tiddlers); + wiki.addIndexersToWiki(); + var widgetNode = wiki.makeTranscludeWidget("Root",{document: $tw.fakeDocument, parseAsInline: true}); + var container = $tw.fakeDocument.createElement("div"); + widgetNode.render(container,null); + return { + wiki: wiki, + widgetNode: widgetNode, + contaienr: container, + tiddler: tiddler, + }; +} + +function generateTestConditions() { + var conditions = []; + + $tw.utils.each([true, false], function(tiddlerArgumentIsPresent) { + $tw.utils.each([true, false], function(targetTiddlerExists) { + $tw.utils.each([true, false], function(targetFieldExists) { + $tw.utils.each([true, false], function(fieldArgumentIsUsed) { + $tw.utils.each([true, false], function(modifiedFieldExists) { + $tw.utils.each(["", "yes", "no"], function(timestampArgument) { + conditions.push({ + tiddlerArgumentIsPresent: tiddlerArgumentIsPresent, + targetTiddlerExists: targetTiddlerExists, + targetFieldExists: targetFieldExists, + fieldArgumentIsUsed: fieldArgumentIsUsed, + modifiedFieldExists: modifiedFieldExists, + timestampArgument: timestampArgument, + }); + }); + }); + }); + }); + }); + }); + + return conditions; +} + +function generateActionWikitext(condition, targetField) { + var actionPieces = [ + "<$action-deletefield", + (condition.tiddlerArgumentIsPresent ? "$tiddler='" + TEST_TIDDLER_TITLE + "'" : ""), + (condition.fieldArgumentIsUsed ? "$field='" + targetField + "'" : targetField), + (condition.timestampArgument !== "" ? "$timestamp='" + condition.timestampArgument + "'" : ""), + "/>", + ]; + + return actionPieces.join(" "); +} + +function generateTestContext(action, tiddler) { + var expectationContext = "action: " + action + "\ntiddler:\n\n"; + if(tiddler) { + expectationContext += tiddler.getFieldStringBlock({exclude: ["text"]}); + if(tiddler.text) { + expectationContext += "\n\n" + tiddler.text; + } + expectationContext += "\n\n"; + } else { + expectationContext += "null"; + } + + return expectationContext; +} + +it("should correctly delete fields", function() { + var fields = ['caption', 'description', 'text']; + + var conditions = generateTestConditions(); + + $tw.utils.each(conditions, function(condition) { + $tw.utils.each(fields, function(field) { + var info = setupWiki(condition, field); + var originalTiddler = info.tiddler; + + var invokeActions = function(actions) { + info.widgetNode.invokeActionString(actions,info.widgetNode,null,{ + currentTiddler: TEST_TIDDLER_TITLE, + }); + }; + + var action = generateActionWikitext(condition,field); + + invokeActions(action); + + var testContext = generateTestContext(action,originalTiddler); + + var tiddler = info.wiki.getTiddler(TEST_TIDDLER_TITLE); + if(originalTiddler) { + // assert that the tiddler doesn't have the target field anymore + expect(tiddler.hasField(field)).withContext(testContext).toBeFalsy(); + + var targetFieldWasPresent = originalTiddler.hasField(field); + var updateTimestamps = condition.timestampArgument !== "no"; + + // "created" should exist if it did beforehand, or if the tiddler changed and we asked the widget to update timestamps + var createdFieldShouldExist = originalTiddler.hasField("created") || (targetFieldWasPresent && updateTimestamps); + + // "created" should change only if it didn't exist beforehand and the tiddler changed and we asked the widget to update timestamps + var createdFieldShouldChange = !originalTiddler.hasField("created") && (targetFieldWasPresent && updateTimestamps); + + // "modified" should exist if it did beforehand, or if the tiddler changed and we asked the widget to update timestamps + var modifiedFieldShouldExist = originalTiddler.hasField("modified") || (targetFieldWasPresent && updateTimestamps); + + // "modified" should change if the tiddler changed and we asked the widget to update timestamps + var modifiedFieldShouldChange = targetFieldWasPresent && updateTimestamps; + + expect(tiddler.hasField("created")).withContext(testContext).toBe(createdFieldShouldExist); + expect(tiddler.hasField("modified")).withContext(testContext).toBe(modifiedFieldShouldExist); + + if(createdFieldShouldChange) { + expect(tiddler.fields.created).withContext(testContext).not.toEqual(originalTiddler.fields.created); + } else { + expect(tiddler.fields.created).withContext(testContext).toEqual(originalTiddler.fields.created); + } + + if(modifiedFieldShouldChange) { + expect(tiddler.fields.modified).withContext(testContext).not.toEqual(originalTiddler.fields.modified); + } else { + expect(tiddler.fields.modified).withContext(testContext).toEqual(originalTiddler.fields.modified); + } + } else { + // assert that the tiddler didn't get created if it didn't exist already + expect(tiddler).withContext(testContext).toBeUndefined(); + } + }); + }); +}); + +}); + +})(); diff --git a/editions/tw5.com/tiddlers/widgets/ActionDeleteFieldWidget.tid b/editions/tw5.com/tiddlers/widgets/ActionDeleteFieldWidget.tid index 2855804fd..5b797232b 100644 --- a/editions/tw5.com/tiddlers/widgets/ActionDeleteFieldWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/ActionDeleteFieldWidget.tid @@ -16,6 +16,7 @@ The ''action-deletefield'' widget is invisible. Any content within it is ignored |!Attribute |!Description | |$tiddler |The title of the tiddler whose fields are to be modified (if not provided defaults to the [[current tiddler|Current Tiddler]]) | |$field |Optional name of a field to delete | +|$timestamp |<<.from-version "5.3.4">> Specifies whether the timestamp(s) of the target tiddler will be updated (''modified'' and ''modifier'', plus ''created'' and ''creator'' for newly created tiddlers). Can be "yes" (the default) or "no" | |//{any attributes not starting with $}// |Each attribute name specifies a field to be deleted. The attribute value is ignored and need not be specified | ! Examples From 1fb9098c762015ea9f6f6305a998377c6ef33253 Mon Sep 17 00:00:00 2001 From: andjar <2013988+andjar@users.noreply.github.com> Date: Tue, 9 Apr 2024 23:22:18 +0200 Subject: [PATCH 098/185] Update cla-individual.md (#8133) Signing the CLA --- licenses/cla-individual.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/licenses/cla-individual.md b/licenses/cla-individual.md index 5db3cddfc..ce6f2fd1a 100644 --- a/licenses/cla-individual.md +++ b/licenses/cla-individual.md @@ -564,4 +564,6 @@ Ed Holsinger, @eschlon, 2024/02/08 Kim I. McKinley, @PotOfCoffee2Go, 2024/03/16 -@Jinix6, 2024/03/31 \ No newline at end of file +@Jinix6, 2024/03/31 + +Anders Jarmund, @andjar, 2024/04/05 From df8731f760e7b561ff4a0bce2569481e3e2c0c15 Mon Sep 17 00:00:00 2001 From: Cameron Fischer Date: Wed, 10 Apr 2024 05:52:22 -0400 Subject: [PATCH 099/185] Made library boot module requirements consistent (#8083) --- core/templates/external-js/save-all-external-js.tid | 2 +- core/templates/external-js/save-offline-external-js.tid | 2 +- core/templates/save-all.tid | 2 +- core/templates/save-empty.tid | 2 +- core/templates/save-lazy-all.tid | 2 +- core/templates/save-lazy-images.tid | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/templates/external-js/save-all-external-js.tid b/core/templates/external-js/save-all-external-js.tid index ff5bbc851..1f4908878 100644 --- a/core/templates/external-js/save-all-external-js.tid +++ b/core/templates/external-js/save-all-external-js.tid @@ -3,7 +3,7 @@ title: $:/core/save/all-external-js \whitespace trim \import [subfilter{$:/core/config/GlobalImportFilter}] \define saveTiddlerFilter() -[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ +[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ \end diff --git a/core/templates/external-js/save-offline-external-js.tid b/core/templates/external-js/save-offline-external-js.tid index 564a34948..70cb8bbc0 100644 --- a/core/templates/external-js/save-offline-external-js.tid +++ b/core/templates/external-js/save-offline-external-js.tid @@ -3,7 +3,7 @@ title: $:/core/save/offline-external-js \whitespace trim \import [subfilter{$:/core/config/GlobalImportFilter}] \define saveTiddlerFilter() -[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ +[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/plugins/tiddlywiki/filesystem]] -[[$:/plugins/tiddlywiki/tiddlyweb]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ \end \define defaultCoreURL() tiddlywikicore-$(version)$.js <$let coreURL={{{ [[coreURL]is[variable]thenelse] }}}> diff --git a/core/templates/save-all.tid b/core/templates/save-all.tid index d7473ba5b..a316d1954 100644 --- a/core/templates/save-all.tid +++ b/core/templates/save-all.tid @@ -2,6 +2,6 @@ title: $:/core/save/all \import [subfilter{$:/core/config/GlobalImportFilter}] \define saveTiddlerFilter() -[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ +[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$ \end {{$:/core/templates/tiddlywiki5.html}} diff --git a/core/templates/save-empty.tid b/core/templates/save-empty.tid index 6f0da4822..0b1c33b59 100644 --- a/core/templates/save-empty.tid +++ b/core/templates/save-empty.tid @@ -1,6 +1,6 @@ title: $:/core/save/empty \define saveTiddlerFilter() -[is[system]] -[prefix[$:/state/popup/]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] +[is[system]] -[prefix[$:/state/popup/]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] \end {{$:/core/templates/tiddlywiki5.html}} diff --git a/core/templates/save-lazy-all.tid b/core/templates/save-lazy-all.tid index a4b5cd6e9..da4353fba 100644 --- a/core/templates/save-lazy-all.tid +++ b/core/templates/save-lazy-all.tid @@ -1,7 +1,7 @@ title: $:/core/save/lazy-all \define saveTiddlerFilter() -[is[system]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] [is[tiddler]type[application/javascript]] +[sort[title]] +[is[system]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] [is[tiddler]type[application/javascript]] +[sort[title]] \end \define skinnySaveTiddlerFilter() [!is[system]] -[type[application/javascript]] diff --git a/core/templates/save-lazy-images.tid b/core/templates/save-lazy-images.tid index 0a4a84295..b23b348f0 100644 --- a/core/templates/save-lazy-images.tid +++ b/core/templates/save-lazy-images.tid @@ -1,7 +1,7 @@ title: $:/core/save/lazy-images \define saveTiddlerFilter() -[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[!is[system]is[image]] +[sort[title]] +[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[is[system]type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] -[!is[system]is[image]] +[sort[title]] \end \define skinnySaveTiddlerFilter() [!is[system]is[image]] From 9167b190d2116cfb7dcd33b106c2bea719d6d0f2 Mon Sep 17 00:00:00 2001 From: Joshua Fontany Date: Thu, 11 Apr 2024 11:23:32 -0700 Subject: [PATCH 100/185] Fix bug 8138: server cache-control (#8141) * cache-control no-store by default * clarify comment spec reference * comment typo * fix else formatting * Update server.js allow route definitions to set their own cache-control --- core/modules/server/server.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/modules/server/server.js b/core/modules/server/server.js index 258ddfa31..d3c98f8fc 100644 --- a/core/modules/server/server.js +++ b/core/modules/server/server.js @@ -140,6 +140,11 @@ function sendResponse(request,response,statusCode,headers,data,encoding) { return; } } + } else { + // RFC 7231, 6.1. Overview of Status Codes: + // Browser clients may cache 200, 203, 204, 206, 300, 301, + // 404, 405, 410, 414, and 501 unless given explicit cache controls + headers["Cache-Control"] = headers["Cache-Control"] || "no-store"; } /* If the gzip=yes is set, check if the user agent permits compression. If so, From 5f74f4c2fa520b0c7a639cd0dcd5cc450b63418d Mon Sep 17 00:00:00 2001 From: Joshua Fontany Date: Thu, 11 Apr 2024 13:54:46 -0700 Subject: [PATCH 101/185] Fix bug 7878: Save command (#8140) * first pass at fixing bug 7878, needs testing * clarify default behaviour in comment * fix property typo, tested and works as intended * remove debugger --- core/modules/commands/save.js | 4 +++- core/modules/utils/filesystem.js | 23 +++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/core/modules/commands/save.js b/core/modules/commands/save.js index 9769cec69..3cb7ef08c 100644 --- a/core/modules/commands/save.js +++ b/core/modules/commands/save.js @@ -43,7 +43,9 @@ Saves individual tiddlers in their raw text or binary format to the specified fi directory: path.resolve(self.commander.outputPath), pathFilters: [filenameFilter], wiki: wiki, - fileInfo: {} + fileInfo: { + overwrite: true + } }); if(self.commander.verbose) { console.log("Saving \"" + title + "\" to \"" + fileInfo.filepath + "\""); diff --git a/core/modules/utils/filesystem.js b/core/modules/utils/filesystem.js index 1ba34323e..5319e0481 100644 --- a/core/modules/utils/filesystem.js +++ b/core/modules/utils/filesystem.js @@ -316,11 +316,13 @@ Options include: pathFilters: optional array of filters to be used to generate the base path wiki: optional wiki for evaluating the pathFilters fileInfo: an existing fileInfo object to check against + fileInfo.overwrite: if true, turns off filename clash numbers (defaults to false) */ exports.generateTiddlerFilepath = function(title,options) { var directory = options.directory || "", extension = options.extension || "", originalpath = (options.fileInfo && options.fileInfo.originalpath) ? options.fileInfo.originalpath : "", + overwrite = options.fileInfo && options.fileInfo.overwrite || false, filepath; // Check if any of the pathFilters applies if(options.pathFilters && options.wiki) { @@ -381,19 +383,20 @@ exports.generateTiddlerFilepath = function(title,options) { filepath += char.charCodeAt(0).toString(); }); } - // Add a uniquifier if the file already exists - var fullPath, oldPath = (options.fileInfo) ? options.fileInfo.filepath : undefined, + // Add a uniquifier if the file already exists (default) + var fullPath = path.resolve(directory, filepath + extension); + if (!overwrite) { + var oldPath = (options.fileInfo) ? options.fileInfo.filepath : undefined, count = 0; - do { - fullPath = path.resolve(directory,filepath + (count ? "_" + count : "") + extension); - if(oldPath && oldPath == fullPath) { - break; - } - count++; - } while(fs.existsSync(fullPath)); + do { + fullPath = path.resolve(directory,filepath + (count ? "_" + count : "") + extension); + if(oldPath && oldPath == fullPath) break; + count++; + } while(fs.existsSync(fullPath)); + } // If the last write failed with an error, or if path does not start with: // the resolved options.directory, the resolved wikiPath directory, the wikiTiddlersPath directory, - // or the 'originalpath' directory, then $tw.utils.encodeURIComponentExtended() and resolve to tiddler directory. + // or the 'originalpath' directory, then $tw.utils.encodeURIComponentExtended() and resolve to options.directory. var writePath = $tw.hooks.invokeHook("th-make-tiddler-path",fullPath,fullPath), encode = (options.fileInfo || {writeError: false}).writeError == true; if(!encode) { From d3722a6602254a619fa655f6777f74ac75ec09bf Mon Sep 17 00:00:00 2001 From: Joshua Fontany Date: Sat, 13 Apr 2024 02:08:40 -0700 Subject: [PATCH 102/185] Docs for use-browser-cache (#8142) * docs for use-browser-cache * Update WebServer Parameter_ use-browse-cache.tid remove timestamps * revert last change * move to webserver folder * clarify, typos * dedupe --- ...Using the external JavaScript template.tid | 4 +-- ...sing the integrated static file server.tid | 19 ++++++++++++-- .../WebServer Parameter_ use-browse-cache.tid | 25 +++++++++++++++++++ .../tw5.com/tiddlers/webserver/WebServer.tid | 2 +- 4 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 editions/tw5.com/tiddlers/webserver/WebServer Parameter_ use-browse-cache.tid diff --git a/editions/tw5.com/tiddlers/webserver/Using the external JavaScript template.tid b/editions/tw5.com/tiddlers/webserver/Using the external JavaScript template.tid index 75b5f1484..75d38cc29 100644 --- a/editions/tw5.com/tiddlers/webserver/Using the external JavaScript template.tid +++ b/editions/tw5.com/tiddlers/webserver/Using the external JavaScript template.tid @@ -1,5 +1,5 @@ created: 20180905075846391 -modified: 20230319130830880 +modified: 20240413045138914 tags: [[WebServer Guides]] title: Using the external JavaScript template type: text/vnd.tiddlywiki @@ -20,7 +20,7 @@ The remaining inefficiency when working in the client server configuration is th ! Using the external ~JavaScript template with the client-server configuration -The mechanism is activated by setting the [[root-tiddler|WebServer Parameter: root-tiddler]] parameter to `$:/core/save/all-external-js`. This template externalises ~TiddlyWiki's core ~JavaScript into a separate file. For example, the following command will start your server with caching enabled. It will transfer the wiki with two GET requests, and the core can be cached by the browser. +The mechanism is activated by setting the [[root-tiddler|WebServer Parameter: root-tiddler]] parameter to `$:/core/save/all-external-js`. This template externalises ~TiddlyWiki's core ~JavaScript into a separate file. For example, the following command will [[start your server with caching enabled|WebServer Parameter: use-browser-cache]]. It will transfer the wiki with two GET requests, and the core can be cached by the browser. ``` tiddlywiki YOUR_WIKI_FOLDER --listen 'root-tiddler=$:/core/save/all-external-js' use-browser-cache=yes diff --git a/editions/tw5.com/tiddlers/webserver/Using the integrated static file server.tid b/editions/tw5.com/tiddlers/webserver/Using the integrated static file server.tid index 515730a3b..91544551e 100644 --- a/editions/tw5.com/tiddlers/webserver/Using the integrated static file server.tid +++ b/editions/tw5.com/tiddlers/webserver/Using the integrated static file server.tid @@ -1,5 +1,5 @@ created: 20180703095630828 -modified: 20180703100445719 +modified: 20240413045124764 tags: [[WebServer Guides]] title: Using the integrated static file server type: text/vnd.tiddlywiki @@ -13,4 +13,19 @@ Static files can be referenced directly: * `[ext[./files/a-big-document.pdf]]` - to make a link to a PDF * `[img[./files/a-big-image.png]]` - to embed an image -Alternatively, the ''_canonical_uri'' field can be used to reference the files as [[external tiddlers|ExternalImages]]. \ No newline at end of file +Alternatively, the ''_canonical_uri'' field can be used to reference the files as [[external tiddlers|ExternalImages]]. + +If [[WebServer Parameter: use-browser-cache]] is used, these files will be cached by the client's browser to save on bandwidth. In this case, the `cache busting strategy` can be used to make sure the client always has the latest updated files. + + +<<< +https://javascript.plainenglish.io/what-is-cache-busting-55366b3ac022 + +!! Cache Busting + +There are a couple different ways of changing the names of files so that they will load when they change. One way is to use version numbers and have them somewhere in the file name when loading. You could have a subdirectory for every version, `v1/index.js` `v2/index.css` . You could also have the version in queries in the URLs, `index.js?v1` , `index.css?v2` . + +Another way is to change the name of the file, `index.v1.js` , `index.v2.css` . These ways are not as manageable because this can become very hard once you have a ton of files that are being changed. + +A more popular and manageable way is to keep hashes inside the file names. Hashes, if you don’t know, are fixed length character representations of any content and they are irreversible, meaning you can get the hash from the file but you can’t get the file from the hash. Hashes are perfect for this, because when a file changes its hash will change, so if we keep the hash inside the filename `index.[someHashHere].js` browsers will detect it and load it instead of an old file. +<<< diff --git a/editions/tw5.com/tiddlers/webserver/WebServer Parameter_ use-browse-cache.tid b/editions/tw5.com/tiddlers/webserver/WebServer Parameter_ use-browse-cache.tid new file mode 100644 index 000000000..2d0693aa2 --- /dev/null +++ b/editions/tw5.com/tiddlers/webserver/WebServer Parameter_ use-browse-cache.tid @@ -0,0 +1,25 @@ +caption: use-browse-cache +created: 20240413042652008 +modified: 20240413050841387 +tags: [[WebServer Parameters]] +title: WebServer Parameter: use-browser-cache +type: text/vnd.tiddlywiki + +The [[web server configuration parameter|WebServer Parameters]] ''use-browser-cache=yes'' activates 200 OK browser caching via the `Cache-Control` header and a smart a Etag header: + +* The server javascript creates an MD5 `hash` object. +* Adds the data of the current `request:response` (for example: json text or an image binary) to the hash object. +* Adds the current `headers` of the response to the hash object. +* If the response data has an `encoding` value, adds the encoding to the hash object. +* Calculates the final MD5 hash string as a `contentDigest` javascript variable, and saves it as an `Etag: "<>"` header. + +If the incoming request contains a header named `if-none-match`, then the server will check the generated Etag against all values. + +If any `if-none-match` value DOES match the current Etag, the server will send a `304 NOT MODIFIED` response with the current response headers, instead of the data with a `200 OK` response. + +This saves bandwidth, as the client can be sure they have already received the exact data and has it in their current cache. + +If ''use-browser-cache=no'' (or any other value including null), then the server will return a `Cache-Control: no-store` header by default. + +If any customer server route module defines custom `Cache-Control` header behavior, then the server will pass that header through instead of the default. + diff --git a/editions/tw5.com/tiddlers/webserver/WebServer.tid b/editions/tw5.com/tiddlers/webserver/WebServer.tid index c1ab5ae2a..afa3fe749 100644 --- a/editions/tw5.com/tiddlers/webserver/WebServer.tid +++ b/editions/tw5.com/tiddlers/webserver/WebServer.tid @@ -1,5 +1,5 @@ created: 20180626150526207 -modified: 20181216181934282 +modified: 20240413043741157 tags: ListenCommand ServerCommand Features title: WebServer type: text/vnd.tiddlywiki From 1d48909012f98806cd1894b2d998fb4031a9a2d9 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Tue, 16 Apr 2024 10:34:49 +0100 Subject: [PATCH 103/185] Docs: Remove reference to restrictions on field names Fixes #8146 --- editions/tw5.com/tiddlers/concepts/TiddlerFields.tid | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editions/tw5.com/tiddlers/concepts/TiddlerFields.tid b/editions/tw5.com/tiddlers/concepts/TiddlerFields.tid index 0f9b830a7..342c04280 100644 --- a/editions/tw5.com/tiddlers/concepts/TiddlerFields.tid +++ b/editions/tw5.com/tiddlers/concepts/TiddlerFields.tid @@ -1,11 +1,11 @@ created: 20130825213300000 -modified: 20220109101407050 +modified: 20240416103247799 tags: Concepts title: TiddlerFields type: text/vnd.tiddlywiki \define lingo-base() $:/language/Docs/Fields/ -~TiddlerFields are name:value pairs that make up a [[tiddler|Tiddlers]]. Field names must be lowercase letters, digits or the characters `-` (dash), `_` (underscore) and `.` (period). +~TiddlerFields are name:value pairs that make up a [[tiddler|Tiddlers]]. Field names may contain any combination of characters (prior to [[v5.2.0|Release 5.2.0]], fields were constrained to be lowercase letters, digits or the characters `-` (dash), `_` (underscore) and `.` (period)). The standard fields are: From a081e58273da9b7974eac1e860193e371a32e69c Mon Sep 17 00:00:00 2001 From: Matt Lauber Date: Tue, 16 Apr 2024 11:24:53 -0400 Subject: [PATCH 104/185] HTTP Client: Return success calls for all 2XX response codes (#8150) APIs especially use 2XX response codes outside of 200, 201, 204 for responding to responses. Treat all "Successful" response codes (i.e. anything between 200-299) as successes, and pass the responseText. --- core/modules/utils/dom/http.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/utils/dom/http.js b/core/modules/utils/dom/http.js index 05879e5a9..ddb1e17c4 100644 --- a/core/modules/utils/dom/http.js +++ b/core/modules/utils/dom/http.js @@ -283,7 +283,7 @@ exports.httpRequest = function(options) { // Set up the state change handler request.onreadystatechange = function() { if(this.readyState === 4) { - if(this.status === 200 || this.status === 201 || this.status === 204) { + if(this.status >= 200 && this.status < 300) { // Success! options.callback(null,this[returnProp],this); return; From 67845f8ebeb24aabfdc50c94b01c7c147ea85e9c Mon Sep 17 00:00:00 2001 From: FSpark Date: Fri, 26 Apr 2024 00:29:09 +0800 Subject: [PATCH 105/185] Fix: some plugin subtiddlers do not have title in savewikifolder command (#8151) * fix: some plugin subtiddlers do not have title in savewikifolder command * fix: following coding style --- core/modules/commands/savewikifolder.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/modules/commands/savewikifolder.js b/core/modules/commands/savewikifolder.js index c0fccd775..461ff6f04 100644 --- a/core/modules/commands/savewikifolder.js +++ b/core/modules/commands/savewikifolder.js @@ -176,7 +176,10 @@ WikiFolderMaker.prototype.saveCustomPlugin = function(pluginTiddler) { this.saveJSONFile(directory + path.sep + "plugin.info",pluginInfo); self.log("Writing " + directory + path.sep + "plugin.info: " + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces)); var pluginTiddlers = $tw.utils.parseJSONSafe(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin - $tw.utils.each(pluginTiddlers,function(tiddler) { + $tw.utils.each(pluginTiddlers,function(tiddler,title) { + if(!tiddler.title) { + tiddler.title = title; + } self.saveTiddler(directory,new $tw.Tiddler(tiddler)); }); }; From b4e0a9b28bc7f0e2bfedc16023aecf2be61c0056 Mon Sep 17 00:00:00 2001 From: sarna Date: Sun, 28 Apr 2024 19:22:58 +0200 Subject: [PATCH 106/185] Signing the CLA (#8171) --- licenses/cla-individual.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/licenses/cla-individual.md b/licenses/cla-individual.md index ce6f2fd1a..e73a46e35 100644 --- a/licenses/cla-individual.md +++ b/licenses/cla-individual.md @@ -567,3 +567,5 @@ Kim I. McKinley, @PotOfCoffee2Go, 2024/03/16 @Jinix6, 2024/03/31 Anders Jarmund, @andjar, 2024/04/05 + +@sarna, 2024/04/28 From 07a048975d430f1e7f9a48665832959ab6c86b20 Mon Sep 17 00:00:00 2001 From: sarna Date: Sun, 28 Apr 2024 19:23:31 +0200 Subject: [PATCH 107/185] Improve Polish date translation (#8170) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Make month and weekday names lowercase * Replace AM and PM with Polish words * Adhere to recommendations wrt short weekday names https://sjp.pwn.pl/poradnia/haslo/dni-tygodnia-i-inne-roznosci;1788.html * Fix a typo * Inflect month names I assume they're always used as part of the full date, and in this case months are always inflected in Polish. * Use roman numerals in place of short month names I could not find any actual use of short month names in Polish. The only mentions are from people trying to translate English conventions into Polish - typically in software. In https://sjp.pwn.pl/poradnia/haslo/dni-tygodnia-i-inne-roznosci;1788.html Mr. Bańko answered (translation mine): Abbreviations of month names are less common, numbers are used instead. Such abbreviations can be created [...]. However, one must take into account that the reader will not understand them. I decided to go with a convention that's in actual use, rather than to force an English convention which is alien to non-software dev Poles. --- languages/pl-PL/Dates.multids | 82 +++++++++++++++++------------------ 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/languages/pl-PL/Dates.multids b/languages/pl-PL/Dates.multids index f1c2d3a1b..0c12a366f 100644 --- a/languages/pl-PL/Dates.multids +++ b/languages/pl-PL/Dates.multids @@ -31,46 +31,46 @@ Date/DaySuffix/28: . Date/DaySuffix/29: . Date/DaySuffix/30: . Date/DaySuffix/31: . -Date/Long/Day/0: Niedziela -Date/Long/Day/1: Poniedziałek -Date/Long/Day/2: Wtorek -Date/Long/Day/3: Środa -Date/Long/Day/4: Czwartek -Date/Long/Day/5: Piątek -Date/Long/Day/6: Sobota -Date/Long/Month/1: Styczeń -Date/Long/Month/2: Luty -Date/Long/Month/3: Marzec -Date/Long/Month/4: Kwiecień -Date/Long/Month/5: Maj -Date/Long/Month/6: Czerwiec -Date/Long/Month/7: Lipiec -Date/Long/Month/8: Sierpień -Date/Long/Month/9: Wrzesień -Date/Long/Month/10: Październik -Date/Long/Month/11: Listopad -Date/Long/Month/12: Grudzień -Date/Period/am: AM -Date/Period/pm: PM -Date/Short/Day/0: nd -Date/Short/Day/1: pn -Date/Short/Day/2: wt -Date/Short/Day/3: śr -Date/Short/Day/4: cz -Date/Short/Day/5: pt -Date/Short/Day/6: sb -Date/Short/Month/1: st -Date/Short/Month/2: lut -Date/Short/Month/3: mrz -Date/Short/Month/4: kw -Date/Short/Month/5: maj -Date/Short/Month/6: cz -Date/Short/Month/7: lip -Date/Short/Month/8: sier -Date/Short/Month/9: wrz -Date/Short/Month/10: paź -Date/Short/Month/11: lis -Date/Short/Month/12: gr +Date/Long/Day/0: niedziela +Date/Long/Day/1: poniedziałek +Date/Long/Day/2: wtorek +Date/Long/Day/3: środa +Date/Long/Day/4: czwartek +Date/Long/Day/5: piątek +Date/Long/Day/6: sobota +Date/Long/Month/1: stycznia +Date/Long/Month/2: lutego +Date/Long/Month/3: marca +Date/Long/Month/4: kwietnia +Date/Long/Month/5: maja +Date/Long/Month/6: czerwca +Date/Long/Month/7: lipca +Date/Long/Month/8: sierpnia +Date/Long/Month/9: września +Date/Long/Month/10: października +Date/Long/Month/11: listopada +Date/Long/Month/12: grudnia +Date/Period/am: rano +Date/Period/pm: po południu +Date/Short/Day/0: niedz. +Date/Short/Day/1: pon. +Date/Short/Day/2: wt. +Date/Short/Day/3: śr. +Date/Short/Day/4: czw. +Date/Short/Day/5: pt. +Date/Short/Day/6: sob. +Date/Short/Month/1: I +Date/Short/Month/2: II +Date/Short/Month/3: III +Date/Short/Month/4: IV +Date/Short/Month/5: V +Date/Short/Month/6: VI +Date/Short/Month/7: VII +Date/Short/Month/8: VIII +Date/Short/Month/9: IX +Date/Short/Month/10: X +Date/Short/Month/11: XI +Date/Short/Month/12: XII RelativeDate/Future/Days: <> dni od teraz RelativeDate/Future/Hours: <> godzin od teraz RelativeDate/Future/Minutes: <> minut od teraz @@ -79,7 +79,7 @@ RelativeDate/Future/Second: 1 sekunda od teraz RelativeDate/Future/Seconds: <> sekund od teraz RelativeDate/Future/Years: <> lat od teraz RelativeDate/Past/Days: <> dni temu -RelativeDate/Past/Hours: <> godizn temu +RelativeDate/Past/Hours: <> godzin temu RelativeDate/Past/Minutes: <> minut temu RelativeDate/Past/Months: <> miesięcy temu RelativeDate/Past/Second: 1 sekundę temu From 64f5dd942cda4c0b6f332d2da30fa50e828fb265 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 2 May 2024 11:39:25 +0100 Subject: [PATCH 108/185] Update release note --- .../prerelease/tiddlers/Release 5.3.4.tid | 69 +++++++++++++++++-- 1 file changed, 63 insertions(+), 6 deletions(-) diff --git a/editions/prerelease/tiddlers/Release 5.3.4.tid b/editions/prerelease/tiddlers/Release 5.3.4.tid index 562909a93..638afaaa2 100644 --- a/editions/prerelease/tiddlers/Release 5.3.4.tid +++ b/editions/prerelease/tiddlers/Release 5.3.4.tid @@ -10,12 +10,23 @@ description: Under development ! Major Improvements +<<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7734">> several new features that together allow interactive learning tours to be created and presented in TiddlyWiki. + +The demo TiddlyWiki interactive tour can be seen at https://tiddlywiki.com/prerelease/tour + +The new features include: + +* The new Tour Plugin itself +* The new Confetti Plugin that allows animated bursts of confetti to be displayed +* Improvements to the Dynannotate Plugin to add the ability to highlight screen elements using an animated spotlight effect ! Translation improvements Improvements to the following translations: -* +* Chinese +* Macedonian +* Polish ! Plugin Improvements @@ -23,23 +34,44 @@ Improvements to the following translations: ! Widget Improvements -* +* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/8115">> ''$timestamp'' attribute to ActionDeleteFieldWidget + +! Filter Improvements + +* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7966">> new [[backtranscludes Operator]] ! Usability Improvements -* +* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/issues/8121">> new keyboard shortcut for refreshing the page ! Hackability Improvements -* +* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/7966">> button to the JavaScript error popup allowing tiddlers to be saved to a local JSON file +* <<.link-badge-updated "https://github.com/Jermolene/TiddlyWiki5/issues/8120">> to latest version of modern-normalize 2.0.0 ! Bug Fixes -* +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7933">> TiddlyWikiClassic build process +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7935">> LinkWidget not refreshing when the `to` attribute changes +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/3460">> parsing bug with empty procedures/macros +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7907">> functions to use variables set by filter runs +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7943">> edit widget not refreshing when the editor type changes +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7922">> editor preview width +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/9bf3c0602d4fd3fe5ac7411db697b51f87a79056">> [[WidgetMessage: tm-http-request]] not returning data in the event of an error +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/8150">> [[WidgetMessage: tm-http-request]] incorrectly interpreting 2XX status codes +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7949">> processing of path separators in `tiddlywiki.files` files on Windows +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7975">> incorrect state reference in advanced search +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7985">> clipping of popups in preview pane +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/8039">> JavaScript error when attempting to export missing tiddlers to a CSV file +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7909">> imported procedures defaulting to `\whitespace trim` +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/801ed0ea1164aab4f88547322f9d73704388143f">> crash with [[cycle Operator]] if the the step size is larger than the number of operands +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/8095">> proper DOCTYPE for the open window template +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7945">> theme font size settings to open in new window CSS ! Node.js Improvements -* +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/8141">> usage of "Cache-Control" header +* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/issues/7878">> SaveCommand not overwriting files when required ! Performance Improvements @@ -58,4 +90,29 @@ Improvements to the following translations: [[@Jermolene|https://github.com/Jermolene]] would like to thank the contributors to this release who have generously given their time to help improve TiddlyWiki: <<.contributors """ +andjar +AnthonyMuscio +bimlas +BramChen +btheado +BurningTreeC +catter-fly +eschlon +etardiff +flibbles +FSpark +hoelzro +jinix6 +joshuafontany +linonetwo +mateuszwilczek +mklauber +oeyoews +pmario +PotOfCoffee2Go +rmunn +saqimtiaz +sarna +Telumire +yaisog """>> From 24dceb1bced9f4c49dc688c9bb6b865da8ac26dc Mon Sep 17 00:00:00 2001 From: twMat Date: Tue, 14 May 2024 09:38:30 +0200 Subject: [PATCH 109/185] Update Filter Run Prefix.tid (#8188) add relevant links --- editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix.tid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix.tid b/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix.tid index 4387ba9cb..5eb487b6d 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/Filter Run Prefix.tid @@ -4,7 +4,7 @@ tags: [[Filter Expression]] title: Filter Run Prefix type: text/vnd.tiddlywiki -There are 2 types of filter run prefixes that are interchangeable. Named prefixes and shortcut prefixes. +There are 2 types of filter run prefixes that are interchangeable; [[named prefixes|Named Filter Run Prefix]] and [[shortcut prefixes|Shortcut Filter Run Prefix]]. <$railroad text=""" \start none From f1299120a6a62a7ca5fb7d224c1d2bd758bd7595 Mon Sep 17 00:00:00 2001 From: Joshua Fontany Date: Wed, 15 May 2024 04:25:02 -0700 Subject: [PATCH 110/185] Block Quotes - fix parsing error with spaces before reEndString (#8186) * fix parsing error with spaces before reEndString, update docs to clarify block mode inside block quotes. * additional advanced example * oops, convert spaces back to tabs. * reset indentation * final tabs * missed some * wikitext classes are appended to other leading wikitext, no need to skip whitespace here. --- .../parsers/wikiparser/rules/quoteblock.js | 30 ++--------------- .../wikitext/Block Quotes in WikiText.tid | 33 ++++++++++++++++++- .../wikitext/Hard Linebreaks in WikiText.tid | 10 ++++-- .../wikitext/parser/Block Mode WikiText.tid | 4 +-- 4 files changed, 44 insertions(+), 33 deletions(-) diff --git a/core/modules/parsers/wikiparser/rules/quoteblock.js b/core/modules/parsers/wikiparser/rules/quoteblock.js index 71b689680..787b7e30f 100644 --- a/core/modules/parsers/wikiparser/rules/quoteblock.js +++ b/core/modules/parsers/wikiparser/rules/quoteblock.js @@ -3,30 +3,7 @@ title: $:/core/modules/parsers/wikiparser/rules/quoteblock.js type: application/javascript module-type: wikirule -Wiki text rule for quote blocks. For example: - -``` - <<<.optionalClass(es) optional cited from - a quote - <<< - - <<<.optionalClass(es) - a quote - <<< optional cited from -``` - -Quotes can be quoted by putting more 0) { tree.unshift({ diff --git a/editions/tw5.com/tiddlers/wikitext/Block Quotes in WikiText.tid b/editions/tw5.com/tiddlers/wikitext/Block Quotes in WikiText.tid index 181779fe9..5e2a368f4 100644 --- a/editions/tw5.com/tiddlers/wikitext/Block Quotes in WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/Block Quotes in WikiText.tid @@ -1,6 +1,6 @@ caption: Block Quotes created: 20131206154636572 -modified: 20170417165145317 +modified: 20240512000910702 tags: WikiText title: Block Quotes in WikiText type: text/vnd.tiddlywiki @@ -72,3 +72,34 @@ You can also mix block quotes with other list items. For example: **> Another quote * List Three ">> + +! Advanced Wikitext and Block Quotes +You can also mix block quotes with paragraphs and other block wikitext. Be mindful of block mode - if other quoted content follows a paragraph, end it with a blank line. The final paragraph in the quote does not need to end with a blank line. If using indentation, make sure __not to indent the blank lines__. The parser will interpret this as additional inline content and not return to block mode. For example: + +< A quote +""" +A poem +with line beaks +needs to have +a blank line after +the final quotes +if followed +by other content +""" + + <<<< Deep Block Quote + A paragraph before other //wikitext//, which ends with a blank line. + + ! A Header + Another paragraph, which needs to end with a blank line. + + !! Sub Header + A final paragraph, which __does not__ need to end with a blank line as the Block Quote ends. + <<<< +<<< +'>> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/wikitext/Hard Linebreaks in WikiText.tid b/editions/tw5.com/tiddlers/wikitext/Hard Linebreaks in WikiText.tid index c49b866ce..b7f05756f 100644 --- a/editions/tw5.com/tiddlers/wikitext/Hard Linebreaks in WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/Hard Linebreaks in WikiText.tid @@ -1,9 +1,9 @@ +caption: Hard Linebreaks created: 20131214165710101 -modified: 20131214170106553 +modified: 20240512001649319 tags: WikiText title: Hard Linebreaks in WikiText type: text/vnd.tiddlywiki -caption: Hard Linebreaks The usual handling of [[paragraphs in wikitext|Paragraphs in WikiText]] causes single line breaks to be ignored, and double linebreaks to be interpreted as the end of a paragraph. @@ -15,4 +15,8 @@ and this is a new line while this is yet another line and this is the final one apart from this one -"""'>> +""" + +'>> + +<<.tip 'Note: Hard Linebreaks in ~WikiText require an extra blank line after the trailing `"""` before the parser will return to [[block mode|Block Mode WikiText]].'>>. \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/wikitext/parser/Block Mode WikiText.tid b/editions/tw5.com/tiddlers/wikitext/parser/Block Mode WikiText.tid index 9501f672c..b0e00cfaf 100644 --- a/editions/tw5.com/tiddlers/wikitext/parser/Block Mode WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/parser/Block Mode WikiText.tid @@ -1,6 +1,6 @@ caption: block parser mode created: 20220110234234616 -modified: 20220122182842032 +modified: 20240512001555383 tags: [[WikiText Parser Modes]] title: Block Mode WikiText type: text/vnd.tiddlywiki @@ -28,7 +28,7 @@ Common characteristics of such block mode WikiText: The above WikiText types are only recognised in ''block mode''. However, the text <<.em enclosed>> by most of them will be parsed in ''inline mode'' ([[Block Quotes in WikiText]] and [[Styles and Classes in WikiText]] are the two exceptions in which the parser will continue in ''block mode''). While in ''inline mode'' the parser may encounter something which moves it to ''block mode'' (see [[WikiText parser mode transitions]]). At the end of the terminating line, the parser will return to ''block mode''. -<<.tip 'Note: [[Hard Linebreaks in WikiText]] require an extra blank line after the trailing `"""` before the parser will return to block mode'>>. +<<.tip 'Note: [[Hard Linebreaks in WikiText]] require an extra blank line after the trailing `"""` before the parser will return to block mode.'>> If the punctuation for the above types of WikiText is encountered while the parser is in ''inline mode'', it will be //ignored// and output as-is. From ece8b0ee01f04f9a88066d48500f41bc3765dfff Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Mon, 20 May 2024 11:30:30 +0100 Subject: [PATCH 111/185] Add <$testcase> widget (#7817) * Initial Commit * Add note to preview build * Fix whitespace and indenting Thanks @pmario * Fix crash with unset $tiddler attribute on <$data> widget Thanks @CodaCodr * Don't duplicate "description" field in test cases * Use different background colours for nested testcase widgets * Extend the testcase widget to run tests * Add testcases to control panel * Add a view template body template to render testcase tiddlers * Test edition should display testcases * Whitespace fixes * Make testcase tiddler tempalte link to itself * Styling tweaks * Docs improvements * Styling tweaks * Run the new tw5.com testcases in the test edition * Update data widget to display its content in JSON * Add testcase convenience procedure * Clearer testcases for data widget, and docs tweaks * Don't expect our intentionally failing test to pass * Extend testcase default template so that the display format can be chosen It is selected by setting the variable "displayFormat" * DataWidget docs typo * Fix data widget not refreshing * Links in testcase output switch to the tab containing that tiddler Thanks to @btheado for the suggestion * Docs update for 648855e8a50b1ee3bef3120b64b5713b69190c9b * Wording tweak * Add support for narrative tiddlers in test cases * Documentation improvements * Cleanup comments * Remove obsolete code comments * Simplify template * Docs update * Rename $:/core/ui/testcases/DefaultTemplate/SourceTabs from $:/core/ui/testcases/DefaultTemplate/Source * Use the view template body for failing tests * Don't reference the geospatial plugin * "Test case" should be two words * Fix handling of currentTiddler variable Fixes problem reported by @btheado in https://github.com/Jermolene/TiddlyWiki5/pull/7817#issuecomment-2103704468 * Prepare for merging --- core/language/en-GB/ControlPanel.multids | 6 + .../en-GB/Docs/PaletteColours.multids | 3 + core/modules/widgets/data.js | 145 ++++++++++++++++ core/modules/widgets/testcase.js | 160 ++++++++++++++++++ core/modules/widgets/widget.js | 15 ++ core/palettes/Vanilla.tid | 3 + core/ui/ControlPanel/TestCases.tid | 10 ++ core/ui/ControlPanel/TestCasesAll.tid | 24 +++ core/ui/ControlPanel/TestCasesFailed.tid | 15 ++ core/ui/TestCaseTemplate.tid | 18 ++ core/ui/TestCases/DefaultTemplate.tid | 64 +++++++ .../TestCases/DefaultTemplateSourceTabs.tid | 24 +++ core/ui/TestCases/RawJSONTemplate.tid | 4 + .../config/ViewTemplateBodyFilters.multids | 1 + core/wiki/macros/testcase.tid | 10 ++ core/wiki/tags/ViewTemplateBodyFilter.tid | 2 +- editions/test/tiddlers/HelloThere.tid | 4 + .../tests/from-tw5.com/tiddlywiki.files | 5 + .../tiddlers/concepts/CompoundTiddlers.tid | 31 ++++ .../tiddlers/concepts/TestCaseTiddlers.tid | 27 +++ .../tiddlers/hellothere/HelloThere.tid | 2 +- .../testcases/DataWidget/ImportCompound.tid | 33 ++++ .../testcases/DataWidget/ImportedFilter.tid | 49 ++++++ .../testcases/DataWidget/ImportedTiddler.tid | 29 ++++ .../testcases/DataWidget/Refreshing.tid | 30 ++++ .../testcases/DataWidget/SimpleTiddler.tid | 22 +++ .../testcases/TestCaseWidget/FailingTest.tid | 15 ++ .../TestCaseWidget/currentTiddler.tid | 16 ++ .../TranscludeWidget/SimpleTransclusion.tid | 23 +++ .../tw5.com/tiddlers/widgets/DataWidget.tid | 42 +++++ .../tiddlers/widgets/TestCaseWidget.tid | 101 +++++++++++ plugins/tiddlywiki/innerwiki/anchor.js | 17 ++ plugins/tiddlywiki/innerwiki/data.js | 58 ------- plugins/tiddlywiki/innerwiki/innerwiki.js | 72 +------- .../jasmine/run-wiki-based-tests.js | 8 +- themes/tiddlywiki/vanilla/base.tid | 152 ++++++++++++++++- 36 files changed, 1109 insertions(+), 131 deletions(-) create mode 100644 core/modules/widgets/data.js create mode 100644 core/modules/widgets/testcase.js create mode 100644 core/ui/ControlPanel/TestCases.tid create mode 100644 core/ui/ControlPanel/TestCasesAll.tid create mode 100644 core/ui/ControlPanel/TestCasesFailed.tid create mode 100644 core/ui/TestCaseTemplate.tid create mode 100644 core/ui/TestCases/DefaultTemplate.tid create mode 100644 core/ui/TestCases/DefaultTemplateSourceTabs.tid create mode 100644 core/ui/TestCases/RawJSONTemplate.tid create mode 100644 core/wiki/macros/testcase.tid create mode 100644 editions/test/tiddlers/tests/from-tw5.com/tiddlywiki.files create mode 100644 editions/tw5.com/tiddlers/concepts/CompoundTiddlers.tid create mode 100644 editions/tw5.com/tiddlers/concepts/TestCaseTiddlers.tid create mode 100644 editions/tw5.com/tiddlers/testcases/DataWidget/ImportCompound.tid create mode 100644 editions/tw5.com/tiddlers/testcases/DataWidget/ImportedFilter.tid create mode 100644 editions/tw5.com/tiddlers/testcases/DataWidget/ImportedTiddler.tid create mode 100644 editions/tw5.com/tiddlers/testcases/DataWidget/Refreshing.tid create mode 100644 editions/tw5.com/tiddlers/testcases/DataWidget/SimpleTiddler.tid create mode 100644 editions/tw5.com/tiddlers/testcases/TestCaseWidget/FailingTest.tid create mode 100644 editions/tw5.com/tiddlers/testcases/TestCaseWidget/currentTiddler.tid create mode 100644 editions/tw5.com/tiddlers/testcases/TranscludeWidget/SimpleTransclusion.tid create mode 100644 editions/tw5.com/tiddlers/widgets/DataWidget.tid create mode 100644 editions/tw5.com/tiddlers/widgets/TestCaseWidget.tid create mode 100644 plugins/tiddlywiki/innerwiki/anchor.js delete mode 100644 plugins/tiddlywiki/innerwiki/data.js diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index d8321edbf..93cfc3c10 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -206,6 +206,12 @@ Stylesheets/Caption: Stylesheets Stylesheets/Expand/Caption: Expand All Stylesheets/Hint: This is the rendered CSS of the current stylesheet tiddlers tagged with <> Stylesheets/Restore/Caption: Restore +TestCases/Caption: Test Cases +TestCases/Hint: Test cases are self contained examples for testing and learning +TestCases/All/Caption: All Test Cases +TestCases/All/Hint: All Test Cases +TestCases/Failed/Caption: Failed Test Cases +TestCases/Failed/Hint: Only Failed Test Cases Theme/Caption: Theme Theme/Prompt: Current theme: TiddlerFields/Caption: Tiddler Fields diff --git a/core/language/en-GB/Docs/PaletteColours.multids b/core/language/en-GB/Docs/PaletteColours.multids index 98addbf85..1c671a67c 100644 --- a/core/language/en-GB/Docs/PaletteColours.multids +++ b/core/language/en-GB/Docs/PaletteColours.multids @@ -65,6 +65,9 @@ sidebar-tab-foreground-selected: Sidebar tab foreground for selected tabs sidebar-tab-foreground: Sidebar tab foreground sidebar-tiddler-link-foreground-hover: Sidebar tiddler link foreground hover sidebar-tiddler-link-foreground: Sidebar tiddler link foreground +testcase-accent-level-1: Test case accent colour with no nesting +testcase-accent-level-2: Test case accent colour with 2nd level nesting +testcase-accent-level-3: Test case accent colour with 3rd level nesting or higher site-title-foreground: Site title foreground static-alert-foreground: Static alert foreground tab-background-selected: Tab background for selected tabs diff --git a/core/modules/widgets/data.js b/core/modules/widgets/data.js new file mode 100644 index 000000000..c46dd1fb8 --- /dev/null +++ b/core/modules/widgets/data.js @@ -0,0 +1,145 @@ +/*\ +title: $:/core/modules/widgets/data.js +type: application/javascript +module-type: widget + +Widget to dynamically represent one or more tiddlers + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var Widget = require("$:/core/modules/widgets/widget.js").widget; + +var DataWidget = function(parseTreeNode,options) { + this.dataWidgetTag = parseTreeNode.type; + this.initialise(parseTreeNode,options); +}; + +/* +Inherit from the base widget class +*/ +DataWidget.prototype = new Widget(); + +/* +Render this widget into the DOM +*/ +DataWidget.prototype.render = function(parent,nextSibling) { + this.parentDomNode = parent; + this.computeAttributes(); + this.execute(); + var jsonPayload = JSON.stringify(this.readDataTiddlerValues(),null,4); + var textNode = this.document.createTextNode(jsonPayload); + parent.insertBefore(textNode,nextSibling); + this.domNodes.push(textNode); +}; + +/* +Compute the internal state of the widget +*/ +DataWidget.prototype.execute = function() { + // Construct the child widgets + this.makeChildWidgets(); +}; + +/* +Read the tiddler value(s) from a data widget – must be called after the .render() method +*/ +DataWidget.prototype.readDataTiddlerValues = function() { + var self = this; + // Start with a blank object + var item = Object.create(null); + // Read any attributes not prefixed with $ + $tw.utils.each(this.attributes,function(value,name) { + if(name.charAt(0) !== "$") { + item[name] = value; + } + }); + item = new $tw.Tiddler(item); + // Deal with $tiddler, $filter or $compound-tiddler attributes + var tiddlers = [],title; + if(this.hasAttribute("$tiddler")) { + title = this.getAttribute("$tiddler"); + if(title) { + var tiddler = this.wiki.getTiddler(title); + if(tiddler) { + tiddlers.push(tiddler); + } + } + } + if(this.hasAttribute("$filter")) { + var filter = this.getAttribute("$filter"); + if(filter) { + var titles = this.wiki.filterTiddlers(filter); + $tw.utils.each(titles,function(title) { + var tiddler = self.wiki.getTiddler(title); + tiddlers.push(tiddler); + }); + } + } + if(this.hasAttribute("$compound-tiddler")) { + title = this.getAttribute("$compound-tiddler"); + if(title) { + tiddlers.push.apply(tiddlers,this.extractCompoundTiddler(title)); + } + } + // Convert the literal item to field strings + item = item.getFieldStrings(); + if(tiddlers.length === 0) { + if(Object.keys(item).length > 0 && !!item.title) { + return [item]; + } else { + return []; + } + } else { + var results = []; + $tw.utils.each(tiddlers,function(tiddler,index) { + var fields = tiddler.getFieldStrings(); + results.push($tw.utils.extend({},fields,item)); + }); + return results; + } +}; + +/* +Helper to extract tiddlers from text/vnd.tiddlywiki-multiple tiddlers +*/ +DataWidget.prototype.extractCompoundTiddler = function(title) { + var tiddler = this.wiki.getTiddler(title); + if(tiddler && tiddler.fields.type === "text/vnd.tiddlywiki-multiple") { + var text = tiddler.fields.text || "", + rawTiddlers = text.split(/\r?\n\+\r?\n/), + tiddlers = []; + $tw.utils.each(rawTiddlers,function(rawTiddler) { + var fields = Object.create(null), + split = rawTiddler.split(/\r?\n\r?\n/mg); + if(split.length >= 1) { + fields = $tw.utils.parseFields(split[0],fields); + } + if(split.length >= 2) { + fields.text = split.slice(1).join("\n\n"); + } + tiddlers.push(new $tw.Tiddler(fields)); + }); + return tiddlers; + } else { + return []; + } +}; + +/* +Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering +*/ +DataWidget.prototype.refresh = function(changedTiddlers) { + // It would be expensive to calculate whether the changedTiddlers impact the filter + // identified by the $filter attribute so we just refresh ourselves unconditionally + this.refreshSelf(); + return true; +}; + +exports.data = DataWidget; + +})(); diff --git a/core/modules/widgets/testcase.js b/core/modules/widgets/testcase.js new file mode 100644 index 000000000..abb8f03f6 --- /dev/null +++ b/core/modules/widgets/testcase.js @@ -0,0 +1,160 @@ +/*\ +title: $:/core/modules/widgets/testcase.js +type: application/javascript +module-type: widget + +Widget to display a test case + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +var Widget = require("$:/core/modules/widgets/widget.js").widget; + +var TestCaseWidget = function(parseTreeNode,options) { + this.initialise(parseTreeNode,options); +}; + +/* +Inherit from the base widget class +*/ +TestCaseWidget.prototype = new Widget(); + +/* +Render this widget into the DOM +*/ +TestCaseWidget.prototype.render = function(parent,nextSibling) { + var self = this; + this.parentDomNode = parent; + this.computeAttributes(); + this.execute(); + // Create container DOM node + var domNode = this.document.createElement("div"); + this.domNodes.push(domNode); + parent.insertBefore(domNode,nextSibling); + // Render the children into a hidden DOM node + var parser = { + tree: [{ + type: "widget", + attributes: {}, + orderedAttributes: [], + children: this.parseTreeNode.children || [] + }] + }; + this.contentRoot = this.wiki.makeWidget(parser,{ + document: $tw.fakeDocument, + parentWidget: this + }); + this.contentContainer = $tw.fakeDocument.createElement("div"); + this.contentRoot.render(this.contentContainer,null); + // Create a wiki + this.testcaseWiki = new $tw.Wiki(); + // Always load the core plugin + var loadTiddler = function(title) { + var tiddler = self.wiki.getTiddler(title); + if(tiddler) { + self.testcaseWiki.addTiddler(tiddler); + } + } + loadTiddler("$:/core"); + loadTiddler("$:/plugins/tiddlywiki/codemirror"); + // Load tiddlers from child data widgets + var tiddlers = []; + this.findChildrenDataWidgets(this.contentRoot.children,"data",function(widget) { + Array.prototype.push.apply(tiddlers,widget.readDataTiddlerValues()); + }); + var jsonPayload = JSON.stringify(tiddlers); + this.testcaseWiki.addTiddlers(tiddlers); + // Unpack plugin tiddlers + this.testcaseWiki.readPluginInfo(); + this.testcaseWiki.registerPluginTiddlers("plugin"); + this.testcaseWiki.unpackPluginTiddlers(); + this.testcaseWiki.addIndexersToWiki(); + // Generate a `transclusion` variable that depends on the values of the payload tiddlers so that the template can easily make unique state tiddlers + this.setVariable("transclusion",$tw.utils.hashString(jsonPayload)); + // Generate a `payloadTiddlers` variable that contains the payload in JSON format + this.setVariable("payloadTiddlers",jsonPayload); + // Render the test rendering if required + if(this.testcaseTestOutput && this.testcaseTestExpectedResult) { + var testcaseOutputContainer = $tw.fakeDocument.createElement("div"); + var testcaseOutputWidget = this.testcaseWiki.makeTranscludeWidget(this.testcaseTestOutput,{ + document: $tw.fakeDocument, + parseAsInline: false, + parentWidget: this, + variables: { + currentTiddler: this.testcaseTestOutput + } + }); + testcaseOutputWidget.render(testcaseOutputContainer); + } + // Clear changes queue + this.testcaseWiki.clearTiddlerEventQueue(); + // Run the actions if provided + if(this.testcaseWiki.tiddlerExists(this.testcaseTestActions)) { + testcaseOutputWidget.invokeActionString(this.testcaseWiki.getTiddlerText(this.testcaseTestActions)); + testcaseOutputWidget.refresh(this.testcaseWiki.changedTiddlers,testcaseOutputContainer); + } + // Set up the test result variables + var testResult = "", + outputHTML = "", + expectedHTML = ""; + if(this.testcaseTestOutput && this.testcaseTestExpectedResult) { + outputHTML = testcaseOutputContainer.children[0].innerHTML; + expectedHTML = this.testcaseWiki.getTiddlerText(this.testcaseTestExpectedResult); + if(outputHTML === expectedHTML) { + testResult = "pass"; + } else { + testResult = "fail"; + } + this.setVariable("outputHTML",outputHTML); + this.setVariable("expectedHTML",expectedHTML); + this.setVariable("testResult",testResult); + this.setVariable("currentTiddler",this.testcaseTestOutput); + } + // Don't display anything if testHideIfPass is "yes" and the tests have passed + if(this.testcaseHideIfPass === "yes" && testResult === "pass") { + return; + } + // Render the page root template of the subwiki + var rootWidget = this.testcaseWiki.makeTranscludeWidget(this.testcaseTemplate,{ + document: this.document, + parseAsInline: false, + parentWidget: this + }); + rootWidget.render(domNode); + // Trap changes in the wiki and refresh the rendering + this.testcaseWiki.addEventListener("change",function(changes) { + rootWidget.refresh(changes,domNode); + }); +}; + +/* +Compute the internal state of the widget +*/ +TestCaseWidget.prototype.execute = function() { + this.testcaseTemplate = this.getAttribute("template","$:/core/ui/testcases/DefaultTemplate"); + this.testcaseTestOutput = this.getAttribute("testOutput"); + this.testcaseTestActions = this.getAttribute("testActions"); + this.testcaseTestExpectedResult = this.getAttribute("testExpectedResult"); + this.testcaseHideIfPass = this.getAttribute("testHideIfPass"); +}; + +/* +Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering +*/ +TestCaseWidget.prototype.refresh = function(changedTiddlers) { + var changedAttributes = this.computeAttributes(); + if($tw.utils.count(changedAttributes) > 0) { + this.refreshSelf(); + return true; + } else { + return this.contentRoot.refresh(changedTiddlers); + } +}; + +exports["testcase"] = TestCaseWidget; + +})(); diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index ea300ca0e..69f63a684 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -813,6 +813,21 @@ Widget.prototype.allowActionPropagation = function() { return true; }; +/* +Find child <$data> widgets recursively. The tag name allows aliased versions of the widget to be found too +*/ +Widget.prototype.findChildrenDataWidgets = function(children,tag,callback) { + var self = this; + $tw.utils.each(children,function(child) { + if(child.dataWidgetTag === tag) { + callback(child); + } + if(child.children) { + self.findChildrenDataWidgets(child.children,tag,callback); + } + }); +}; + /* Evaluate a variable with parameters. This is a static convenience method that attempts to evaluate a variable as a function, returning an array of strings */ diff --git a/core/palettes/Vanilla.tid b/core/palettes/Vanilla.tid index 4c660e912..c7c800046 100644 --- a/core/palettes/Vanilla.tid +++ b/core/palettes/Vanilla.tid @@ -95,6 +95,9 @@ table-footer-background: #a8a8a8 table-header-background: #f0f0f0 tag-background: #ec6 tag-foreground: #ffffff +testcase-accent-level-1: #84C5E6 +testcase-accent-level-2: #E3B740 +testcase-accent-level-3: #5FD564 tiddler-background: <> tiddler-border: <> tiddler-controls-foreground-hover: #888888 diff --git a/core/ui/ControlPanel/TestCases.tid b/core/ui/ControlPanel/TestCases.tid new file mode 100644 index 000000000..401e14113 --- /dev/null +++ b/core/ui/ControlPanel/TestCases.tid @@ -0,0 +1,10 @@ +title: $:/core/ui/ControlPanel/TestCases +tags: $:/tags/ControlPanel/Advanced +caption: {{$:/language/ControlPanel/TestCases/Caption}} + +\whitespace trim +{{$:/language/ControlPanel/TestCases/Hint}} + +
+<$macrocall $name="tabs" tabsList="[all[shadows+tiddlers]tag[$:/tags/ControlPanel/TestCases]!has[draft.of]]" default="$:/core/ui/ControlPanel/TestCases/All"/> +
diff --git a/core/ui/ControlPanel/TestCasesAll.tid b/core/ui/ControlPanel/TestCasesAll.tid new file mode 100644 index 000000000..571fb93c2 --- /dev/null +++ b/core/ui/ControlPanel/TestCasesAll.tid @@ -0,0 +1,24 @@ +title: $:/core/ui/ControlPanel/TestCases/All +tags: $:/tags/ControlPanel/TestCases +caption: {{$:/language/ControlPanel/TestCases/All/Caption}} + +\define lingo-base() $:/language/ControlPanel/ +<> + +<$list filter="[all[tiddlers+shadows]tag[$:/tags/wiki-test-spec]type[text/vnd.tiddlywiki-multiple]] [all[tiddlers+shadows]tag[$:/tags/wiki-test-spec-failing]type[text/vnd.tiddlywiki-multiple]]"> + +

+ +<$link> + +<$text text=<>/> + + + +

+ +<$transclude + $tiddler="$:/core/ui/TestCaseTemplate" +/> + + diff --git a/core/ui/ControlPanel/TestCasesFailed.tid b/core/ui/ControlPanel/TestCasesFailed.tid new file mode 100644 index 000000000..4ab2d062d --- /dev/null +++ b/core/ui/ControlPanel/TestCasesFailed.tid @@ -0,0 +1,15 @@ +title: $:/core/ui/ControlPanel/TestCases/Failed +tags: $:/tags/ControlPanel/TestCases +caption: {{$:/language/ControlPanel/TestCases/Failed/Caption}} + +\define lingo-base() $:/language/ControlPanel/ +<> + +<$list filter="[all[tiddlers+shadows]tag[$:/tags/wiki-test-spec]type[text/vnd.tiddlywiki-multiple]] [all[tiddlers+shadows]tag[$:/tags/wiki-test-spec-failing]type[text/vnd.tiddlywiki-multiple]]"> + +<$transclude + $tiddler="$:/core/ui/TestCaseTemplate" + hideIfPass="yes" +/> + + diff --git a/core/ui/TestCaseTemplate.tid b/core/ui/TestCaseTemplate.tid new file mode 100644 index 000000000..74b6ab27d --- /dev/null +++ b/core/ui/TestCaseTemplate.tid @@ -0,0 +1,18 @@ +title: $:/core/ui/TestCaseTemplate + +\parameters (hideIfPass:"no") +\whitespace trim +<$let + linkTarget="yes" + displayFormat={{!!display-format}} +> + <$testcase + testOutput="Output" + testExpectedResult="ExpectedResult" + testActions="Actions" + testHideIfPass=<> + > + <$data $compound-tiddler=<>/> + <$data title="Description" text={{!!description}}/> + + diff --git a/core/ui/TestCases/DefaultTemplate.tid b/core/ui/TestCases/DefaultTemplate.tid new file mode 100644 index 000000000..679620969 --- /dev/null +++ b/core/ui/TestCases/DefaultTemplate.tid @@ -0,0 +1,64 @@ +title: $:/core/ui/testcases/DefaultTemplate + +\whitespace trim +\procedure linkcatcherActions() +<%if [has[title]] %> + <$qualify title=<> name="qualifiedState"> + <$action-setfield $tiddler=<> text=<>/> + +<%endif%> +\end + +<$let + state={{{ [] }}} +> +
+
+

+ <$genesis $type={{{ [!match[]then[$link]else[div]] }}}> + <%if [!match[]] %> + !match[fail]then[tc-test-case-result-icon-pass]] [match[fail]then[tc-test-case-result-icon-fail]] +[join[ ]] }}}> + <%if [!match[fail]] %> + {{$:/core/images/done-button}} + <%else%> + {{$:/core/images/close-button}} + <%endif%> + + <%endif%> + <$view tiddler="Description" mode="inline"/> + +

+
+ <%if [[Narrative]is[tiddler]] %> +
+ <$transclude $tiddler="Narrative" mode="block"/> +
+ <%endif%> + <%if [match[fail]] %> +
+
+ TEST FAILED +
+
+ <$diff-text source=<> dest=<>/> +
+
+ <%endif%> +
+
+ <$macrocall $name="tabs" tabsList="[all[tiddlers]sort[]] -[prefix] -Description -Narrative -ExpectedResult -Output Output +[putfirst[]] -[has[plugin-type]]" state=<> default="Output" template="$:/core/ui/testcases/DefaultTemplate/SourceTabs"/> +
+
+
+
+ <%if [!match[]else[wikitext]match[plaintext]] %> +
<$view tiddler="Output" format="plainwikified" mode="block"/>
+ <%else%> + <$linkcatcher actions=<>> + <$transclude $tiddler="Output" $mode="block"/> + + <%endif%> +
+
+
+ diff --git a/core/ui/TestCases/DefaultTemplateSourceTabs.tid b/core/ui/TestCases/DefaultTemplateSourceTabs.tid new file mode 100644 index 000000000..68c62c1f6 --- /dev/null +++ b/core/ui/TestCases/DefaultTemplateSourceTabs.tid @@ -0,0 +1,24 @@ +title: $:/core/ui/testcases/DefaultTemplate/SourceTabs + +\whitespace trim +\procedure body() +<$list filter="[fields[]] -text +[limit[1]]" variable="ignore"> + + + <$list filter="[fields[]sort[]] -text -title title +[putfirst[]]" variable="fieldName"> + + + + + + +
+ <$text text=<>/> + + <$view tiddler=<> field=<>/> +
+ +<$edit class="tc-edit-texteditor" tiddler=<>/> +\end + +<$transclude $variable="body" $mode="inline"/> diff --git a/core/ui/TestCases/RawJSONTemplate.tid b/core/ui/TestCases/RawJSONTemplate.tid new file mode 100644 index 000000000..fe9c583e8 --- /dev/null +++ b/core/ui/TestCases/RawJSONTemplate.tid @@ -0,0 +1,4 @@ +title: $:/core/ui/testcases/RawJSONTemplate + +\whitespace trim +<$text text=<>/> diff --git a/core/wiki/config/ViewTemplateBodyFilters.multids b/core/wiki/config/ViewTemplateBodyFilters.multids index ff9fe7250..e1dd62880 100644 --- a/core/wiki/config/ViewTemplateBodyFilters.multids +++ b/core/wiki/config/ViewTemplateBodyFilters.multids @@ -1,6 +1,7 @@ title: $:/config/ViewTemplateBodyFilters/ tags: $:/tags/ViewTemplateBodyFilter +testcase: [tag[$:/tags/wiki-test-spec]type[text/vnd.tiddlywiki-multiple]then[$:/core/ui/TestCaseTemplate]] [tag[$:/tags/wiki-test-spec-failing]type[text/vnd.tiddlywiki-multiple]then[$:/core/ui/TestCaseTemplate]] stylesheet: [tag[$:/tags/Stylesheet]then[$:/core/ui/ViewTemplate/body/rendered-plain-text]] core-ui-tags: [tag[$:/tags/PageTemplate]] [tag[$:/tags/EditTemplate]] [tag[$:/tags/ViewTemplate]] [tag[$:/tags/KeyboardShortcut]] [tag[$:/tags/ImportPreview]] [tag[$:/tags/EditPreview]][tag[$:/tags/EditorToolbar]] [tag[$:/tags/Actions]] :then[[$:/core/ui/ViewTemplate/body/code]] system: [prefix[$:/boot/]] [prefix[$:/config/]] [prefix[$:/core/macros]] [prefix[$:/core/save/]] [prefix[$:/core/templates/]] [prefix[$:/info/]] [prefix[$:/language/]] [prefix[$:/languages/]] [prefix[$:/snippets/]] [prefix[$:/state/]] [prefix[$:/status/]] [prefix[$:/info/]] [prefix[$:/temp/]] +[!is[image]limit[1]then[$:/core/ui/ViewTemplate/body/code]] diff --git a/core/wiki/macros/testcase.tid b/core/wiki/macros/testcase.tid new file mode 100644 index 000000000..a04cb540d --- /dev/null +++ b/core/wiki/macros/testcase.tid @@ -0,0 +1,10 @@ +title: $:/core/macros/testcase +tags: $:/tags/Macro $:/tags/Global + +\whitespace trim + +\procedure testcase(tiddler) +<$tiddler tiddler=<>> +<$transclude $tiddler="$:/core/ui/TestCaseTemplate"> + +\end diff --git a/core/wiki/tags/ViewTemplateBodyFilter.tid b/core/wiki/tags/ViewTemplateBodyFilter.tid index 7b9fb7fd8..0143c1f88 100644 --- a/core/wiki/tags/ViewTemplateBodyFilter.tid +++ b/core/wiki/tags/ViewTemplateBodyFilter.tid @@ -1,2 +1,2 @@ title: $:/tags/ViewTemplateBodyFilter -list: $:/config/ViewTemplateBodyFilters/hide-body $:/config/ViewTemplateBodyFilters/code-body $:/config/ViewTemplateBodyFilters/stylesheet $:/config/ViewTemplateBodyFilters/core-ui-advanced-search $:/config/ViewTemplateBodyFilters/core-ui-tags $:/config/ViewTemplateBodyFilters/system $:/config/ViewTemplateBodyFilters/import $:/config/ViewTemplateBodyFilters/plugin $:/config/ViewTemplateBodyFilters/default \ No newline at end of file +list: $:/config/ViewTemplateBodyFilters/testcase $:/config/ViewTemplateBodyFilters/hide-body $:/config/ViewTemplateBodyFilters/code-body $:/config/ViewTemplateBodyFilters/stylesheet $:/config/ViewTemplateBodyFilters/core-ui-advanced-search $:/config/ViewTemplateBodyFilters/core-ui-tags $:/config/ViewTemplateBodyFilters/system $:/config/ViewTemplateBodyFilters/import $:/config/ViewTemplateBodyFilters/plugin $:/config/ViewTemplateBodyFilters/default \ No newline at end of file diff --git a/editions/test/tiddlers/HelloThere.tid b/editions/test/tiddlers/HelloThere.tid index d41f45fe2..74ea616e5 100644 --- a/editions/test/tiddlers/HelloThere.tid +++ b/editions/test/tiddlers/HelloThere.tid @@ -3,3 +3,7 @@ title: HelloThere This is TiddlyWiki's browser-based test runner for version <>. See the bottom of this page for the test results. https://tiddlywiki.com/ + +! Test Cases + +{{$:/core/ui/ControlPanel/TestCases}} diff --git a/editions/test/tiddlers/tests/from-tw5.com/tiddlywiki.files b/editions/test/tiddlers/tests/from-tw5.com/tiddlywiki.files new file mode 100644 index 000000000..c8ce1656e --- /dev/null +++ b/editions/test/tiddlers/tests/from-tw5.com/tiddlywiki.files @@ -0,0 +1,5 @@ +{ + "directories": [ + "../../../../tw5.com/tiddlers/testcases" + ] +} \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/concepts/CompoundTiddlers.tid b/editions/tw5.com/tiddlers/concepts/CompoundTiddlers.tid new file mode 100644 index 000000000..c4a049a6a --- /dev/null +++ b/editions/tw5.com/tiddlers/concepts/CompoundTiddlers.tid @@ -0,0 +1,31 @@ +title: CompoundTiddlers +modified: 20240507221902644 +created: 20240507221902644 +tags: Concepts + +Compound tiddlers are a special type of tiddler that can store one or more payload tiddlers. The tiddlers within a compound tiddler are only accessible via special operations, typically with the TestCaseWidget. + +The compound tiddler format is extremely simple, and includes the notable flaw that it does not permit tiddlers that contain a plus sign (`+`) on a line by itself. It is not intended as a general purpose way of storing tiddler data. + +Compound tiddlers are identified by having their type field set to `text/vnd.tiddlywiki-multiple`. + +The content of a compound tiddler consists of a sequence of tiddlers separated by a plus sign (`+`) on a line by itself. Each tiddler uses the same format as [[.tid files|TiddlerFiles]]. + +For example: + +``` +title: First +tags: one two + +This is the first tiddler ++ +title: Second +tags: three four + +This is the second tiddler ++ +title: third +tags: five six + +This is the third tiddler +``` diff --git a/editions/tw5.com/tiddlers/concepts/TestCaseTiddlers.tid b/editions/tw5.com/tiddlers/concepts/TestCaseTiddlers.tid new file mode 100644 index 000000000..ff84d6800 --- /dev/null +++ b/editions/tw5.com/tiddlers/concepts/TestCaseTiddlers.tid @@ -0,0 +1,27 @@ +title: TestCaseTiddlers +modified: 20240507221902644 +created: 20240507221902644 +tags: Concepts + +Test case tiddlers encapsulate one or more tiddlers that can be displayed as a [[test case|TestCaseWidget]]: an independent embedded wiki that can be used for testing or learning purposes. + +Test case tiddlers are formatted as CompoundTiddlers, allowing them to contain multiple tiddlers packed into one. + +Test case tiddlers have the following fields: + +|!Field |!Description | +|<<.field type>> | Should be set to `text/vnd.tiddlywiki-multiple` | +|<<.field tags>> | Test cases are tagged [[$:/tags/wiki-test-spec]]. Test cases that intentionally fail are tagged [[$:/tags/wiki-test-spec-failing]] | +|<<.field description>> |Descriptive heading for the test, intended to make it easy to identify the test | +|<<.field display-format>> |Optional, defaults to `wikitext`. Set to `plaintext` to cause the output to be rended as plain text | + +Test case tiddlers with the appropriate tag are shown in $:/ControlPanel + +Some payload tiddlers are set aside for special purposes: + +|!Tiddler |!Description | +|''Narrative'' |Narrative description of the test, intended to explain the purpose and operation of the test | +|''Output'' |The tiddler that produces the test output | +|''~ExpectedResult'' |HTML of expected result of rendering the ''Output'' tiddler | + + diff --git a/editions/tw5.com/tiddlers/hellothere/HelloThere.tid b/editions/tw5.com/tiddlers/hellothere/HelloThere.tid index 91ee04e2f..956deec8c 100644 --- a/editions/tw5.com/tiddlers/hellothere/HelloThere.tid +++ b/editions/tw5.com/tiddlers/hellothere/HelloThere.tid @@ -5,7 +5,7 @@ tags: TableOfContents title: HelloThere type: text/vnd.tiddlywiki - !!.tc-hero-heading ''Welcome to TiddlyWiki, a unique [[non-linear|Philosophy of Tiddlers]] notebook for [[capturing|Creating and editing tiddlers]], [[organising|Structuring TiddlyWiki]] and [[sharing|Sharing your tiddlers with others]] complex information'' +!!.tc-hero-heading ''Welcome to TiddlyWiki, a unique [[non-linear|Philosophy of Tiddlers]] notebook for [[capturing|Creating and editing tiddlers]], [[organising|Structuring TiddlyWiki]] and [[sharing|Sharing your tiddlers with others]] complex information'' Use it to keep your [[to-do list|TaskManagementExample]], to plan an [[essay or novel|"TiddlyWiki for Scholars" by Alberto Molina]], or to organise your wedding. Record every thought that crosses your brain, or build a flexible and responsive website. diff --git a/editions/tw5.com/tiddlers/testcases/DataWidget/ImportCompound.tid b/editions/tw5.com/tiddlers/testcases/DataWidget/ImportCompound.tid new file mode 100644 index 000000000..20e967316 --- /dev/null +++ b/editions/tw5.com/tiddlers/testcases/DataWidget/ImportCompound.tid @@ -0,0 +1,33 @@ +title: TestCases/DataWidget/ImportCompound +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] +description: Importing a compound payload tiddler and adding custom fields +display-format: plaintext + +title: Narrative + +Using the data widget to import a tiddler stored in a compound tiddler ++ +title: Output + +<$data $compound-tiddler="Compound" custom="Alpha"/> ++ +title: Compound +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Payload Tiddler +tags: Alpha Beta Gamma + +This is a payload tiddler from a compound tiddler ++ +title: ExpectedResult + +

[ + { + "title": "Payload Tiddler", + "tags": "Alpha Beta Gamma", + "text": "This is a payload tiddler from a compound tiddler", + "custom": "Alpha" + } +]

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/testcases/DataWidget/ImportedFilter.tid b/editions/tw5.com/tiddlers/testcases/DataWidget/ImportedFilter.tid new file mode 100644 index 000000000..3e7416fe3 --- /dev/null +++ b/editions/tw5.com/tiddlers/testcases/DataWidget/ImportedFilter.tid @@ -0,0 +1,49 @@ +title: TestCases/DataWidget/ImportedFilter +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] +description: Imported filter definition +display-format: plaintext + +title: Narrative + +Using the data widget to create copies of all the tiddlers with the title prefix "Day: T", adding the field "custom" set to "Beta" ++ +title: Output + +<$data $filter="[prefix[Day: T]]" custom="Beta"/> ++ +title: Day: Monday +text: Today is Monday ++ +title: Day: Tuesday +text: Today is Tuesday ++ +title: Day: Wednesday +text: Today is Wednesday ++ +title: Day: Thursday +text: Today is Thursday ++ +title: Day: Friday +text: Today is Friday ++ +title: Day: Saturday +text: Today is Saturday ++ +title: Day: Sunday +text: Today is Sunday ++ +title: ExpectedResult + +

[ + { + "title": "Day: Thursday", + "text": "Today is Thursday", + "custom": "Beta" + }, + { + "title": "Day: Tuesday", + "text": "Today is Tuesday", + "custom": "Beta" + } +]

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/testcases/DataWidget/ImportedTiddler.tid b/editions/tw5.com/tiddlers/testcases/DataWidget/ImportedTiddler.tid new file mode 100644 index 000000000..02b89726c --- /dev/null +++ b/editions/tw5.com/tiddlers/testcases/DataWidget/ImportedTiddler.tid @@ -0,0 +1,29 @@ +title: TestCases/DataWidget/ImportedTiddler +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] +description: Imported tiddler definition +display-format: plaintext + +title: Narrative + +Using the data widget to create a tiddler that is a copy of the tiddler "Hello" with the addition of the field "custom" set to "Alpha" ++ +title: Output + +<$data $tiddler="Hello" custom="Alpha"/> ++ +title: Hello +modifier: JoeBloggs + +This is the Hello tiddler ++ +title: ExpectedResult + +

[ + { + "title": "Hello", + "modifier": "JoeBloggs", + "text": "This is the Hello tiddler", + "custom": "Alpha" + } +]

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/testcases/DataWidget/Refreshing.tid b/editions/tw5.com/tiddlers/testcases/DataWidget/Refreshing.tid new file mode 100644 index 000000000..92fc32090 --- /dev/null +++ b/editions/tw5.com/tiddlers/testcases/DataWidget/Refreshing.tid @@ -0,0 +1,30 @@ +title: TestCases/DataWidget/Refreshing +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] +description: Refreshing the data widget +display-format: plaintext + +title: Narrative + +Verifying that the JSON output of the data widget is correctly refreshed when the data changes ++ +title: Output + +<$data title="Epsilon" text={{Subject}}/> ++ +title: Subject + +Nothing ++ +title: Actions + +<$action-setfield $tiddler="Subject" text="Theta"/> ++ +title: ExpectedResult + +

[ + { + "title": "Epsilon", + "text": "Theta" + } +]

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/testcases/DataWidget/SimpleTiddler.tid b/editions/tw5.com/tiddlers/testcases/DataWidget/SimpleTiddler.tid new file mode 100644 index 000000000..633ecb0b8 --- /dev/null +++ b/editions/tw5.com/tiddlers/testcases/DataWidget/SimpleTiddler.tid @@ -0,0 +1,22 @@ +title: TestCases/DataWidget/SimpleTiddler +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] +description: Simple tiddler definition +display-format: plaintext + +title: Narrative + +Using the data widget to create a tiddler with the title "Epsilon" and the text "Theta" ++ +title: Output + +<$data title="Epsilon" text="Theta"/> ++ +title: ExpectedResult + +

[ + { + "title": "Epsilon", + "text": "Theta" + } +]

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/testcases/TestCaseWidget/FailingTest.tid b/editions/tw5.com/tiddlers/testcases/TestCaseWidget/FailingTest.tid new file mode 100644 index 000000000..bd9126e03 --- /dev/null +++ b/editions/tw5.com/tiddlers/testcases/TestCaseWidget/FailingTest.tid @@ -0,0 +1,15 @@ +title: TestCases/TestCaseWidget/FailingTest +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec-failing]] +description: An example of a failing test + +title: Narrative + +This test case intentionally fails to show how failures are displayed. ++ +title: Output + +The sum is <$text text={{{ [[2]add[2]] }}}/>. ++ +title: ExpectedResult +text:

The sum is not 8.

diff --git a/editions/tw5.com/tiddlers/testcases/TestCaseWidget/currentTiddler.tid b/editions/tw5.com/tiddlers/testcases/TestCaseWidget/currentTiddler.tid new file mode 100644 index 000000000..824a2b17f --- /dev/null +++ b/editions/tw5.com/tiddlers/testcases/TestCaseWidget/currentTiddler.tid @@ -0,0 +1,16 @@ +description: currentTiddler should be properly set +tags: $:/tags/wiki-test-spec +title: TestCases/TestCaseTiddler/currentTiddler +type: text/vnd.tiddlywiki-multiple + +title: Narrative + +currentTiddler variable in Output tiddler should be "Output" ++ +title: Output + +<$text text=<>> ++ +title: ExpectedResult + +

Output

\ No newline at end of file diff --git a/editions/tw5.com/tiddlers/testcases/TranscludeWidget/SimpleTransclusion.tid b/editions/tw5.com/tiddlers/testcases/TranscludeWidget/SimpleTransclusion.tid new file mode 100644 index 000000000..e7ef05e6d --- /dev/null +++ b/editions/tw5.com/tiddlers/testcases/TranscludeWidget/SimpleTransclusion.tid @@ -0,0 +1,23 @@ +title: TestCases/TranscludeWidget/SimpleTransclusion +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] +description: Simple transclusion + +title: Narrative + +This test case demonstrates transclusion of and links to other tiddlers. ++ +title: Output + +Good morning, my [[name|Name]] is {{Name}} and I [[live in|Address]] {{Address}} ++ +title: Name + +Robert Rabbit ++ +title: Address + +14 Carrot Street, Vegetabletown ++ +title: ExpectedResult +text:

Good morning, my name is Robert Rabbit and I live in 14 Carrot Street, Vegetabletown

diff --git a/editions/tw5.com/tiddlers/widgets/DataWidget.tid b/editions/tw5.com/tiddlers/widgets/DataWidget.tid new file mode 100644 index 000000000..8aaf1efaf --- /dev/null +++ b/editions/tw5.com/tiddlers/widgets/DataWidget.tid @@ -0,0 +1,42 @@ +caption: data +created: 20240507221902644 +modified: 20240507221902644 +tags: Widgets +title: DataWidget +type: text/vnd.tiddlywiki + +! Introduction + +The data widget is used with the <<.wlink TestCaseWidget>> widget and the [[Innerwiki Plugin]] to specify payload tiddlers that are to be included in the test case or innerwiki. + +! Content and Attributes + +The content of the data widget is ignored. It supports the following attributes: + +|!Attribute |!Description | +|<<.attr $tiddler>> |Optional title of a tiddler to be used as a payload tiddler (optional) | +|<<.attr $filter>> |Optional filter string identifying tiddlers to be used as payload tiddlers (optional) | +|<<.attr $compound-tiddler>> |Optional title of a tiddler containing payload tiddlers in `text/vnd.tiddlywiki-multiple` format (see below) | +|//any attribute
not starting
with $// |Field values to be assigned to the payload tiddler(s) | + +The data widget is not rendered when used within the <<.wlink TestCaseWidget>> widget or the [[Innerwiki Plugin]] but for ease of testing, when used elsewhere it renders a JSON representation of the payload tiddlers. + +Without any of the attributes <<.attr $tiddler>>, <<.attr $filter>> or <<.attr $compound-tiddler>>, any attributes whose name does not start with $ are used as the field values for creating a single new tiddler. + +<> + +If any of the attributes <<.attr $tiddler>>, <<.attr $filter>> or <<.attr $compound-tiddler>> are specified then they are used to generate base tiddlers that are then modified with the addition of fields derived from any attributes whose name does not start with $. + +The attribute <<.attr $tiddler>> is used to ingest a single tiddler from the wiki containing the data widget: + +<> + +The attribute <<.attr $filter>> is used to ingest multiple tiddlers from the wiki containing the data widget: + +<> + +! Compound Tiddlers + +[[Compound tiddlers|CompoundTiddlers]] provide a way to easily create multiple tiddlers from within a single tiddler. They are contained in tiddlers of type `text/vnd.tiddlywiki-multiple`. The text field consists of a series of tiddlers in the same format as `.tid` files, each separated by a line containing a single `+` character. + +<> diff --git a/editions/tw5.com/tiddlers/widgets/TestCaseWidget.tid b/editions/tw5.com/tiddlers/widgets/TestCaseWidget.tid new file mode 100644 index 000000000..a73403890 --- /dev/null +++ b/editions/tw5.com/tiddlers/widgets/TestCaseWidget.tid @@ -0,0 +1,101 @@ +caption: testcase +created: 20240507221902644 +modified: 20240507221902644 +tags: Widgets +title: TestCaseWidget +type: text/vnd.tiddlywiki + +! Introduction + +The <<.wid testcase>> widget is designed to present interactive example test cases that are useful for learning and testing. It functions by creating an independent subwiki loaded with the specified payload tiddlers and then rendering a specified template from within the subwiki. The <<.wid testcase>> widget can optionally also be used to run and verify test results within the subwiki. + +This makes it possible to run independent tests that also serve as documentation examples. + +The <<.wid testcase>> widget can be used directly as documented below, but it is generally easier to create [[TestCaseTiddlers]]. These are special CompoundTiddlers that can contain multiple payload tiddlers making up a test case. + +!! Features + +Here is an example of a test case showing the default split view with the source tiddlers on the left and the tiddler titled `Output` rendered on the right. + +<> + +Notice also that clicking on links within the output pane will switch to the tab containing that tiddler. + +The text of the payload tiddlers listed on the left are editable, with the results being immediately reflected in the preview pane on the right. However, if the <<.wid testcase>> widget is refreshed then the modifications are lost. + +The green tick at the top left of a test case indicates that a test has been set up and that it passes. + +If the test fails, a red cross is shown, and there is a display of the differences between the actual results and the expected results: + +<> + +! Limitations + +The <<.wid testcase>> widget creates a lightweight TiddlyWiki environment that is a parasite of the main wiki. Because it is not a full, independent TiddlyWiki environment, there are some important limitations: + +* Output is rendered into a DIV, and so cannot be styled independently of the host wiki +* Any changes to the wiki made interactively by the user are volatile, and are lost when the <<.wid testcase>> widget is refreshed +* Startup actions are not supported +* Only plugins available in the host wiki can be included in the test case + +If these limitations are a problem, the [[Innerwiki Plugin]] offers the ability to embed a fully independent subwiki via an `