1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-01-23 19:34:39 +00:00

Compare commits

..

87 Commits

Author SHA1 Message Date
Jeremy Ruston
09193d49c4 Force a rebuild
I don't have time right now to resolve the merge conflicts with master
2025-09-17 14:06:58 +01:00
Jeremy Ruston
356e8e2f23 Fix failing test 2025-05-08 18:08:34 +01:00
Jeremy Ruston
26d9d9fb62 Fix jittery scrolling on lists 2025-05-08 18:05:21 +01:00
Jeremy Ruston
c0d9c4f9ec Make the paginated list more reusable 2025-05-08 18:05:08 +01:00
Jeremy Ruston
4351a3d906 Add timing information to filter traces 2025-05-08 15:32:45 +01:00
Jeremy Ruston
728243a66a Add global setting to enable filter observation 2025-05-07 20:49:57 +01:00
Jeremy Ruston
3f733796e5 Include shortcut prefix in traces 2025-05-07 20:49:28 +01:00
Jeremy Ruston
8711726ecd Useful to give the start method access to the widget 2025-05-02 10:29:53 +01:00
Jeremy Ruston
6eddffd7c5 Enable wikitext tests 2025-05-02 10:12:04 +01:00
Jeremy Ruston
29a5a1c571 Merge branch 'master' into filter-inspection 2025-04-30 17:02:26 +01:00
Jeremy Ruston
69f149efef Merge branch 'tiddlywiki-com' 2025-04-29 21:03:58 +01:00
Jeremy Ruston
4060f762e0 Cherry pick 1519ff638d from master 2025-04-29 14:01:43 +01:00
Jeremy Ruston
83da90d4cd Remove unneeded input boxes 2025-04-29 12:40:07 +01:00
Jeremy Ruston
6b2b1df9ad Consolidate identical adjacent lists
Makes things much clearer, but still some formatting and CSS improvements needed
2025-04-29 12:31:14 +01:00
Jeremy Ruston
d995e1a87d Fix tricky bug with a dodgy closure 2025-04-29 10:32:25 +01:00
Jeremy Ruston
60165678e4 Fix scrolling of observations 2025-04-29 09:03:58 +01:00
MatthewSalmon
1519ff638d Update JavaScript Macros.tid (#9037)
Removed "tt" in cannot
2025-04-27 21:43:41 +01:00
MatthewSalmon
271b8f9e0d Update cla-individual.md (#9039)
Signing the CLA with GitHub handle
2025-04-27 09:24:16 +01:00
Jeremy Ruston
0b03e79339 New UI for observing filters 2025-04-25 17:40:25 +01:00
Jeremy Ruston
93546c5511 Get rid of reveal widget 2025-04-25 14:50:09 +01:00
Jeremy Ruston
e2e14db1f0 Better example filter 2025-04-25 14:36:04 +01:00
Jeremy Ruston
6c59263070 Typo 2025-04-25 14:35:43 +01:00
Jeremy Ruston
628a2a45e6 Make variable usage a bit more logical 2025-04-25 14:34:01 +01:00
Jeremy Ruston
51d79fc5ac Make build-site script more configurable to avoid Netlify timeouts 2025-04-25 14:19:30 +01:00
Jeremy Ruston
b4e48bb2b1 Full width buttons are easier to click 2025-04-21 12:26:56 +01:00
Jeremy Ruston
210311eccf Placeholder for advanced search edit box 2025-04-21 11:42:34 +01:00
Jeremy Ruston
2f767cdb28 Docs update 2025-04-21 11:42:18 +01:00
Leilei332
65afdacdfe Remove links in field descriptions (#9036) 2025-04-20 19:44:39 +01:00
Jeremy Ruston
0a0838e753 Merge branch 'master' into filter-inspection 2025-04-16 14:31:11 +01:00
Jeremy Ruston
c409d8414e Fix bug exposed by #9030
I think the bug was originally introduced in a9f9ffd409
2025-04-14 22:17:18 +01:00
Rob Hoelz
866e55954f Stringify derived fields for tiddlywiki.files (#9025)
Otherwise, when serializing the tiddlers as JSON when loading plugins,
derived values may end up with the incorrect values.

Take the `modified` field for example - without stringification, it ends
up as something like `new Date(2025, 3, 12, 6, 56, 23)`, which then gets
serialized as `"2025-04-12T11:56:23.000Z"` (in my timezone), rather than
`"20250412115623000"`.  The string `"2025-04-12T11:56:23.000Z"` trips up
TiddlyWiki's date parser upon load, and it gets parsed as
`20250101000000000` instead.

Fixes GH #9021
2025-04-14 18:33:18 +01:00
Mario Pietsch
1e2ce0bc80 Remove function wrapper from development documentation. (#9027) 2025-04-14 18:29:33 +01:00
Mario Pietsch
fbeb8cddc8 Remove function wrappers from core/modules (#9028) 2025-04-14 18:29:08 +01:00
Mario Pietsch
73e70e77c1 Remove function wrappers from test editions (#9029) 2025-04-14 18:28:43 +01:00
Mario Pietsch
4e28742aa6 Remove function wrappers from plugins (#9030) 2025-04-14 18:28:04 +01:00
Jeremy Ruston
66196d5c2b More docs tweaks 2025-04-14 16:25:56 +01:00
Jeremy Ruston
483522ea09 Docs tweaks 2025-04-14 15:44:30 +01:00
Jeremy Ruston
3801e2536c Reorganise tiddlers
Some of the titles were not consistent
2025-04-14 10:58:40 +01:00
Jeremy Ruston
77aec1f8f8 Merge branch 'master' into filter-inspection 2025-04-13 17:56:33 +01:00
yaisog
5f551ca46f Change configTiddlerFilter for keyboard-driven-input (#9032) 2025-04-13 17:53:12 +01:00
Jeremy Ruston
df529d7d7b Fix RSOD on invalid filter expressions 2025-04-13 17:51:39 +01:00
Leilei332
34cf59d31e Fix some download file types. (#9026) 2025-04-12 15:32:10 +01:00
Jeremy Ruston
8dbb41ba2a Startings of a UI for inspectable filters 2025-04-11 15:42:54 +01:00
Jeremy Ruston
b632b75f70 Fix default tab 2025-04-11 14:43:44 +01:00
Jeremy Ruston
ef92b899ed Add remote inspection of preconfigured filters
There is no user interface yet, and it is currently hardcoded to inspect the filter "[all[shadows+tiddlers]tag[$:/tags/ViewTemplate]!is[draft]]" which is used in tiddler rendering. You can see the results in the sidebar More -> System starting with "$:/temp/filter-inspection/"
2025-04-11 13:33:09 +01:00
Jeremy Ruston
dcb8fa2f86 Only display advanced search tabs if there are more than one 2025-04-10 14:11:55 +01:00
Jeremy Ruston
c5894c64b9 Missed some styles from refactoring 2025-04-10 14:11:39 +01:00
Jeremy Ruston
04ad642be7 Refactor most of this PR into the "Internals" plugin 2025-04-09 22:01:43 +01:00
Jeremy Ruston
c8f17511f9 Improve positioning of the list "more" button 2025-04-07 18:51:31 +01:00
Jeremy Ruston
845b4ba3b5 Rename test 2025-04-07 18:41:40 +01:00
Jeremy Ruston
de2cc8637a Merge branch 'tiddlywiki-com' 2025-04-07 17:44:50 +01:00
Jeremy Ruston
8ea00a05d3 Docs update 2025-04-07 17:31:13 +01:00
Jeremy Ruston
28698690b3 Use scrollable widget to maintain scroll position 2025-04-07 16:35:26 +01:00
Jeremy Ruston
3c6ec3f9bb Include separate entries for each evaluation of a run 2025-04-07 16:13:18 +01:00
Jeremy Ruston
3a2c81192e Docs for the inspect-filter macro 2025-04-07 10:42:37 +01:00
Jeremy Ruston
d29199ffa8 Fix failing test 2025-04-06 22:13:47 +01:00
Jeremy Ruston
e741816a70 Use parse tree to render source text of filter 2025-04-06 22:06:58 +01:00
Jeremy Ruston
f315567924 Update MultiWikiServer tiddler 2025-04-06 15:22:25 +01:00
Jeremy Ruston
002c319518 Remove unnecessary text 2025-04-04 10:09:32 +01:00
Jeremy Ruston
33964d460d Add expand/collapse buttons to lists 2025-04-04 10:07:08 +01:00
Jeremy Ruston
9b3e61ef10 Avoid scrolling filter heading 2025-04-03 22:09:28 +01:00
Jeremy Ruston
967e882040 Truncate lists with an "expand" button 2025-04-03 22:03:43 +01:00
Jeremy Ruston
06dfe365be Better docs example 2025-04-03 22:03:12 +01:00
Jeremy Ruston
3e1286013f Fix bug with operators that return an iterator 2025-04-03 21:46:36 +01:00
Jeremy Ruston
1972e8b5f3 Stripy backgrounds for lists 2025-04-03 21:22:33 +01:00
Jeremy Ruston
3cb6712ccb Minimum width for lists 2025-04-03 21:22:18 +01:00
Jeremy Ruston
8b3fbe3134 Fix typo 2025-04-03 14:35:37 +01:00
Jeremy Ruston
f6b39d1a40 Add horizontal presentation 2025-04-03 09:26:07 +01:00
Jeremy Ruston
1e10496fd6 Introduce filter visualisation 2025-04-02 22:05:43 +01:00
Jeremy Ruston
5226ca1f75 Comment out logging 2025-04-02 22:04:59 +01:00
Jeremy Ruston
037b4aa227 Add filter output list to JSON 2025-04-02 18:01:15 +01:00
Jeremy Ruston
ddeb4fd6e6 Fix filter output 2025-04-02 08:56:28 +01:00
Jeremy Ruston
8ff0cb8650 Fix typo 2025-04-01 17:53:53 +01:00
Jeremy Ruston
27075acbc6 Add "inspect" tab to advanced search and make the search box into a textarea 2025-04-01 12:43:13 +01:00
Jeremy Ruston
d4043fc1f4 Add inspect operator 2025-04-01 12:06:10 +01:00
Mario Pietsch
8bda28afd5 Fix typo (#8994) 2025-03-27 17:22:56 +00:00
Mario Pietsch
48fa2be6ac [DOCS] Add HTML Tag info to reveal-widget (#8941) 2025-03-22 20:37:15 +00:00
bobjtls
1b605f0b87 Docs: Addition of example for ActionSetField widget (#8986) 2025-03-22 11:35:56 +00:00
bobjtls
40d53543dc Signing CLA (#8985) 2025-03-22 11:35:15 +00:00
Leilei332
961e74f73d Remove .eslintrc.json (#8987) 2025-03-22 11:32:00 +00:00
Abdullah Ibrahim
4e6a2ffd60 Signing CLA (#8982) 2025-03-17 18:27:54 +00:00
Leilei332
f6a60f51d2 Fix error in geospatial edition tiddlywiki.info file (#8977) 2025-03-17 16:15:28 +00:00
Abdullah Ibrahim
897b14a8d6 Signing CLA (#8983) 2025-03-17 15:51:40 +00:00
Leilei332
c5b465ec99 Make plugin editions use external core (#8952)
* Make some editions use external core

* Revert tw5.com-docs use external js

* Revert "Revert tw5.com-docs use external js"

This reverts commit 93f36cb0af.
2025-03-10 17:28:55 +00:00
Mario Pietsch
9c0fff268c [DOCS] make Filter Operators initial filter run assumption more visible (#8969) 2025-03-03 18:00:39 +00:00
Leilei332
81d8d67800 Update docs for plugin versions (#8968)
* Update docs for plugin versions

Update docs for share plugin.

Add docs for Tour and Geospatial plugin.

* Do not change modified field for some tiddlers
2025-03-03 17:59:23 +00:00
Leilei332
378b9b3627 Allow building external core version of main site (#8953) 2025-02-27 11:00:58 +00:00
103 changed files with 1324 additions and 974 deletions

View File

@@ -1,317 +0,0 @@
{
"env": {
"browser": true,
"commonjs": true,
"node": true
},
"extends": [
"eslint:recommended"
],
"globals": {
"$tw": "writable"
},
"parserOptions": {
"ecmaVersion": 5
},
"plugins": [],
"rules": {
"array-bracket-newline": "off",
"array-bracket-spacing": "off",
"array-callback-return": "off",
"array-element-newline": "off",
"arrow-body-style": "error",
"arrow-parens": [
"error",
"as-needed"
],
"arrow-spacing": [
"error",
{
"after": true,
"before": true
}
],
"block-scoped-var": "off",
"block-spacing": "off",
"brace-style": "off",
"callback-return": "off",
"camelcase": "off",
"capitalized-comments": "off",
"class-methods-use-this": "error",
"comma-dangle": "off",
"comma-spacing": "off",
"comma-style": "off",
"complexity": "off",
"computed-property-spacing": "off",
"consistent-return": "off",
"consistent-this": "off",
"curly": "off",
"default-case": "off",
"default-case-last": "error",
"default-param-last": "error",
"dot-location": "off",
"dot-notation": "off",
"eol-last": "off",
"eqeqeq": "off",
"func-call-spacing": "off",
"func-name-matching": "off",
"func-names": "off",
"func-style": "off",
"function-call-argument-newline": "off",
"function-paren-newline": "off",
"generator-star-spacing": "error",
"global-require": "off",
"grouped-accessor-pairs": "error",
"guard-for-in": "off",
"handle-callback-err": "off",
"id-blacklist": "error",
"id-denylist": "error",
"id-length": "off",
"id-match": "error",
"implicit-arrow-linebreak": "error",
"indent": "off",
"indent-legacy": "off",
"init-declarations": "off",
"jsx-quotes": "error",
"key-spacing": "off",
"keyword-spacing": [
"error",
{
"before": true,
"after": false,
"overrides": {
"case": {
"after": true
},
"do": {
"after": true
},
"else": {
"after": true
},
"return": {
"after": true
},
"throw": {
"after": true
},
"try": {
"after": true
},
"catch": {
"after": true
}
}
}
],
"line-comment-position": "off",
"linebreak-style": "off",
"lines-around-comment": "off",
"lines-around-directive": "off",
"lines-between-class-members": "error",
"max-classes-per-file": "error",
"max-depth": "off",
"max-len": "off",
"max-lines": "off",
"max-lines-per-function": "off",
"max-nested-callbacks": "error",
"max-params": "off",
"max-statements": "off",
"max-statements-per-line": "off",
"multiline-comment-style": "off",
"multiline-ternary": "off",
"new-parens": "off",
"newline-after-var": "off",
"newline-before-return": "off",
"newline-per-chained-call": "off",
"no-alert": "off",
"no-array-constructor": "off",
"no-await-in-loop": "error",
"no-bitwise": "off",
"no-buffer-constructor": "off",
"no-caller": "error",
"no-catch-shadow": "off",
"no-confusing-arrow": "error",
"no-console": "off",
"no-constant-condition": [
"error",
{
"checkLoops": false
}
],
"no-constructor-return": "error",
"no-continue": "off",
"no-div-regex": "off",
"no-duplicate-imports": "error",
"no-else-return": "off",
"no-empty-function": "off",
"no-eq-null": "off",
"no-eval": "off",
"no-extend-native": "off",
"no-extra-bind": "off",
"no-extra-label": "off",
"no-extra-parens": "off",
"no-floating-decimal": "off",
"no-implicit-coercion": [
"error",
{
"boolean": false,
"number": false,
"string": false
}
],
"no-implicit-globals": "off",
"no-implied-eval": "error",
"no-inline-comments": "off",
"no-invalid-this": "off",
"no-iterator": "error",
"no-label-var": "off",
"no-labels": "off",
"no-lone-blocks": "off",
"no-lonely-if": "off",
"no-loop-func": "off",
"no-loss-of-precision": "error",
"no-magic-numbers": "off",
"no-mixed-operators": "off",
"no-mixed-requires": "off",
"no-multi-assign": "off",
"no-multi-spaces": "off",
"no-multi-str": "error",
"no-multiple-empty-lines": ["warn", { "max": 4, "maxEOF": 0 }],
"no-native-reassign": "off",
"no-negated-condition": "off",
"no-negated-in-lhs": "error",
"no-nested-ternary": "off",
"no-new": "off",
"no-new-func": "off",
"no-new-object": "off",
"no-new-require": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-param-reassign": "off",
"no-path-concat": "error",
"no-plusplus": "off",
"no-process-env": "off",
"no-process-exit": "off",
"no-promise-executor-return": "error",
"no-proto": "off",
"no-restricted-exports": "error",
"no-restricted-globals": "error",
"no-restricted-imports": "error",
"no-restricted-modules": "error",
"no-restricted-properties": "error",
"no-restricted-syntax": "error",
"no-return-assign": "off",
"no-return-await": "error",
"no-script-url": "off",
"no-self-compare": "off",
"no-sequences": "off",
"no-shadow": "off",
"no-spaced-func": "off",
"no-sync": "off",
"no-tabs": "off",
"no-template-curly-in-string": "error",
"no-ternary": "off",
"no-throw-literal": "off",
"no-trailing-spaces": "error",
"no-undef-init": "off",
"no-undefined": "off",
"no-underscore-dangle": "off",
"no-unmodified-loop-condition": "off",
"no-unneeded-ternary": "off",
"no-unreachable-loop": "error",
"no-unused-expressions": "off",
"no-use-before-define": "off",
"no-useless-backreference": "error",
"no-useless-call": "off",
"no-useless-computed-key": "error",
"no-useless-concat": "off",
"no-useless-constructor": "error",
"no-useless-rename": "error",
"no-useless-return": "off",
"no-var": "off",
"no-void": "off",
"no-warning-comments": "off",
"no-whitespace-before-property": "error",
"nonblock-statement-body-position": [
"error",
"any"
],
"object-curly-newline": "off",
"object-curly-spacing": "off",
"object-property-newline": "off",
"object-shorthand": "off",
"one-var": "off",
"one-var-declaration-per-line": "off",
"operator-assignment": "off",
"operator-linebreak": "off",
"padded-blocks": "off",
"padding-line-between-statements": "error",
"prefer-arrow-callback": "off",
"prefer-const": "off",
"prefer-destructuring": "off",
"prefer-exponentiation-operator": "off",
"prefer-named-capture-group": "off",
"prefer-numeric-literals": "error",
"prefer-object-spread": "off",
"prefer-promise-reject-errors": "error",
"prefer-reflect": "off",
"prefer-regex-literals": "off",
"prefer-rest-params": "off",
"prefer-spread": "off",
"prefer-template": "off",
"quote-props": "off",
"quotes": "off",
"radix": "off",
"require-atomic-updates": "error",
"require-await": "error",
"require-jsdoc": "off",
"require-unicode-regexp": "off",
"rest-spread-spacing": "error",
"semi": "off",
"semi-spacing": "off",
"semi-style": "off",
"sort-imports": "error",
"sort-keys": "off",
"sort-vars": "off",
"space-before-blocks": "off",
"space-before-function-paren": "off",
"space-in-parens": "off",
"space-infix-ops": "off",
"space-unary-ops": "off",
"spaced-comment": "off",
"strict": "off",
"switch-colon-spacing": "off",
"symbol-description": "error",
"template-curly-spacing": "error",
"template-tag-spacing": "error",
"unicode-bom": [
"error",
"never"
],
"valid-jsdoc": "off",
"valid-typeof": [
"error",
{
"requireStringLiterals": false
}
],
"vars-on-top": "off",
"wrap-iife": "off",
"wrap-regex": "off",
"yield-star-spacing": "error",
"yoda": "off",
"no-useless-escape": "off",
"no-unused-vars": "off",
"no-empty": "off",
"no-extra-semi": "off",
"no-redeclare": "off",
"no-control-regex": "off",
"no-mixed-spaces-and-tabs": "off",
"no-extra-boolean-cast": "off",
"no-prototype-builtins": "off",
"no-undef": "off",
"no-unreachable": "off",
"no-self-assign": "off"
}
}

View File

@@ -105,21 +105,35 @@ node $TW5_BUILD_TIDDLYWIKI \
fi
# /index.html Main site
# /external-(version).html External core version of main site
# /favicon.ico Favicon for main site
# /static.html Static rendering of default tiddlers
# /alltiddlers.html Static rendering of all tiddlers
# /static/* Static single tiddlers
# /static/static.css Static stylesheet
# /static/favicon.ico Favicon for static pages
node $TW5_BUILD_TIDDLYWIKI \
$TW5_BUILD_MAIN_EDITION \
--version \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \
--build favicon static index \
--build favicon index external-js \
|| exit 1
# /static.html Static rendering of default tiddlers
# /alltiddlers.html Static rendering of all tiddlers
# /static/* Static single tiddlers
# /static/static.css Static stylesheet
# /static/favicon.ico Favicon for static pages
# Conditionally build static files if $TW5_BUILD_STATIC variable is not set or is set to 0
if [ -z "$TW5_BUILD_STATIC" ] || [ "$TW5_BUILD_STATIC" = "0" ]; then
node $TW5_BUILD_TIDDLYWIKI \
$TW5_BUILD_MAIN_EDITION \
--version \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \
--build static \
|| exit 1
fi
# /empty.html Empty
# /empty.hta For Internet Explorer
# /empty-external-core.html External core empty
@@ -155,7 +169,7 @@ node $TW5_BUILD_TIDDLYWIKI \
node $TW5_BUILD_TIDDLYWIKI \
./editions/tour \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all tour.html text/plain \
--rendertiddler $:/core/save/all-external-js tour.html text/plain \
|| exit 1
# /share.html Custom edition for sharing via the URL
@@ -189,12 +203,15 @@ node $TW5_BUILD_TIDDLYWIKI \
#
######################################################
# Conditionally build editions if $TW5_BUILD_EDITIONS variable is not set or is set to 0
if [ -z "$TW5_BUILD_EDITIONS" ] || [ "$TW5_BUILD_EDITIONS" = "0" ]; then
# /editions/xlsx-utils/index.html xlsx-utils edition
node $TW5_BUILD_TIDDLYWIKI \
./editions/xlsx-utils \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/editions/xlsx-utils/ \
--build index \
--build external \
|| exit 1
# /editions/resumebuilder/index.html Resume builder edition
@@ -210,7 +227,7 @@ node $TW5_BUILD_TIDDLYWIKI \
./editions/text-slicer \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/editions/text-slicer/ \
--build index \
--build external \
|| exit 1
# /editions/translators/index.html Translators edition
@@ -242,7 +259,7 @@ node $TW5_BUILD_TIDDLYWIKI \
./editions/tw5.com-docs \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT/editions/tw5.com-docs/ \
--build index \
--build external \
|| exit 1
# /editions/twitter-archivist/index.html Twitter Archivist edition
@@ -253,19 +270,25 @@ node $TW5_BUILD_TIDDLYWIKI \
--build index \
|| exit 1
fi
######################################################
#
# Plugin demos
#
######################################################
# Conditionally build plugin demos if $TW5_BUILD_PLUGIN_DEMOS variable is not set
if [ -z "$TW5_BUILD_PLUGIN_DEMOS" ] || [ "$TW5_BUILD_PLUGIN_DEMOS" = "0" ]; then
# /plugins/tiddlywiki/innerwiki/index.html Demo wiki with Innerwiki plugin
node $TW5_BUILD_TIDDLYWIKI \
./editions/innerwikidemo \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/innerwiki/index.html text/plain \
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/innerwiki/index.html text/plain \
|| exit 1
# /plugins/tiddlywiki/dynaview/index.html Demo wiki with DynaView plugin
@@ -275,7 +298,7 @@ node $TW5_BUILD_TIDDLYWIKI \
./editions/dynaviewdemo \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/dynaview/index.html text/plain \
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/dynaview/index.html text/plain \
--rendertiddler $:/core/save/empty plugins/tiddlywiki/dynaview/empty.html text/plain \
|| exit 1
@@ -289,7 +312,7 @@ node $TW5_BUILD_TIDDLYWIKI \
./editions/katexdemo \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/katex/index.html text/plain \
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/katex/index.html text/plain \
--rendertiddler $:/core/save/empty plugins/tiddlywiki/katex/empty.html text/plain \
|| exit 1
@@ -319,7 +342,7 @@ node $TW5_BUILD_TIDDLYWIKI \
./editions/codemirrordemo \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/codemirror/index.html text/plain \
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/codemirror/index.html text/plain \
--rendertiddler $:/core/save/empty plugins/tiddlywiki/codemirror/empty.html text/plain \
|| exit 1
@@ -329,7 +352,7 @@ node $TW5_BUILD_TIDDLYWIKI \
./editions/markdowndemo \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/markdown/index.html text/plain \
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/markdown/index.html text/plain \
--rendertiddler $:/core/save/empty plugins/tiddlywiki/markdown/empty.html text/plain \
|| exit 1
@@ -339,7 +362,7 @@ node $TW5_BUILD_TIDDLYWIKI \
./editions/classicparserdemo \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/tw2parser/index.html text/plain \
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/tw2parser/index.html text/plain \
--rendertiddler $:/core/save/empty plugins/tiddlywiki/tw2parser/empty.html text/plain \
|| exit 1
@@ -349,7 +372,7 @@ node $TW5_BUILD_TIDDLYWIKI \
./editions/highlightdemo \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/highlight/index.html text/plain \
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/highlight/index.html text/plain \
--rendertiddler $:/core/save/empty plugins/tiddlywiki/highlight/empty.html text/plain \
|| exit 1
@@ -359,16 +382,21 @@ node $TW5_BUILD_TIDDLYWIKI \
./editions/geospatialdemo \
--load $TW5_BUILD_OUTPUT/build.tid \
--output $TW5_BUILD_OUTPUT \
--rendertiddler $:/core/save/all plugins/tiddlywiki/geospatial/index.html text/plain \
--rendertiddler $:/core/save/all-external-js plugins/tiddlywiki/geospatial/index.html text/plain \
--rendertiddler $:/core/save/empty plugins/tiddlywiki/geospatial/empty.html text/plain \
|| exit 1
fi
######################################################
#
# Language editions
#
######################################################
# Conditionally build language editions if $TW5_BUILD_LANGUAGE_DEMOS variable is not set
if [ -z "$TW5_BUILD_LANGUAGE_DEMOS" ] || [ "$TW5_BUILD_LANGUAGE_DEMOS" = "0" ]; then
# Delete any existing static content
rm -rf $TW5_BUILD_OUTPUT/languages/de-AT/static/*
@@ -452,12 +480,17 @@ node $TW5_BUILD_TIDDLYWIKI \
--build empty index \
|| exit 1
fi
######################################################
#
# Plugin library
#
######################################################
# Conditionally build plugin library if $TW5_BUILD_PLUGIN_LIBRARY variable is not set
if [ -z "$TW5_BUILD_PLUGIN_LIBRARY" ] || [ "$TW5_BUILD_PLUGIN_LIBRARY" = "0" ]; then
node $TW5_BUILD_TIDDLYWIKI \
./editions/pluginlibrary \
--load $TW5_BUILD_OUTPUT/build.tid \
@@ -465,6 +498,8 @@ node $TW5_BUILD_TIDDLYWIKI \
--build library\
|| exit 1
fi
# Delete the temporary build tiddler
rm $TW5_BUILD_OUTPUT/build.tid || exit 1

View File

@@ -2000,7 +2000,7 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
var value = tiddler[name];
switch(fieldInfo.source) {
case "subdirectories":
value = path.relative(rootPath, filename).split(path.sep).slice(0, -1);
value = $tw.utils.stringifyList(path.relative(rootPath, filename).split(path.sep).slice(0, -1));
break;
case "filepath":
value = path.relative(rootPath, filename).split(path.sep).join('/');
@@ -2021,10 +2021,10 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
value = path.extname(filename);
break;
case "created":
value = new Date(fs.statSync(pathname).birthtime);
value = $tw.utils.stringifyDate(new Date(fs.statSync(pathname).birthtime));
break;
case "modified":
value = new Date(fs.statSync(pathname).mtime);
value = $tw.utils.stringifyDate(new Date(fs.statSync(pathname).mtime));
break;
}
if(fieldInfo.prefix) {
@@ -2732,14 +2732,15 @@ $tw.hooks.removeHook = function(hookName,definition) {
/*
Invoke the hook by key
*/
$tw.hooks.invokeHook = function(hookName /*, value,... */) {
var args = Array.prototype.slice.call(arguments,1);
if($tw.utils.hop($tw.hooks.names,hookName)) {
$tw.hooks.invokeHook = function(hookName, firstArgument /*, value,... */) {
if(Object.prototype.hasOwnProperty.call($tw.hooks.names,hookName)) {
var args = Array.prototype.slice.call(arguments,1);
for(var i = 0; i < $tw.hooks.names[hookName].length; i++) {
args[0] = $tw.hooks.names[hookName][i].apply(null,args);
}
return args[0];
}
return args[0];
return firstArgument;
};
/////////////////////////// Main boot function to decrypt tiddlers and then startup

View File

@@ -4,12 +4,12 @@ _canonical_uri: The full URI of an external image tiddler
author: Name of the author of a plugin
bag: The name of the bag from which a tiddler came
caption: The text to be displayed on a tab or button
class: The CSS class applied to a tiddler when rendering it - see [[Custom styles by user-class]]. Also used for [[Modals]]
class: The CSS class applied to a tiddler when rendering it. Also used for Modals
code-body: The view template will display the tiddler as code if set to ''yes''
color: The CSS color value associated with a tiddler
component: The name of the component responsible for an [[alert tiddler|AlertMechanism]]
component: The name of the component responsible for an alert tiddler
core-version: For a plugin, indicates what version of TiddlyWiki with which it is compatible
current-tiddler: Used to cache the top tiddler in a [[history list|HistoryMechanism]]
current-tiddler: Used to cache the top tiddler in a history list
created: The date a tiddler was created
creator: The name of the person who created a tiddler
dependents: For a plugin, lists the dependent plugin titles

View File

@@ -1,8 +0,0 @@
title: $:/language/Help/echo
description: Displays all the passed arguments
Displays all the passed arguments to a command. Useful for debugging.
```
--echo <text> *
```

View File

@@ -3,7 +3,9 @@ title: $:/language/Search/
DefaultResults/Caption: List
Filter/Caption: Filter
Filter/Hint: Search via a [[filter expression|https://tiddlywiki.com/static/Filters.html]]
Filter/Placeholder: Filter expression
Filter/Matches: //<small><<resultCount>> matches</small>//
Filter/FilterResults/Results/Caption: Results
Matches: //<small><<resultCount>> matches</small>//
Matches/All: All matches:
Matches/NoMatch: //No match//

View File

@@ -13,7 +13,7 @@ The $tw.Commander class is a command interpreter
Parse a sequence of commands
commandTokens: an array of command string tokens
wiki: reference to the wiki store object
streams: {output:, input:, error:}
streams: {output:, error:}, each of which has a write(string) method
callback: a callback invoked as callback(err) where err is null if there was no error
*/
var Commander = function(commandTokens,callback,wiki,streams) {
@@ -61,172 +61,69 @@ Commander.prototype.execute = function() {
this.executeNextCommand();
};
/*
Returns the next string token without consuming it, or null if there are none left. Callback invoked(err,data)
*/
Commander.prototype.peekNextToken = function(callback) {
var self = this;
if(this.nextToken >= this.commandTokens.length) {
return callback(null,null);
} else {
return this.stringifyToken(this.nextToken,function(err,data) {
if(!err) {
// Save the stringified token for next time so that we don't run prompts twice
self.commandTokens[self.nextToken] = data;
}
callback(err,data);
});
}
};
/*
Returns and consumes the next string token, or null if there are none left. Callback invoked(err,data)
*/
Commander.prototype.getNextToken = function(callback) {
if(this.nextToken >= this.commandTokens.length) {
return callback(null,null);
} else {
return this.stringifyToken(this.nextToken++,callback);
}
};
/*
Returns and consumes the string tokens until the end of the token stream or the first token that starts with "--".
Callback invoked(err,tokenArray)
*/
Commander.prototype.getTokensUntilCommand = function(callback) {
var self = this,
tokens = [];
function processNextToken() {
self.peekNextToken(function(err,data) {
if(err) {
return callback(err);
}
if(data === null || data.substr(0,2) === "--") {
return callback(null,tokens);
} else {
self.getNextToken(function(err,data) {
if(err) {
return callback(err);
}
tokens.push(data);
processNextToken();
});
}
});
}
processNextToken();
};
/*
Returns a specified stringified token, or null if the index does not exist. Callback invoked(err,data)
*/
Commander.prototype.stringifyToken = function(index,callback) {
var self = this;
if(index >= this.commandTokens.length) {
return callback(null,null);
} else {
var token = this.commandTokens[index];
if(typeof token === "string") {
return callback(null,token);
} else if(typeof token === "object") {
switch(token.type) {
case "filter":
return callback(null,this.wiki.filterTiddlers(token.text)[0] || "");
case "wikify":
return callback(null,this.wiki.renderText("text/plain","text/vnd.tiddlywiki",token.text,{
parseAsInline: false,
parentWidget: $tw.rootWidget
}));
case "prompt":
$tw.utils.terminalQuestion({
promptText: token.prompt || "Please enter a value",
defaultResult: token["default"] || "",
callback: function(err,userText) {
if(err) {
callback(err);
} else {
if(token.transformFilter) {
userText = self.wiki.filterTiddlers(token.transformFilter,null,self.wiki.makeTiddlerIterator([userText]))[0] || "";
}
callback(null,userText);
}
},
input: self.streams.input,
output: self.streams.output,
});
break;
default:
throw "Unknown dynamic command token type: " + token.type;
}
}
}
};
/*
Execute the next command in the sequence
*/
Commander.prototype.executeNextCommand = function() {
var self = this;
// Get and check the command token
var commandName = this.getNextToken(function(err,commandName) {
if(err) {
return self.callback(err);
}
if(!commandName) {
return self.callback(null);
}
// Invoke the callback if there are no more commands
if(this.nextToken >= this.commandTokens.length) {
this.callback(null);
} else {
// Get and check the command token
var commandName = this.commandTokens[this.nextToken++];
if(commandName.substr(0,2) !== "--") {
return self.callback("Missing command: " + commandName);
this.callback("Missing command: " + commandName);
} else {
commandName = commandName.substr(2); // Trim off the --
// Get the parameters to the command
self.getTokensUntilCommand(function(err,params) {
if(err) {
return self.callback(err);
// Accumulate the parameters to the command
var params = [];
while(this.nextToken < this.commandTokens.length &&
this.commandTokens[this.nextToken].substr(0,2) !== "--") {
params.push(this.commandTokens[this.nextToken++]);
}
// Get the command info
var command = $tw.commands[commandName],
c,err;
if(!command) {
this.callback("Unknown command: " + commandName);
} else {
if(this.verbose) {
this.streams.output.write("Executing command: " + commandName + " " + params.join(" ") + "\n");
}
var command = $tw.commands[commandName],
c,err;
if(!command) {
self.callback("Unknown command: " + commandName);
// Parse named parameters if required
if(command.info.namedParameterMode) {
params = this.extractNamedParameters(params,command.info.mandatoryParameters);
if(typeof params === "string") {
return this.callback(params);
}
}
if(command.info.synchronous) {
// Synchronous command
c = new command.Command(params,this);
err = c.execute();
if(err) {
this.callback(err);
} else {
this.executeNextCommand();
}
} else {
if(self.verbose) {
self.streams.output.write("Executing command: " + commandName + " " + params.join(" ") + "\n");
}
// Parse named parameters if required
if(command.info.namedParameterMode) {
params = self.extractNamedParameters(params,command.info.mandatoryParameters);
if(typeof params === "string") {
return self.callback(params);
}
}
if(command.info.synchronous) {
// Synchronous command
c = new command.Command(params,self);
err = c.execute();
// Asynchronous command
c = new command.Command(params,this,function(err) {
if(err) {
self.callback(err);
} else {
self.executeNextCommand();
}
} else {
// Asynchronous command
c = new command.Command(params,self,function(err) {
if(err) {
self.callback(err);
} else {
self.executeNextCommand();
}
});
err = c.execute();
if(err) {
self.callback(err);
}
});
err = c.execute();
if(err) {
this.callback(err);
}
}
});
}
}
});
}
};
/*

View File

@@ -1,32 +0,0 @@
/*\
title: $:/core/modules/commands/echo.js
type: application/javascript
module-type: command
Command to echo input parameters
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.info = {
name: "echo",
synchronous: true
};
var Command = function(params,commander) {
this.params = params;
this.commander = commander;
};
Command.prototype.execute = function() {
this.commander.streams.output.write(JSON.stringify(this.params,null,4) + "\n");
return null;
};
exports.Command = Command;
})();

View File

@@ -220,13 +220,25 @@ exports.filterTiddlers = function(filterString,widget,source) {
Compile a filter into a function with the signature fn(source,widget) where:
source: an iterator function for the source tiddlers, called source(iterator), where iterator is called as iterator(tiddler,title)
widget: an optional widget node for retrieving the current tiddler etc.
Parameters:
filterString: the filter string to compile
options: includes:
wrappers: a hashmap of wrapper functions to apply to the compiled filter function
*/
exports.compileFilter = function(filterString) {
exports.compileFilter = function(filterString,options) {
options = options || {};
var self = this;
var wrappers = options.wrappers || {};
// Invoke the hook to allow the filter to be inspected
wrappers = $tw.hooks.invokeHook("th-filter-evaluation",filterString,wrappers) || wrappers;
// Get the result from the cache if we can
if(!this.filterCache) {
this.filterCache = Object.create(null);
this.filterCacheCount = 0;
}
if(this.filterCache[filterString] !== undefined) {
if(this.filterCache[filterString] !== undefined && !wrappers.prefix && !wrappers.operation && !wrappers.operator && !wrappers.start && !wrappers.done) {
return this.filterCache[filterString];
}
var filterParseTree;
@@ -235,7 +247,14 @@ exports.compileFilter = function(filterString) {
} catch(e) {
// We do not cache this result, so it adjusts along with localization changes
return function(source,widget) {
return [$tw.language.getString("Error/Filter") + ": " + e];
if(wrappers.start) {
wrappers.start(source,widget);
}
var resultsArray = [$tw.language.getString("Error/Filter") + ": " + e];
if(wrappers.done) {
wrappers.done(resultsArray);
}
return resultsArray;
};
}
// Get the hashmap of filter operator functions
@@ -249,52 +268,64 @@ exports.compileFilter = function(filterString) {
var operationSubFunction = function(source,widget) {
var accumulator = source,
results = [],
currTiddlerTitle = widget && widget.getVariable("currentTiddler");
$tw.utils.each(operation.operators,function(operator) {
var operands = [],
operatorFunction;
if(!operator.operator) {
// Use the "title" operator if no operator is specified
operatorFunction = filterOperators.title;
} else if(!filterOperators[operator.operator]) {
// Unknown operators treated as "[unknown]" - at run time we can distinguish between a custom operator and falling back to the default "field" operator
operatorFunction = filterOperators["[unknown]"];
} else {
// Use the operator function
operatorFunction = filterOperators[operator.operator];
}
$tw.utils.each(operator.operands,function(operand) {
if(operand.indirect) {
operand.value = self.getTextReference(operand.text,"",currTiddlerTitle);
} else if(operand.variable) {
var varTree = $tw.utils.parseFilterVariable(operand.text);
operand.value = widgetClass.evaluateVariable(widget,varTree.name,{params: varTree.params, source: source})[0] || "";
} else {
operand.value = operand.text;
}
operands.push(operand.value);
});
// Invoke the appropriate filteroperator module
results = operatorFunction(accumulator,{
operator: operator.operator,
operand: operands.length > 0 ? operands[0] : undefined,
operands: operands,
prefix: operator.prefix,
suffix: operator.suffix,
suffixes: operator.suffixes,
regexp: operator.regexp
},{
wiki: self,
widget: widget
currTiddlerTitle = widget && widget.getVariable("currentTiddler"),
handleOperation = function() {
$tw.utils.each(operation.operators,function(operator) {
var operands = [],
operatorName,operatorFunction;
if(!operator.operator) {
// Use the "title" operator if no operator is specified
operatorName = "title";
} else if(!filterOperators[operator.operator]) {
// Unknown operators treated as "[unknown]" - at run time we can distinguish between a custom operator and falling back to the default "field" operator
operatorName = "[unknown]";
} else {
// Use the operator function
operatorName = operator.operator;
}
operatorFunction = filterOperators[operatorName];
$tw.utils.each(operator.operands,function(operand) {
if(operand.indirect) {
operand.value = self.getTextReference(operand.text,"",currTiddlerTitle);
} else if(operand.variable) {
var varTree = $tw.utils.parseFilterVariable(operand.text);
operand.value = widgetClass.evaluateVariable(widget,varTree.name,{params: varTree.params, source: source})[0] || "";
} else {
operand.value = operand.text;
}
operands.push(operand.value);
});
if($tw.utils.isArray(results)) {
accumulator = self.makeTiddlerIterator(results);
} else {
accumulator = results;
}
});
if($tw.utils.isArray(results)) {
// Wrap the filter operator module if required
if(wrappers.operator) {
operatorFunction = wrappers.operator.bind(self,operatorFunction);
}
// Invoke the appropriate filteroperator module
results = operatorFunction(accumulator,{
parseTree: operator,
operator: operator.operator,
operatorName: operatorName,
operand: operands.length > 0 ? operands[0] : undefined,
operands: operands,
prefix: operator.prefix,
suffix: operator.suffix,
suffixes: operator.suffixes,
regexp: operator.regexp
},{
wiki: self,
widget: widget
});
if($tw.utils.isArray(results)) {
accumulator = self.makeTiddlerIterator(results);
} else {
accumulator = results;
}
});
};
if(wrappers.operation) {
handleOperation = wrappers.operation.bind(self,handleOperation,operation);
}
handleOperation();
if($tw.utils.isArray(results)) {
return results;
} else {
var resultArray = [];
@@ -307,27 +338,45 @@ exports.compileFilter = function(filterString) {
var filterRunPrefixes = self.getFilterRunPrefixes();
// Wrap the operator functions in a wrapper function that depends on the prefix
operationFunctions.push((function() {
var options = {wiki: self, suffixes: operation.suffixes || []};
var prefixName;
switch(operation.prefix || "") {
case "": // No prefix means that the operation is unioned into the result
return filterRunPrefixes["or"](operationSubFunction, options);
prefixName = "or";
break;
case "=": // The results of the operation are pushed into the result without deduplication
return filterRunPrefixes["all"](operationSubFunction, options);
prefixName = "all";
break;
case "-": // The results of this operation are removed from the main result
return filterRunPrefixes["except"](operationSubFunction, options);
prefixName = "except";
break;
case "+": // This operation is applied to the main results so far
return filterRunPrefixes["and"](operationSubFunction, options);
prefixName = "and";
break;
case "~": // This operation is unioned into the result only if the main result so far is empty
return filterRunPrefixes["else"](operationSubFunction, options);
default:
if(operation.namedPrefix && filterRunPrefixes[operation.namedPrefix]) {
return filterRunPrefixes[operation.namedPrefix](operationSubFunction, options);
} else {
return function(results,source,widget) {
results.clear();
results.push($tw.language.getString("Error/FilterRunPrefix"));
};
}
prefixName = "else";
break;
default:
prefixName = operation.namedPrefix;
break;
}
if(prefixName && filterRunPrefixes[prefixName]) {
var options = {
wiki: self,
suffixes: operation.suffixes || [],
prefixName: prefixName,
prefix: operation.prefix
},
filterRunPrefixFunction = filterRunPrefixes[prefixName];
// Wrap the filter operator module if required
if(wrappers.prefix) {
filterRunPrefixFunction = wrappers.prefix.bind(self,filterRunPrefixFunction);
}
return filterRunPrefixFunction(operationSubFunction,options);
} else {
return function(results,source,widget) {
results.clear();
results.push($tw.language.getString("Error/FilterRunPrefix"));
};
}
})());
});
@@ -341,6 +390,9 @@ exports.compileFilter = function(filterString) {
if(!widget) {
widget = $tw.rootWidget;
}
if(wrappers.start) {
wrappers.start(source,widget);
}
var results = new $tw.utils.LinkedList();
self.filterRecursionCount = (self.filterRecursionCount || 0) + 1;
if(self.filterRecursionCount < MAX_FILTER_DEPTH) {
@@ -351,7 +403,11 @@ exports.compileFilter = function(filterString) {
results.push("/**-- Excessive filter recursion --**/");
}
self.filterRecursionCount = self.filterRecursionCount - 1;
return results.toArray();
var resultsArray = results.toArray();
if(wrappers.done) {
wrappers.done(resultsArray);
}
return resultsArray;
});
if(this.filterCacheCount >= 2000) {
// To prevent memory leak, we maintain an upper limit for cache size.
@@ -360,7 +416,9 @@ exports.compileFilter = function(filterString) {
this.filterCache = Object.create(null);
this.filterCacheCount = 0;
}
this.filterCache[filterString] = fnMeasured;
this.filterCacheCount++;
if(!wrappers.prefix && !wrappers.operator) {
this.filterCache[filterString] = fnMeasured;
this.filterCacheCount++;
}
return fnMeasured;
};

View File

@@ -6,7 +6,6 @@ module-type: filteroperator
Filter operator for returning all the backtranscludes from a tiddler
\*/
(function(){
"use strict";
/*
@@ -19,5 +18,3 @@ exports.backtranscludes = function(source,operator,options) {
});
return results.makeTiddlerIterator(options.wiki);
};
})();

View File

@@ -6,7 +6,6 @@ module-type: filteroperator
Filter operator for returning all the transcludes from a tiddler
\*/
(function(){
"use strict";
/*
@@ -19,5 +18,3 @@ exports.transcludes = function(source,operator,options) {
});
return results.makeTiddlerIterator(options.wiki);
};
})();

View File

@@ -10,7 +10,6 @@ This is a <%if [{something}] %>Elephant<%elseif [{else}] %>Pelican<%else%>Crocod
```
\*/
(function(){
"use strict";
exports.name = "conditional";
@@ -113,5 +112,3 @@ exports.parseIfClause = function(filterCondition) {
// Return the parse tree node
return [listWidget];
};
})();

View File

@@ -26,11 +26,7 @@ exports.startup = function(callback) {
callback();
},
$tw.wiki,
{
output: process.stdout,
input: process.stdin,
error: process.stderr
}
{output: process.stdout, error: process.stderr}
);
commander.execute();
};

View File

@@ -6,8 +6,6 @@ module-type: utils
Custom errors for TiddlyWiki.
\*/
(function(){
function TranscludeRecursionError() {
Error.apply(this,arguments);
this.signatures = Object.create(null);
@@ -19,5 +17,3 @@ TranscludeRecursionError.MAX_WIDGET_TREE_DEPTH = 1000;
TranscludeRecursionError.prototype = Object.create(Error);
exports.TranscludeRecursionError = TranscludeRecursionError;
})();

View File

@@ -6,7 +6,6 @@ module-type: utils
Utilities for working with the TiddlyWiki repository file structure
\*/
(function(){
"use strict";
/*
@@ -45,5 +44,3 @@ exports.getAllPlugins = function(options) {
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.languagesPath,options.ignoreEnvironmentVariables ? undefined : $tw.config.languagesEnvVar),collectPlugins);
return tiddlers;
};
})();

View File

@@ -18,127 +18,29 @@ exports.log = function(text,colour) {
console.log($tw.node ? exports.terminalColour(colour) + text + exports.terminalColour() : text);
};
/*
Prompts the user for input and handles the input using a callback function. Options:
promptText: Prompt text
defaultResult: Default result returned if the user types enter
callback: callback invoked (err,usertext)
input: optional input stream
output: optional output stream
*/
exports.terminalQuestion = function(options) {
var readline = require("readline"),
promptText = options.promptText,
defaultResult = options.defaultResult,
callback = options.callback,
inputStream = options.input || process.stdin,
outputStream = options.output || process.stdout;
var rl = readline.createInterface({
input: inputStream,
output: outputStream
});
// Handle errors on the input stream
rl.on("error",function(err) {
rl.close();
callback(err); // Pass the error to the callback
});
// Prompt user for input
var prompt = exports.terminalColourText(promptText,["yellow","bold"]);
if(defaultResult) {
prompt += " ";
prompt += exports.terminalColourText("(" + defaultResult + ")",["blue","underline"]);
}
prompt += exports.terminalColourText(": ");
rl.question(prompt,function(input) {
// Use default value for the empty string
if(input === "" && defaultResult) {
input = defaultResult;
}
callback(null,input); // Pass the input to the callback
rl.close();
});
};
/*
Wrap a string in colour codes. Colour can be an array
*/
exports.terminalColourText = function(text,colour) {
if(!$tw.utils.isArray(colour)) {
colour = [colour];
}
$tw.utils.each(colour,function(code) {
text = exports.terminalColour(code) + text + exports.terminalColour(code,true);
});
return text;
};
/*
Returns a terminal colour string. Set "closed" to true to return the closing code
*/
exports.terminalColour = function(colour,closed) {
exports.terminalColour = function(colour) {
if(!$tw.browser && $tw.node && process.stdout.isTTY) {
if(colour) {
var code = exports.terminalColourLookup[colour];
if(code) {
return "\x1b[" + code[closed ? 1 : 0] + "m";
return "\x1b[" + code + "m";
}
} else {
return "\x1b[0m"; // Cancel colour
}
return "\x1b[0m"; // Reset
}
return "";
};
exports.terminalColourLookup = {
// Modifiers
"reset": [0,0],
"bold": [1,22],
"dim": [2,22],
"italic": [3,23],
"underline": [4,24],
"overline": [53,55],
"inverse": [7,27],
"hidden": [8,28],
"strikethrough": [9,29],
// Colours
"black": [30,39],
"red": [31,39],
"green": [32,39],
"yellow": [33,39],
"brown/orange": [33,39], // Backwards compatbility
"blue": [34,39],
"magenta": [35,39], // Backwards compatbility
"purple": [35,39],
"cyan": [36,39],
"white": [37,39],
"gray": [90,39],
"light red": [91,39],
"light green": [92,39],
"light yellow": [93,39],
"light blue": [94,39],
"light magenta": [95,39],
"light purple": [95,39], // Backwards compatbility
"light cyan": [96,39],
"light gray": [97,39],
// Background colours
"black background": [40,49],
"red background": [41,49],
"green background": [42,49],
"yellow background": [43,49],
"brown/orange background": [43,49], // Backwards compatbility
"blue background": [44,49],
"magenta background": [45,49], // Backwards compatbility
"purple background": [45,49],
"cyan background": [46,49],
"white background": [47,49],
"gray background": [100,49],
"light red background": [101,49],
"light green background": [102,49],
"light yellow background": [103,49],
"light blue background": [104,49],
"light magenta background": [105,49],
"light purple background": [105,49], // Backwards compatbility
"light cyan background": [106,49],
"light gray background": [107,49]
"black": "0;30",
"red": "0;31",
"green": "0;32",
"brown/orange": "0;33",
"blue": "0;34",
"purple": "0;35",
"cyan": "0;36",
"light gray": "0;37"
};
/*

View File

@@ -6,7 +6,6 @@ module-type: widget
Widget to dynamically represent one or more tiddlers
\*/
(function(){
"use strict";
var Widget = require("$:/core/modules/widgets/widget.js").widget;
@@ -187,5 +186,3 @@ function hasPayloadChanged(a,b) {
}
exports.data = DataWidget;
})();

View File

@@ -6,7 +6,6 @@ module-type: widget
Widget to display a test case
\*/
(function(){
"use strict";
var Widget = require("$:/core/modules/widgets/widget.js").widget;
@@ -160,5 +159,3 @@ TestCaseWidget.prototype.refresh = function(changedTiddlers) {
};
exports["testcase"] = TestCaseWidget;
})();

View File

@@ -34,39 +34,11 @@ caption: {{$:/language/Search/Filter/Caption}}
</$list>
\end
\procedure input-accept-actions()
\whitespace trim
<$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]">
<$list-empty>
<$list filter="[<tiddler>get[text]!is[missing]] :else[<tiddler>get[text]is[shadow]]">
<$action-navigate $to={{{ [<tiddler>get[text]] }}}/>
</$list>
<$/list-empty>
<$action-navigate $to={{{ [<tiddler>get[text]] }}}/>
</$list>
\end
\procedure input-accept-variant-actions()
\whitespace trim
<$list filter="[{$:/config/Search/NavigateOnEnter/enable}match[yes]]">
<$list-empty>
<$list filter="[<tiddler>get[text]!is[missing]] :else[<tiddler>get[text]is[shadow]]">
<$list filter="[<__tiddler__>get[text]minlength[1]]">
<$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<tiddler>get[text]] }}}/>
</$list>
</$list>
</$list-empty>
<$list filter="[<tiddler>get[text]minlength[1]]">
<$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<tiddler>get[text]] }}}/>
</$list>
</$list>
\end
\whitespace trim
<<lingo Filter/Hint>>
<div class="tc-search tc-advanced-search">
<div class="tc-search tc-advanced-search tc-edit-max-width">
<$keyboard key="((input-tab-right))" actions=<<set-next-input-tab>> class="tc-small-gap-right">
<$keyboard key="((input-tab-left))" actions=<<set-previous-input-tab>>>
<$transclude $variable="keyboard-driven-input"
@@ -75,13 +47,16 @@ caption: {{$:/language/Search/Filter/Caption}}
refreshTitle="$:/temp/advancedsearch/refresh"
selectionStateTitle="$:/temp/advancedsearch/selected-item"
type="search"
tag="input"
tag="textarea"
focus={{$:/config/Search/AutoFocus}}
configTiddlerFilter="[[$:/temp/advancedsearch]]"
firstSearchFilterField="text"
inputAcceptActions=<<input-accept-actions>>
inputAcceptVariantActions=<<input-accept-variant-actions>>
inputAcceptActions=""
inputAcceptVariantActions=""
inputCancelActions=<<cancel-search-actions>>
minHeight="2em"
autoHeight="yes"
placeholder={{$:/language/Search/Filter/Placeholder}}
/>
</$keyboard>
</$keyboard>
@@ -90,13 +65,18 @@ caption: {{$:/language/Search/Filter/Caption}}
</$list>
</div>
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="" tag="div" class="tc-search-results">
<$set name="resultCount" value="<$count filter={{$:/temp/advancedsearch}}/>">
<p><<lingo Filter/Matches>></p>
<$list filter={{$:/temp/advancedsearch}}>
<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[[$:/temp/advancedsearch/selected-item]get[text]] :and[then[]else[tc-list-item-selected]] }}}>
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
</span>
</$list>
</$set>
</$reveal>
<%if [{$:/temp/advancedsearch}trim[]!match[]] %>
<div class="tc-search-results">
<%if [all[shadows+tiddlers]tag[$:/tags/AdvancedSearch/FilterResults]!has[draft.of]count[]compare:number:gt[1]] %>
<$macrocall
$name="tabs"
tabsList="[all[shadows+tiddlers]tag[$:/tags/AdvancedSearch/FilterResults]!has[draft.of]]"
default="$:/core/ui/AdvancedSearch/Filter/FilterResults/Results"
/>
<%else%>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/AdvancedSearch/FilterResults]!has[draft.of]]">
<$transclude/>
</$list>
<%endif%>
</div>
<%endif%>

View File

@@ -0,0 +1,13 @@
title: $:/core/ui/AdvancedSearch/Filter/FilterResults/Results
tags: $:/tags/AdvancedSearch/FilterResults
caption: {{$:/language/Search/Filter/FilterResults/Results/Caption}}
\procedure lingo-base() $:/language/Search/
<$set name="resultCount" value="<$count filter={{$:/temp/advancedsearch}}/>">
<p><<lingo Filter/Matches>></p>
<$list filter={{$:/temp/advancedsearch}}>
<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[[$:/temp/advancedsearch/selected-item]get[text]] :and[then[]else[tc-list-item-selected]] }}}>
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
</span>
</$list>
</$set>

View File

@@ -37,7 +37,7 @@ caption: {{$:/language/Search/Standard/Caption}}
inputCancelActions=<<cancel-search-actions>>
inputAcceptActions=<<input-accept-actions>>
inputAcceptVariantActions=<<input-accept-variant-actions>>
configTiddlerFilter="[[$:/state/search/currentTab]!is[missing]get[text]] :else[{$:/config/SearchResults/Default}]"
configTiddlerFilter="[[$:/state/advancedsearch/standard/currentTab]!is[missing]get[text]] :else[{$:/config/SearchResults/Default}]"
filterMinLength={{$:/config/Search/MinLength}}/>
</$keyboard>
</$keyboard>

View File

@@ -12,7 +12,7 @@ Export the TiddlyWiki core JavaScript code for running with external JavaScript:
tooltip="Export the TiddlyWiki core code for running with external JavaScript"
aria-label="export TiddlyWiki core"
class="tc-btn-big-green">
<$action-sendmessage $message='tm-download-file' $param='$:/core/templates/tiddlywiki5.js' filename=<<jsFileName>>/>
<$action-sendmessage $message='tm-download-file' $param='$:/core/templates/tiddlywiki5.js' filename=<<jsFileName>> type="application/javascript"/>
{{$:/core/images/download-button}}
<span class="tc-tiny-gap-left">
Download TiddlyWiki core

View File

@@ -12,7 +12,7 @@ element, and right-click its `src` URI. Save the link as ''$(jsFileName)$''</p>
Export the ~TiddlyWiki core ~JavaScript code for running with external ~JavaScript:
<$button tooltip="Export the ~TiddlyWiki core code for running with external ~JavaScript" aria-label="export TiddlyWiki core" class="tc-btn-big-green">
<$list filter="[[$:/boot/boot.js]is[missing]]" variable="ignore" emptyMessage="""<$action-sendmessage $message="tm-download-file" $param="$:/core/templates/tiddlywiki5.js" filename=<<jsFileName>>/>""" >
<$list filter="[[$:/boot/boot.js]is[missing]]" variable="ignore" emptyMessage="""<$action-sendmessage $message="tm-download-file" $param="$:/core/templates/tiddlywiki5.js" filename=<<jsFileName>> type="application/javascript"/>""" >
<$action-setfield $tiddler=<<qualify "$:/temp/alert">> text=<<noExportMsg>> subtitle="Export ~TiddllyWiki Core"/>
<$action-sendmessage $message="tm-modal" $param=<<qualify "$:/temp/alert">>/>
</$list>

View File

@@ -0,0 +1,4 @@
title: $:/coreURL
tags: $:/tags/Global
\function coreURL() [[../../../tiddlywikicore-$(version)$.js]substitute[]]

View File

@@ -11,6 +11,9 @@
],
"build": {
"index": [
"--rendertiddler","$:/core/save/all","classicparserdemo.html","text/plain"]
"--rendertiddler","$:/core/save/all","classicparserdemo.html","text/plain"],
"external": [
"--render","$:/core/save/all-external-js","classicparserdemo.html","text/plain"
]
}
}

View File

@@ -0,0 +1,4 @@
title: $:/coreURL
tags: $:/tags/Global
\function coreURL() [[../../../tiddlywikicore-$(version)$.js]substitute[]]

View File

@@ -22,6 +22,9 @@
],
"build": {
"index": [
"--rendertiddler","$:/core/save/all","codemirrordemo.html","text/plain"]
"--rendertiddler","$:/core/save/all","codemirrordemo.html","text/plain"],
"external": [
"--render","$:/core/save/all-external-js","codemirrordemo.html","text/plain"
]
}
}

View File

@@ -28,5 +28,4 @@ Note that JavaScript macros work on both the client and the server, and so do no
!! Macro Behaviour
Macros are just used to return a chunk of wikitext for further processing. They should not make modifications to tiddlers in the wiki store. The reason is that you cannott control when the macro is called; it may be called repeatedly as part of refresh processing. So it is important that macros do not have any other side effects beyond generating their text.
Macros are just used to return a chunk of wikitext for further processing. They should not make modifications to tiddlers in the wiki store. The reason is that you cannot control when the macro is called; it may be called repeatedly as part of refresh processing. So it is important that macros do not have any other side effects beyond generating their text.

View File

@@ -34,13 +34,11 @@ Suppose we want to make a filter operator that returns every other tiddler from
We make a new tiddler, set its `type` and `module-type` appropriately, and begin writing the code:
```
(function(){
"use strict";
exports.everyother = function(source, operator, options) {
// TODO
}
})();
```
For the example filter syntax, our function will be called with
@@ -54,7 +52,6 @@ As is usually the case, we don't care about `operator.operator` here (since that
We could implement the operator by iterating over the input tiddlers and explicitly building a result array of titles:
```
(function(){
"use strict";
exports.everyother = function(source, operator, options) {
@@ -66,7 +63,6 @@ exports.everyother = function(source, operator, options) {
});
return result;
}
})();
```
That is, we supply a callback to `source` that negates `include` each time through (in order to grab every other result) and pushes the `title` of every other tiddler onto the result.
@@ -74,7 +70,6 @@ That is, we supply a callback to `source` that negates `include` each time throu
Alternatively, we can return our own iterator, by returning a function that accepts a similar callback and only calls it on every other tiddler:
```
(function(){
"use strict";
exports.everyother = function(source, operator, options) {
@@ -86,7 +81,6 @@ exports.everyother = function(source, operator, options) {
});
};
}
})();
```
Either way, we could interpret the `!` flag on the filter, if present, to mean that we want the //other// half of the tiddlers, by using it to set the initial value of `include`: `var include = operator.prefix !== "!";`

View File

@@ -40,10 +40,7 @@ module-type: startup
YOUR DISCRCRIPTION COMES HERE!
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false, exports: true */
"use strict";
// Export name and synchronous status
@@ -63,6 +60,4 @@ exports.startup = function() {
});
};
})();
```

View File

@@ -11,10 +11,7 @@ The wikitext parser subclassing mechanism makes it possible for custom parsers t
Here is an example of a subclass of the checkbox widget that adds logging to the event handler:
```js
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var WikiParser = require("$:/core/modules/parsers/wikiparser/wikiparser.js")["text/vnd.tiddlywiki"],
@@ -38,5 +35,4 @@ var MyCustomWikiParser = function(type,text,options) {
exports["text/vnd.my-custom-type"] = MyCustomWikiParser;
})();
```

View File

@@ -26,10 +26,7 @@ module-type: widget-subclass
Widget base class
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.baseClass = "checkbox"; // Extend the <$checkbox> widget
@@ -50,5 +47,4 @@ exports.prototype.handleChangeEvent = function(event) {
console.log("Checkbox status:",this.inputDomNode.checked);
};
})();
```

View File

@@ -0,0 +1,4 @@
title: $:/coreURL
tags: $:/tags/Global
\function coreURL() [[../../../tiddlywikicore-$(version)$.js]substitute[]]

View File

@@ -9,6 +9,9 @@
],
"build": {
"index": [
"--rendertiddler","$:/core/save/all","index.html","text/plain"]
"--rendertiddler","$:/core/save/all","index.html","text/plain"],
"external": [
"--render","$:/core/save/all-external-js","index.html","text/plain"
]
}
}

View File

@@ -0,0 +1,4 @@
title: $:/coreURL
tags: $:/tags/Global
\function coreURL() [[../../../tiddlywikicore-$(version)$.js]substitute[]]

View File

@@ -15,6 +15,9 @@
"build": {
"index": [
"--render","$:/core/save/all","index.html","text/plain"],
"external": [
"--render","$:/core/save/all-external-js","index.html","text/plain"
],
"favicon": [],
"static": [],
"empty": [],

View File

@@ -0,0 +1,4 @@
title: $:/coreURL
tags: $:/tags/Global
\function coreURL() [[../../../tiddlywikicore-$(version)$.js]substitute[]]

View File

@@ -16,6 +16,9 @@
"--render","$:/core/templates/static.template.html","static.html","text/plain",
"--render","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
"--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain","$:/core/templates/static.tiddler.html",
"--render","$:/core/templates/static.template.css","static/static.css","text/plain"]
"--render","$:/core/templates/static.template.css","static/static.css","text/plain"],
"external": [
"--render","$:/core/save/all-external-js","highlightdemo.html","text/plain"
]
}
}

View File

@@ -0,0 +1,4 @@
title: $:/coreURL
tags: $:/tags/Global
\function coreURL() [[../../../tiddlywikicore-$(version)$.js]substitute[]]

View File

@@ -19,6 +19,9 @@
"--screenshot",
"[[$:/plugins/tiddlywiki/innerwiki/examples]]",
"4"
],
"external": [
"--render","$:/core/save/all-external-js","index.html","text/plain"
]
}
}

View File

@@ -0,0 +1,4 @@
title: $:/coreURL
tags: $:/tags/Global
\function coreURL() [[../../../tiddlywikicore-$(version)$.js]substitute[]]

View File

@@ -16,6 +16,9 @@
"--render","$:/core/templates/static.template.html","static.html","text/plain",
"--render","$:/core/templates/alltiddlers.template.html","alltiddlers.html","text/plain",
"--render","[!is[system]]","[encodeuricomponent[]addprefix[static/]addsuffix[.html]]","text/plain","$:/core/templates/static.tiddler.html",
"--render","$:/core/templates/static.template.css","static/static.css","text/plain"]
"--render","$:/core/templates/static.template.css","static/static.css","text/plain"],
"external": [
"--render","$:/core/save/all-external-js","katexdemo.html","text/plain"
]
}
}

View File

@@ -0,0 +1,4 @@
title: $:/coreURL
tags: $:/tags/Global
\function coreURL() [[../../../tiddlywikicore-$(version)$.js]substitute[]]

View File

@@ -13,6 +13,9 @@
],
"build": {
"index": [
"--rendertiddler","$:/core/save/all","markdowndemo.html","text/plain"]
"--rendertiddler","$:/core/save/all","markdowndemo.html","text/plain"],
"external": [
"--render","$:/core/save/all-external-js","markdowndemo.html","text/plain"
]
}
}

View File

@@ -2,11 +2,8 @@ created: 20131127215321439
modified: 20140912135951542
title: $:/DefaultTiddlers
[[TiddlyWiki Pre-release]]
HelloThere
[[Quick Start]]
[[Find Out More]]
[[TiddlyWiki on the Web]]
[[Testimonials and Reviews]]
GettingStarted
Community
[[$:/plugins/tiddlywiki/internals]]
[[$:/AdvancedSearch]]
[[$:/plugins/tiddlywiki/internals/filterinspection/docs/inspectoperator]]
[[$:/plugins/tiddlywiki/internals/filterinspection/docs/InspectFilterMacro]]
[[$:/plugins/tiddlywiki/internals/filterinspection/docs/inspectfiltermacro/examples]]

View File

@@ -6,12 +6,6 @@ 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() {
@@ -172,5 +166,3 @@ it("should correctly delete fields", function() {
});
});
})();

View File

@@ -6,7 +6,6 @@ tags: [[$:/tags/test-spec]]
Tests the fakedom that Tiddlywiki occasionally uses.
\*/
(function(){
"use strict";
describe("fakedom tests", function() {
@@ -20,5 +19,3 @@ describe("fakedom tests", function() {
expect($tw.fakeDocument.createTextNode("text").TEXT_NODE).toBe(3);
});
});
})();

View File

@@ -6,7 +6,6 @@ tags: [[$:/tags/test-spec]]
Tests for integrity of the core plugins, languages, themes and editions
\*/
(function(){
"use strict";
if($tw.node) {
@@ -47,6 +46,3 @@ if($tw.node) {
});
});
}
})();

View File

@@ -3,10 +3,7 @@ title: test-widget-event.js
type: application/javascript
tags: [[$:/tags/test-spec]]
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
describe("Widget Event Listeners", function() {
@@ -220,5 +217,3 @@ describe("Widget Event Listeners", function() {
});
});
})();

View File

@@ -6,7 +6,6 @@ tags: [[$:/tags/test-spec]]
Tests the wikitext rendering pipeline end-to-end. We also need tests that individually test parsers, rendertreenodes etc., but this gets us started.
\*/
(function(){
"use strict";
describe("Widget module", function() {
@@ -89,4 +88,3 @@ describe("Widget module", function() {
});
})();

View File

@@ -2,7 +2,8 @@
"description": "TiddlyWiki core tests",
"plugins": [
"tiddlywiki/jasmine",
"tiddlywiki/geospatial"
"tiddlywiki/geospatial",
"tiddlywiki/internals"
],
"themes": [
"tiddlywiki/vanilla",

View File

@@ -0,0 +1,4 @@
title: $:/coreURL
tags: $:/tags/Global
\function coreURL() [[../../tiddlywikicore-$(version)$.js]substitute[]]

View File

@@ -13,6 +13,9 @@
"build": {
"index": [
"--rendertiddler","$:/core/save/all","index.html","text/plain"
],
"external": [
"--render","$:/core/save/all-external-js","index.html","text/plain"
]
}
}

View File

@@ -0,0 +1,4 @@
title: $:/coreURL
tags: $:/tags/Global
\function coreURL() [[tiddlywikicore-$(version)$.js]substitute[]]

View File

@@ -0,0 +1,4 @@
title: $:/coreURL
tags: $:/tags/Global
\function coreURL() [[../../tiddlywikicore-$(version)$.js]substitute[]]

View File

@@ -10,6 +10,9 @@
],
"build": {
"index": [
"--render","$:/core/save/all","index.html","text/plain"]
"--render","$:/core/save/all","index.html","text/plain"],
"external": [
"--render","$:/core/save/all-external-js","index.html","text/plain"
]
}
}

View File

@@ -0,0 +1,11 @@
created: 20250211092107689
modified: 20250211092307574
tags: Definitions
title: HTML Tags
type: text/vnd.tiddlywiki
<<<
In HTML, a tag is used for creating an element.
The name of an HTML element is the name that appears at the beginning of the element's start tag and at the end of the element's end tag (if the element has an end tag). For example, the p in the `<p>` start tag and `</p>` end tag is the name of the HTML paragraph element. Note that an element name in an end tag is preceded by a slash character: `</p>`, and that for void elements, the end tag is neither required nor allowed.
<<< https://developer.mozilla.org/en-US/docs/Glossary/Tag

View File

@@ -1,8 +0,0 @@
caption: echo
created: 20241019150907690
modified: 20241019150907690
tags: Commands
title: EchoCommand
type: text/vnd.tiddlywiki
{{$:/language/Help/echo}}

View File

@@ -1,6 +1,6 @@
breadcrumbs: [[Filter Step]]
created: 20140410103123179
modified: 20230410114132501
modified: 20250302200615061
tags: Filters
title: Filter Operators
type: text/vnd.tiddlywiki
@@ -21,7 +21,7 @@ type: text/vnd.tiddlywiki
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:'' 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]]</$link> as its input.
<<.tip """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]]''</$link> as its input.""" title:"Important">>
''Table legend:''

View File

@@ -6,12 +6,12 @@ type: text/vnd.tiddlywiki
[[TiddlyWikiFolders]] are configured with a single `tiddlywiki.info` file in the root of the wiki folder. It should contain a JSON object comprising the following properties:
* ''plugins'' - optional array of plugin names to be included in the wiki
* ''themes'' - optional array of theme names to be included in the wiki
* ''languages'' - optional array of language names to be included in the wiki
* ''includeWikis'' - optional array of references to external wiki folders to be included in the wiki
* ''build'' - optional hashmap of named build targets, each defined by an array of command tokens (see BuildCommand)
* ''config'' - optional hashmap of configuration options (see below)
* ''plugins'' - an array of plugin names to be included in the wiki
* ''themes'' - an array of theme names to be included in the wiki
* ''languages'' - an array of language names to be included in the wiki
* ''includeWikis'' - an array of references to external wiki folders to be included in the wiki
* ''build'' - a hashmap of named build targets, each defined by an array of command tokens (see BuildCommand)
* ''config'' - an optional hashmap of configuration options (see below)
!!! ''includeWikis''
@@ -22,45 +22,8 @@ The entries in the ''includeWikis'' array can be either a string specifying the
!!! ''build''
The ''build'' property contains a hashmap of named build targets. Each of the build targets is defined as an array of command tokens.
Note that the build targets of included wikis are merged if a target of that name isn't defined in the current `tiddlywiki.info` file.
Command tokens can be a simple string or <<.from-version "5.3.6">> a command token object with a ''type'' property. The following types are defined to allow the command token to be dynamically defined:
* ''filter'': the value of the first result of a filter expression specified in the ''text'' property of the command token object
* ''wikify'': the result of wikifying a text string specified in the ''text'' property of the command token object
* ''prompt'': the result of prompting the user for a string. The ''prompt'' property of the command token object specifies the textual prompt to be used. The optional ''default'' property specifies a string value to be used if the user presses enter in response to the prompt. The optional ''transformFilter'' property specifies a filter to be applied to the user input to transform it into a command token. The string input by the user is available in the variable `user-input`
The EchoCommand is useful for debugging complex dynamic command tokens.
For example:
```
"build": {
"dynamic": [
"--echo","testing",
"the following argument is wikified",
{
"type": "wikify",
"text": "<<version>>-prod.html"
},
"the following argument is a filter result",
{
"type": "filter",
"text": "[<version>!match[5.3.6-prerelease]then[text/html]else[text/plain]]"
},
"the following argument was provided by the user",
{
"type": "prompt",
"prompt": "Please enter some text and type enter",
"default": "Nothing"
}
],
...
```
!!! ''config''
Configuration options include:

View File

@@ -1,6 +1,6 @@
created: 20180111122953142
modified: 20181113084151268
tags: OfficialPlugins
tags: OfficialPlugins [[Plugin Editions]]
title: Dynaview Plugin
type: text/vnd.tiddlywiki

View File

@@ -0,0 +1,17 @@
created: 20250302053159467
modified: 20250302053316068
tags: OfficialPlugins [[Plugin Editions]]
title: Geospatial Plugin
type: text/vnd.tiddlywiki
The Geospatial Plugin adds new primitives to the TiddlyWiki platform to enable non-developers to build sophisticated interactive geospatial applications.
It incorporates a number of third party libraries and online services:
* [[Leaflet.js|https://leafletjs.com/]], an open source library to display interactive maps
* [[Turf.js|https://turfjs.org/]], an open source library to perform geospatial calculations with [[GeoJSON|https://en.wikipedia.org/wiki/GeoJSON]] objects
* [[TravelTime|https://traveltime.com/]], a commercial API for [[geocoding|https://traveltime.com/features/geocoding]], [[routing|https://traveltime.com/features/multi-modal-routing]] and [[isochrones|https://traveltime.com/features/isochrones]]
* [[Flickr|https://www.flickr.com/services/api/]], a free API for retrieving geotagged photographs
* [[OpenLocationCode|https://github.com/google/open-location-code]], Google's open source library for converting to and from Open Location Codes (also known as [[PlusCodes|https://maps.google.com/pluscodes/]])
Try it out at https://tiddlywiki.com/plugins/tiddlywiki/geospatial/

View File

@@ -1,6 +1,6 @@
created: 20190127104143725
modified: 20190127104143725
tags: OfficialPlugins
tags: OfficialPlugins [[Plugin Editions]]
title: Innerwiki Plugin
type: text/vnd.tiddlywiki

View File

@@ -1,6 +1,6 @@
created: 20201228143125000
modified: 20201228143125000
tags: OfficialPlugins
modified: 20250302051857380
tags: OfficialPlugins [[Plugin Editions]]
title: Share Plugin
type: text/vnd.tiddlywiki
@@ -10,3 +10,5 @@ This experimental plugin provides tools to share tiddlers via URLs, comprising:
* The ability to load a group of tiddlers from the browser location hash at startup
* Wizard and templates to create URLs from group of tiddlers
See the demo at [ext[https://tiddlywiki.com/share|share]]

View File

@@ -0,0 +1,9 @@
created: 20250302052635425
modified: 20250302052905312
tags: OfficialPlugins [[Plugin Editions]]
title: Tour Plugin
type: text/vnd.tiddlywiki
The tour plugin allows interactive learning tours to be created and presented in TiddlyWiki.
The demo TiddlyWiki interactive tour can be seen at https://tiddlywiki.com/tour

View File

@@ -48,6 +48,6 @@ $caption$
<<special-button>>
""">>
<<.warning """If macros are nested, textual substitution will only occur for the outermost macro. Thi is because by the time the inner macros are processed all the substitutions will have already occurred""">>
<<.warning """If macros are nested, textual substitution will only occur for the outermost macro. This is because by the time the inner macros are processed all the substitutions will have already occurred""">>
A more formal [[presentation|Macro Definition Syntax]] of this syntax is also available.

View File

@@ -14,13 +14,8 @@ Planned features include:
* Instantaneous synchronisation of changes between the server and all connected clients
* Workflow processing on the server, for example to automatically compress images, or to archive webpages
MWS does require basic knowledge of the command line and Node.js but is designed to be as simple as possible to setup and use. Once downloaded, just two commands are needed to complete the installation and start the server:
MWS does require basic knowledge of the command line and Node.js but is designed to be as simple as possible to setup and use. A few simple commands are all that is needed to complete the installation and start the server.
```
npm install
npm start
```
MWS is currently under development at ~GitHub but it is already functional and usable:
MWS is currently [[under development at GitHub|https://github.com/TiddlyWiki/TiddlyWiki5/pull/7915]] but it is already functional and usable. Visit the MWS website for more information:
! https://mws.tiddlywiki.com/
https://github.com/TiddlyWiki/MultiWikiServer/

View File

@@ -3,10 +3,8 @@ modified: 20140912135951542
title: $:/DefaultTiddlers
type: text/vnd.tiddlywiki
HelloThere
[[Quick Start]]
[[Find Out More]]
[[TiddlyWiki on the Web]]
[[Testimonials and Reviews]]
GettingStarted
Community
[[$:/plugins/tiddlywiki/internals]]
[[$:/AdvancedSearch]]
[[$:/plugins/tiddlywiki/internals/filterinspection/docs/inspectoperator]]
[[$:/plugins/tiddlywiki/internals/filterinspection/docs/InspectFilterMacro]]
[[$:/plugins/tiddlywiki/internals/filterinspection/docs/inspectfiltermacro/examples]]

View File

@@ -1,6 +1,6 @@
caption: action-setfield
created: 20141025120850184
modified: 20150806171403798
modified: 20250322010115457
tags: Widgets ActionWidgets
title: ActionSetFieldWidget
type: text/vnd.tiddlywiki
@@ -66,3 +66,10 @@ src='<$button>
<$action-navigate $to="$:/ControlPanel"/>
Go to Control Panel "Appearance" tab
</$button>'/>
Here is an example of a button that will update the value of an existing field in a tiddler
<$macrocall $name='wikitext-example-without-html'
src='<$button>
<$action-setfield $tiddler="Test" existing_field_name="new field value"/>
Update Field existing_field_name in tiddler Test
</$button>'/>

View File

@@ -1,7 +1,7 @@
caption: reveal
created: 20131024141900000
jeremy: tiddlywiki
modified: 20240721175716320
modified: 20250211091937860
tags: Widgets
title: RevealWidget
type: text/vnd.tiddlywiki
@@ -28,7 +28,7 @@ The content of the `<$reveal>` widget is displayed according to the rules given
|stateTitle |A title containing the state, ''without'' TextReference. Gets preferred over the <<.attr state>> attribute |
|stateField |A ''field name'' which is used to look for the state, if the attribute <<.attr stateTitle>> is present |
|stateIndex |An ''index'' which is used to look for the state, if the attribute <<.attr stateTitle>> is present |
|tag |Overrides the default HTML element tag (`<div>` in block mode or `<span>` in inline mode) |
|tag |Overrides the default [[HTML Tags]] (`<div>` in block mode or `<span>` in inline mode) |
|type |The type of matching performed: ''match'', ''nomatch'', ''popup'', ''lt'', ''gt'', ''lteq'' or ''gteq'' |
|text |The text to match when the type is ''match'', ''nomatch'', ''lt'', ''gt'', ''lteq'' or ''gteq'' |
|class |An optional CSS class name to be assigned to the HTML element<br/>&raquo; Set to `tc-popup-keep` to make a popup "sticky", so it won't close when you click inside of it|

View File

@@ -23,26 +23,6 @@
"languages": [
],
"build": {
"dynamic-example": [
"--echo","testing",
"the following argument is wikified",
{
"type": "wikify",
"text": "<<version>>-prod.html"
},
"the following argument is a filter result",
{
"type": "filter",
"text": "[<version>!match[5.3.6-prerelease]then[text/html]else[text/plain]]"
},
"the following argument was provided by the user",
{
"type": "prompt",
"prompt": "Please enter some text and type enter",
"default": "Nothing",
"transformFilter": "[addprefix[testing ]]"
}
],
"index": [
"--savetiddlers","[tag[external-image]]","images",
"--render","[tag[external-text]]","[encodeuricomponent[]addprefix[text/]addsuffix[.tid]]","text/plain","$:/core/templates/tid-tiddler",

View File

@@ -0,0 +1,4 @@
title: $:/coreURL
tags: $:/tags/Global
\function coreURL() [[../../tiddlywikicore-$(version)$.js]substitute[]]

View File

@@ -12,6 +12,9 @@
],
"build": {
"index": [
"--rendertiddler","$:/core/save/all","index.html","text/plain"]
"--rendertiddler","$:/core/save/all","index.html","text/plain"],
"external": [
"--render","$:/core/save/all-external-js","index.html","text/plain"
]
}
}

View File

@@ -609,3 +609,9 @@ J. Ryan Stinnett, @jryans, 2025/01/04
Galen Huntington, @galenhuntington, 2025/01/19
@Rhys-T, 2025/01/23
@Rumman157, 2025/03/17
@bob.jansen@cultconv.com, 2025/03/22
Matthew Salmon, @matthewsalmon, 2025/04/24

View File

@@ -6,7 +6,6 @@ module-type: global
Confetti manager
\*/
(function(){
"use strict";
var confetti = require("$:/plugins/tiddlywiki/confetti/confetti.js");
@@ -49,5 +48,3 @@ ConfettiManager.prototype.reset = function () {
};
exports.ConfettiManager = ConfettiManager;
})();

View File

@@ -6,7 +6,6 @@ module-type: widget
Confetti widget
\*/
(function(){
"use strict";
var Widget = require("$:/core/modules/widgets/widget.js").widget;
@@ -60,5 +59,3 @@ ConfettiWidget.prototype.refresh = function(changedTiddlers) {
};
exports.confetti = ConfettiWidget;
})();

View File

@@ -6,7 +6,6 @@ module-type: startup
Setup the root widget event handlers
\*/
(function(){
"use strict";
// Export name and synchronous status
@@ -56,5 +55,3 @@ exports.startup = function() {
$tw.confettiManager.reset();
});
};
})();

View File

@@ -6,7 +6,6 @@ module-type: library
Manages the element spotlight effect
\*/
(function(){
"use strict";
function ElementSpotlight() {
@@ -129,5 +128,3 @@ ElementSpotlight.prototype.shineSpotlight = function(selectors) {
};
exports.ElementSpotlight = ElementSpotlight;
})();

View File

@@ -1,5 +1,3 @@
const { ElementSpotlight } = require("./element-spotlight");
/*\
title: $:/plugins/tiddlywiki/dynannotate/startup.js
type: application/javascript
@@ -8,8 +6,6 @@ module-type: startup
Startup the dyannotate background daemon to track the selection
\*/
(function(){
"use strict";
// Export name and synchronous status
@@ -56,5 +52,3 @@ exports.startup = function() {
$tw.dynannotate.elementSpotlight.shineSpotlight(selectors);
});
};
})();

View File

@@ -6,9 +6,6 @@ module-type: widget
Anchor widget to represent an innerwiki graphical anchor. Clone of the data widget
\*/
(function(){
"use strict";
exports.anchor = require("$:/core/modules/widgets/data.js").data;
})();

View File

@@ -0,0 +1,13 @@
title: $:/plugins/tiddlywiki/internals/docs
!! `<<inspect-filter>>` Procedure
{{$:/plugins/tiddlywiki/internals/filterinspection/docs/InspectFilterMacro}}
!!! `<<inspect-filter>>` Procedure Examples
{{$:/plugins/tiddlywiki/internals/filterinspection/docs/inspectfiltermacro/examples}}
!! `inspect` Operator
{{$:/plugins/tiddlywiki/internals/filterinspection/docs/inspectoperator}}

View File

@@ -0,0 +1,8 @@
title: $:/plugins/tiddlywiki/internals/filterinspection/InspectResultsTab
tags: $:/tags/AdvancedSearch/FilterResults
caption: Inspect
list-after: $:/core/ui/AdvancedSearch/Filter/FilterResults/Results
Filter evaluation trace:
<$transclude $variable="inspect-filter" filter={{$:/temp/advancedsearch}} />

View File

@@ -0,0 +1,44 @@
title: $:/plugins/tiddlywiki/internals/filterinspection/ObserveResultsTab
tags: $:/tags/AdvancedSearch/FilterResults
caption: Observe
list-after: $:/plugins/tiddlywiki/internals/filterinspection/InspectResultsTab
Log traces of this filter expression in the background. A trace will be generated every time the filter is evaluated, regardless of the context. The trace is only saved if the results are different from previous traces.
<$checkbox tiddler="$:/config/FilterObservationionEnabled" field="text" checked="yes" unchecked="no" default="no">
Enable background filter observation
</$checkbox>
<$button>
<%if [all[shadows+tiddlers]tag[$:/tags/InspectableFilter]get[text]match{$:/temp/advancedsearch}count[]match[0]] %>
<$action-createtiddler $basetitle="$:/config/inspectable-filters/filter" tags="$:/tags/InspectableFilter" type="text/plain" text={{$:/temp/advancedsearch}}/>
<%endif%>
Enable logging for this filter
</$button>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/InspectableFilter]!has[draft.of]sort[]]" variable="inspectableFilter">
<div class="tc-box tc-inspectable-filter-box">
<div class="tc-box-header">
<$text text={{{ [<inspectableFilter>get[text]] }}}/> <$link to=<<inspectableFilter>>>{{$:/core/images/open-window}}</$link>
</div>
<div class="tc-box-content">
<ol>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/FilterInspectionOutput]!has[draft.of]!sort[modified]] :filter[<inspectableFilter>get[text]match{!!filter}]" variable="inspectionOutput">
<$let transclusion=<<inspectionOutput>>>
<li>
<div class="tc-box tc-inspectable-filter-trace-box">
<div class="tc-box-header">
<$text text={{{ [<inspectionOutput>get[modified]format:date[DDth mmm YYYY 0hh:0mm:0ss]] }}}/><$link to=<<inspectionOutput>>>{{$:/core/images/open-window}}</$link>
</div>
<div class="tc-box-content">
<$transclude $variable="inspect-filter-output-unframed" jsonOutput={{{ [<inspectionOutput>get[text]] }}} />
</div>
</div>
</li>
</$let>
</$list>
</ol>
</div>
</div>
</$list>

View File

@@ -0,0 +1,17 @@
caption: inspect-filter
title: $:/plugins/tiddlywiki/internals/filterinspection/docs/InspectFilterMacro
type: text/vnd.tiddlywiki
The <<.def inspect-filter>> procedure displays a schematic representation of the filter evaluation process, including the input, output and intermediate results of evaluating the specified filter. It is based on the [[inspect operator|$:/plugins/tiddlywiki/internals/filterinspection/docs/inspectoperator]].
By default the tabs are arranged horizontally above the content. To get vertical tabs, set the `orientation` parameter to `vertical`. This is useful for narrow windows or when the content is too wide to fit in a horizontal tab layout.
!! Parameters
;filter
: The filter to be inspected
;inputFilter
: Optionally, a filter defining the input titles for the filter to be inspected, defaulting to `[all[tiddlers]]`
;orientation
: Optionally, the orientation of the schematic representation, defaulting to `horizontal`. Set to `vertical` to display the tabs vertically

View File

@@ -0,0 +1,27 @@
caption: inspect
tags: [[Filter Operators]]
title: $:/plugins/tiddlywiki/internals/filterinspection/docs/inspectoperator
type: text/vnd.tiddlywiki
The ''inspect'' operator evaluates a filter with the specified input titles and returns a JSON object containing the input, output and intermediate results of evaluating the specified filter.
|Operator Purpose |Inspect the evaluation of a filter to aid debugging |
|Operator Input |A selection of titles |
|Operator Output |A JSON object containing the input, output and intermediate results of evaluating the specified filter |
|Operator Parameter |The filter to be inspected |
The output JSON object contains the following properties:
* `input`: the input titles passed to the filter
* `inputFilter`: the filter being inspected
* `output`: the output titles resulting from evaluating the filter
* `evaluationTime`: the time taken to evaluate the filter, in milliseconds
* `runs`: an array of objects, each of which represents a single run of the filter. Each object contains the following properties:
** `prefixName`: the name of the prefix operator that was used in this run. Shortcut prefixes like `+` and `-` are expanded to their full names, e.g. `and` and `except`
** `input`: the input titles passed to the prefix operator
** `operations`: an array of objects, each of which represents the evaluation of a single operation that was performed in this run. Each object contains the following properties:
*** `operators`: an array of objects, each of which represents a single operator that was used in this run. Each object contains the following properties:
**** `operatorName`: the name of the operator
**** `operands`: an array of string operands passed to the operator
**** `input`: the input titles passed to the operator
**** `output`: the output titles resulting from evaluating the operator

View File

@@ -0,0 +1,38 @@
title: $:/plugins/tiddlywiki/internals/filterinspection/docs/inspectfiltermacro/examples
tags: [[Macro Examples]]
type: text/vnd.tiddlywiki
\procedure .example(n,eg,egvar)
<$let eg={{{ [<egvar>!is[blank]getvariable[]] :else[<eg>] }}}>
<div class="doc-example">
<$macrocall $name="copy-to-clipboard-above-right" src=<<eg>>/>
<$codeblock code=<<eg>>/>
<$list filter=`[title<.state-prefix>addsuffix{!!title}addsuffix[/]addsuffix[$(n)$]]` variable=".state">
<$reveal state=<<.state>> type="nomatch" text="show">
<dl>
<dd><$button set=<<.state>> setTo="show">Try it</$button></dd>
</dl>
</$reveal>
<$reveal state=<<.state>> type="match" text="show">
<dl>
<dd><$button set=<<.state>> setTo="">Hide</$button></dd>
</dl>
<blockquote class="doc-example-result">
<$transclude $variable="eg" $mode="block"/>
</blockquote>
</$reveal>
</$list>
</div>
</$let>
\end .example
<$macrocall $name=".example" eg="""<$transclude $variable="inspect-filter" filter="1 2 3" inputFilter="[all[tiddlers]]"/>"""/>
<$macrocall $name=".example" eg="""<$transclude $variable="inspect-filter" filter="1 2 3" inputFilter="[all[tiddlers]]" orientation="vertical"/>"""/>
<$macrocall $name=".example" eg="""<$transclude $variable="inspect-filter" filter="[title<currentTiddler>] [{$:/palette}length[]] [[marker]]" inputFilter="[all[tiddlers]]"/>"""/>
<$macrocall $name=".example" eg="""<$transclude $variable="inspect-filter" filter="[all[shadows+tiddlers]tag[$:/tags/MenuBar]!has[draft.of]] -[all[tiddlers+shadows]tag[$:/tags/TopLeftBarlimit[1]then[]else[$:/plugins/tiddlywiki/menubar/items/topleftbar]]" inputFilter="[all[tiddlers]]"/>
"""/>
<$macrocall $name=".example" eg="""<$transclude $variable="inspect-filter" filter="[tags[]prefix[$:/]] :sort[length[]add[1]] +[first[2]tagging[]]" inputFilter="[all[tiddlers]]"/>"""/>

View File

@@ -0,0 +1,5 @@
title: $:/plugins/tiddlywiki/internals/filterinspection/InspectFilterProcedures/Filters/SlowFilter
tags: $:/tags/Filter
filter: [all[tiddlers+shadows]limit[500]] :filter[<currentTiddler>length[]reverse[]multiply[3.14]]
description: [Internals Plugin] A filter that takes a long time to process

View File

@@ -0,0 +1,214 @@
title: $:/plugins/tiddlywiki/internals/filterinspection/InspectFilterProcedures
tags: $:/tags/Global
\whitespace trim
\procedure inspect-list(jsonList)
<$let
transclusion={{{ [<jsonList>indexes[]count[]addprefix[-list-]] }}}
state=<<qualify "$:/temp/filter-inspector/list">>
stateMaxRows={{{ [<state>addsuffix[max-rows]] }}}
maxRows={{{ [<stateMaxRows>get[text]!match[]else[10]] }}}
stateScroll={{{ [<state>addsuffix[scroll]] }}}
>
<$text text=<<stateScroll>>/>
<$scrollable class="tc-box-content-list-scollable" bind=<<stateScroll>>>
<div class="tc-box-content-list">
<$list filter="[<jsonList>jsonindexes[]nsort[]limit<maxRows>]" variable="indexList">
<$list-template>
<div class="tc-box-content-list-item">
<$slot $name="list-item"/>
</div>
</$list-template>
<$list-empty>
<div class="tc-box-content-list-empty">
(No items)
</div>
</$list-empty>
</$list>
<%if [<jsonList>jsonindexes[]count[]compare:number:gt<maxRows>] %>
<div class="tc-box-content-list-more">
<$button class="tc-btn-invisible tc-box-content-full-width-button" style.fill="inherit">
<$action-setfield $tiddler=<<stateMaxRows>> text={{{ [<maxRows>add[10]] }}}/>
{{$:/core/images/chevron-down}}
<$text text="more"/>
</$button>
</div>
<%endif%>
</div>
</$scrollable>
\end inspect-list
\procedure inspect-foldable-text-list(jsonList,class:"tc-box")
<$let
transclusion={{{ [[link-list-]addsuffix<class>] }}}
>
<div class=<<class>>>
<$let
state=<<qualify "$:/temp/filter-inspector/list">>
stateFolded={{{ [<state>addsuffix[folded]] }}}
folded={{{ [<stateFolded>get[text]else[no]match[yes]] }}}
>
<div class="tc-box-header">
<$button class="tc-btn-invisible tc-box-content-full-width-button" style.fill="inherit">
<%if [<folded>match[yes]] %>
<$action-setfield $tiddler=<<stateFolded>> text="no"/>
<%else%>
<$action-setfield $tiddler=<<stateFolded>> text="yes"/>
<%endif%>
<$text text={{{ [<jsonList>jsonindexes[]count[]] }}}/>
{{$:/core/images/right-arrow}}
</$button>
</div>
<%if [<folded>!match[yes]] %>
<div class="tc-box-content">
<$transclude $variable="inspect-list" jsonList=<<jsonList>>>
<$fill $name="list-item">
<$text text={{{ [<jsonList>jsonget<indexList>] }}} />
</$fill>
</$transclude>
</div>
<%endif%>
</$let>
</div>
</$let>
\end inspect-foldable-text-list
\procedure inspect-operator(jsonOperator)
<div class="tc-box tc-inspect-operator-box">
<div class="tc-box-header">
<span class="">
<$text text={{{ [<jsonOperator>jsonget[prefix]] }}} />
<$text text={{{ [<jsonOperator>jsonget[operatorName]] }}} />
</span>
<%if [<jsonOperator>jsonindexes[suffixes]length[]compare:number:gt[0]] %>
<$list filter="[<jsonOperator>jsonindexes[suffixes]nsort[]]" variable="indexSuffix">
<span class="tc-pill">
:<$text text={{{ [<jsonOperator>jsonget[suffixes],<indexSuffix>] }}} />
</span>
</$list>
<%endif%>
<$list filter="[<jsonOperator>jsonindexes[operands]nsort[]]" variable="indexOperand">
<div class="tc-split-pill">
<div class="tc-split-pill-top">
<%if [<jsonOperator>jsonget[parseTree],[operands],<indexOperand>,[variable]match[true]] %>
<$text text="<"/><$text text={{{ [<jsonOperator>jsonget[parseTree],[operands],<indexOperand>,[text]] }}}/><$text text=">"/>
<%elseif [<jsonOperator>jsonget[parseTree],[operands],<indexOperand>,[indirect]match[true]] %>
<$text text="{"/><$text text={{{ [<jsonOperator>jsonget[parseTree],[operands],<indexOperand>,[text]] }}}/><$text text="}"/>
<%else%>
<$text text="["/><$text text={{{ [<jsonOperator>jsonget[parseTree],[operands],<indexOperand>,[text]] }}}/><$text text="]"/>
<%endif%>
</div>
<div class="tc-split-pill-bottom">
<$text text={{{ [<jsonOperator>jsonget[operands],<indexOperand>] }}} />
</div>
</div>
</$list>
</div>
<div class="tc-box-content">
Evaluation time <span class="tc-pill"><$text text={{{ [<jsonOperator>jsonget[evaluationTime]fixed[8]] }}}/></span> milliseconds
</div>
</div>
\end inspect-operator
\procedure inspect-operation(jsonOperation,indexOperation)
<div class="tc-box tc-inspect-operation-box">
<div class="tc-box-header">
<span class="">Evaluation</span>
<span class="tc-pill"><$text text=<<indexOperation>> /></span>
Evaluation time <span class="tc-pill"><$text text={{{ [<jsonOperation>jsonget[evaluationTime]fixed[8]] }}}/></span> milliseconds
</div>
<div class="tc-box-content">
<$list filter="[<jsonOperation>jsonindexes[operators]nsort[]]" variable="indexOperator">
<$let
transclusion={{{ [[operator-]addsuffix<indexOperator>] }}}
jsonOperator={{{ [<jsonOperation>jsonextract[operators],<indexOperator>] }}}
>
<$transclude $variable="inspect-foldable-text-list" jsonList={{{ [<jsonOperator>jsonextract[input]] }}} class="tc-box tc-inspect-input-box"/>
<$transclude $variable="inspect-operator" jsonOperator=<<jsonOperator>>/>
</$let>
</$list>
<$list filter="[<jsonOperation>jsonindexes[operators]nsort[]last[1]]" variable="indexOperator">
<$let
transclusion={{{ [[operator-]addsuffix<indexOperator>] }}}
jsonOperator={{{ [<jsonOperation>jsonextract[operators],<indexOperator>] }}}
>
<$transclude $variable="inspect-foldable-text-list" jsonList={{{ [<jsonOperator>jsonextract[output]] }}} class="tc-box tc-inspect-output-box"/>
</$let>
</$list>
</div>
</div>
\end inspect-operation
\procedure inspect-run(jsonRun)
<$transclude $variable="inspect-foldable-text-list" jsonList={{{ [<jsonRun>jsonextract[input]] }}} class="tc-box tc-inspect-input-box"/>
<div class="tc-box tc-inspect-run-box">
<div class="tc-box-header">
<span class="">
<%if [<jsonRun>jsonget[prefix]!match[]] %>
<$text text={{{ [<jsonRun>jsonget[prefix]] }}} />
<$text text=" shortcut for "/>
<$text text={{{ [<jsonRun>jsonget[prefixName]addprefix[:]] }}} />
<%else%>
<$text text={{{ [<jsonRun>jsonget[prefixName]addprefix[:]] }}} />
<%endif%>
</span>
<%if [<jsonRun>jsonindexes[suffixes]length[]compare:number:gt[0]] %>
<$list filter="[<jsonRun>jsonindexes[suffixes]nsort[]]" variable="indexSuffix">
<span class="tc-pill">
:<$text text={{{ [<jsonRun>jsonget[suffixes],<indexSuffix>] }}} />
</span>
</$list>
<%endif%>
Evaluation time <span class="tc-pill"><$text text={{{ [<jsonRun>jsonget[evaluationTime]fixed[8]] }}}/></span> milliseconds
</div>
<div class="tc-box-content">
<div class="tc-inspect-operations-wrapper">
<$list filter="[<jsonRun>jsonindexes[operations]nsort[]]" variable="indexOperation">
<$let transclusion={{{ [[operation-]addsuffix<indexOperation>] }}}>
<$transclude $variable="inspect-operation" jsonOperation={{{ [<jsonRun>jsonextract[operations],<indexOperation>] }}} indexOperation=<<indexOperation>>/>
</$let>
</$list>
</div>
</div>
</div>
\end inspect-run
\procedure inspect-filter-output-unframed(jsonOutput,orientation:"horizontal")
<$scrollable bind={{{ [<qualify "$:/temp/filter-inspector/">addsuffix<filter>] }}}>
<div class={{{ tc-inspect-filter-box tc-inspect-filter-box-unframed [<orientation>match[horizontal]then[tc-inspect-filter-box-horizontal]] +[join[ ]] }}}>
<$list filter="[<jsonOutput>jsonindexes[runs]nsort[]]" variable="indexRun">
<$let transclusion={{{ [[run-]addsuffix<indexRun>] }}}>
<$transclude $variable="inspect-run" jsonRun={{{ [<jsonOutput>jsonextract[runs],<indexRun>] }}}/>
</$let>
</$list>
<$transclude $variable="inspect-foldable-text-list" jsonList={{{ [<jsonOutput>jsonextract[output]] }}} class="tc-box tc-inspect-output-box"/>
</div>
</$scrollable>
\end inspect-filter-output-unframed
\procedure inspect-filter-output(jsonOutput,orientation:"horizontal")
<$scrollable bind={{{ [<qualify "$:/temp/filter-inspector/">addsuffix<filter>] }}}>
<div class={{{ tc-inspect-filter-box [<orientation>match[horizontal]then[tc-inspect-filter-box-horizontal]] +[join[ ]] }}}>
<div class="tc-box">
<div class="tc-box-header">
Filter
<span class="tc-pill"><$text text={{{ [<jsonOutput>jsonget[inputFilter]] }}}/></span>
Evaluation time <span class="tc-pill"><$text text={{{ [<jsonOutput>jsonget[evaluationTime]fixed[8]] }}}/></span> milliseconds
</div>
<div class="tc-box-content">
<$list filter="[<jsonOutput>jsonindexes[runs]nsort[]]" variable="indexRun">
<$let transclusion={{{ [[run-]addsuffix<indexRun>] }}}>
<$transclude $variable="inspect-run" jsonRun={{{ [<jsonOutput>jsonextract[runs],<indexRun>] }}}/>
</$let>
</$list>
<$transclude $variable="inspect-foldable-text-list" jsonList={{{ [<jsonOutput>jsonextract[output]] }}} class="tc-box tc-inspect-output-box"/>
</div>
</div>
</div>
</$scrollable>
\end inspect-filter-output
\procedure inspect-filter(filter,inputFilter:"[all[tiddlers]]",orientation:"horizontal")
<$transclude $variable="inspect-filter-output" jsonOutput={{{ [subfilter<inputFilter>inspect<filter>] }}} orientation=<<orientation>> />
\end inspect-filter

View File

@@ -0,0 +1,29 @@
/*\
title: $:/plugins/tiddlywiki/internals/filterinspection/modules/inspect.js
type: application/javascript
module-type: filteroperator
Filter operator for inspecting the evaluation of a filter
\*/
"use strict";
var getWrappers = $tw.plugins.internals.getWrappers;
/*
Export our filter function
*/
exports.inspect = function(source,operator,options) {
var inputFilter = operator.operands[0] || "",
results,
wrappers = getWrappers(function(output) {
results = output;
},inputFilter);
// Compile the filter with wrapper functions to log the details
var compiledFilter = options.wiki.compileFilter(inputFilter,{
wrappers: wrappers
});
compiledFilter.call(options.wiki,source,options.widget);
return [JSON.stringify(results)];
};

View File

@@ -0,0 +1,212 @@
/*\
title: $:/plugins/tiddlywiki/internals/filterinspection/modules/startup.js
type: application/javascript
module-type: startup
Install hooks
\*/
"use strict";
// Export name and synchronous status
exports.name = "internals-plugin";
exports.before = ["startup"];
exports.synchronous = true;
exports.startup = function() {
// Publish public methods
$tw.plugins = $tw.plugins || {};
$tw.plugins.internals = {
getWrappers: getWrappers
};
// We accumulate the output of the filter inspection into an array. We can't directly write to the wiki since we might be in
// the middle of the refresh cycle, when writes to the wiki are not allowed
var accumulator = [];
// Add our hook for each filter evaluation
$tw.hooks.addHook("th-filter-evaluation",function(filterString,wrappers) {
// Check that filter observation is enabled
if($tw.wiki.getTiddlerText("$:/config/FilterObservationionEnabled","no") !== "yes") {
return wrappers;
}
// Get the list of filters to be inspected
var inspectedFilters = $tw.wiki.getTiddlersWithTag("$:/tags/InspectableFilter");
// Check whether this is a filter we want to inspect
if(inspectedFilters.indexOf(filterString) === -1) {
return wrappers;
}
// Don't do anything if there are already wrappers
if(wrappers.prefix || wrappers.operation || wrappers.operator) {
return wrappers;
}
// Flush the accumulator, making each filter inspection output record into a separate tiddler
var flushAccumulator = function() {
if(accumulator.length) {
$tw.utils.each(accumulator,function(jsonInspectionOutput) {
// Get the output as a string
var stringInspectionOutput = JSON.stringify(jsonInspectionOutput);
// Compute the log prefix and its length
var logPrefix = `$:/temp/filter-inspection/${ + $tw.utils.stringifyDate(new Date())}: `,
logPrefixLength = logPrefix.length;
// Check if the the output is the same as the last log with the same filter
var logTitles = [];
$tw.wiki.each(function(tiddler,title) {
if(title.substring(logPrefixLength) === jsonInspectionOutput.inputFilter) {
logTitles.push(title);
}
});
var alreadyLogged = false;
$tw.utils.each(logTitles,function(title) {
var jsonLog = $tw.wiki.getTiddlerData(title);
if($tw.utils.isArrayEqual(jsonLog.output,jsonInspectionOutput.output)) {
alreadyLogged = true;
}
});
if(alreadyLogged) {
return;
}
// Add the log tiddler
var tiddlerFields = {
title: `${logPrefix}${jsonInspectionOutput.inputFilter}`,
tags: ["$:/tags/FilterInspectionOutput"],
text: stringInspectionOutput,
filter: jsonInspectionOutput.inputFilter,
type: "application/json"
}
// console.log("Adding " + JSON.stringify(tiddlerFields));
$tw.wiki.addTiddler(new $tw.Tiddler($tw.wiki.getCreationFields(),$tw.wiki.getModificationFields(),tiddlerFields));
});
accumulator = [];
}
};
// Get our wrappers
return getWrappers(function(output) {
// Schedule a flush
if(accumulator.length === 0) {
$tw.utils.nextTick(function() {
flushAccumulator();
});
}
accumulator.push(output);
},filterString);
});
};
/*
Return the wrappers for evaluating a given filter
fnDone is a function that will be called with the output of the filter evaluation as the single argument
inputFilter is the filter to be evaluated
*/
function getWrappers(fnDone,inputFilter) {
// Skeleton output record
var output = {
inputFilter: inputFilter,
input: [],
runs: []
};
// Keep track of where the current run and the current operation are being written
var currentRun,currentOperation;
// The starting evaluation time stamp
var filterStartTime;
// Compile the filter with wrapper functions to log the details
return {
start: function(source) {
// Save the input so that we have it in the output record
source(function(tiddler,title) {
output.input.push(title);
});
// Start the timer
filterStartTime = $tw.utils.timer();
},
prefix: function(filterRunPrefixFunction,operationFunction,innerOptions) {
// Function to be called at the start of each filter run
return function(results,innerSource,innerWidget) {
// Save the details of this filte run
var details ={
input: results.toArray(),
prefixName: innerOptions.prefixName,
prefix: innerOptions.prefix,
suffixes: innerOptions.suffixes,
operations: []
};
// Save the current run so that we can add operations to it
currentRun = details.operations;
// Save the start time
var startTime = $tw.utils.timer();
// Get the filter run prefix function
var innerResults = filterRunPrefixFunction.call(null,operationFunction,innerOptions);
// Invoke the filter run
innerResults(results,innerSource,innerWidget);
// Save the end time
details.evaluationTime = $tw.utils.timer(startTime);
// Save the results of the filter run
details.output = results.toArray();
output.runs.push(details);
};
},
operation: function(operationFunction,operation) {
// Record the operation
var details = {
operators: []
}
// Save the start time
var startTime = $tw.utils.timer();
// Keep track of where the current operation should be being written
currentOperation = details.operators;
// Invoke the operation
operationFunction();
// Save the end time
details.evaluationTime = $tw.utils.timer(startTime);
// Save the results of the operation
currentRun.push(details);
},
operator: function(operatorFunction,innerSource,innerOperator,innerOptions) {
// Record the operator
var details = {
operatorName: innerOperator.operatorName,
operands: innerOperator.operands,
parseTree: innerOperator.parseTree,
prefix: innerOperator.prefix,
suffix: innerOperator.suffix,
suffixes: innerOperator.suffixes,
regexp: innerOperator.regexp,
input: []
};
// Copy the input
innerSource(function(tiddler,title) {
details.input.push(title);
});
// Save this operation
currentOperation.push(details);
// Save the start time
var startTime = $tw.utils.timer();
// Invoke the operator
var innerResults = operatorFunction.apply(null,Array.prototype.slice.call(arguments,1));
// Save the end time
details.evaluationTime = $tw.utils.timer(startTime);
// Make sure the results are an array so that we can store them
if(!$tw.utils.isArray(innerResults)) {
var resultArray = [];
innerResults(function(tiddler,title) {
resultArray.push(title);
});
innerResults = resultArray;
}
// Store the results in the output
details.output = innerResults;
// Return the results
return innerResults;
},
done: function(results) {
// Store evaluation time
output.evaluationTime = $tw.utils.timer(filterStartTime);
// Save the results of the filter evaluation
output.output = results;
// console.log(`Inspected ${JSON.stringify(output,null,4)}`);
// Invoke the done function
if(fnDone) {
fnDone(output);
}
}
};
}

View File

@@ -0,0 +1,188 @@
title: $:/plugins/tiddlywiki/internals/filterinspection/styles
tags: $:/tags/Stylesheet
\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline macrocallblock
/*
** Headed box and pills
*/
.tc-box {
border: 1px solid var(--box-foreground-color););
border-radius: 4px;
margin: 0 0 0.5em 0;
}
.tc-box .tc-box {
margin: 0.5em;
}
.tc-box-header {
padding: 0.25em;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
color: var(--box-background-color);
fill: var(--box-background-color);
background-color: var(--box-foreground-color);
display: flex;
align-items: center;
}
.tc-box-header svg {
width: 1em;
height: 1em;
margin-left: 0.25em;
}
.tc-box-header button {
color: var(--box-background-color);
background-color: var(--box-foreground-color);
}
.tc-box-content {
min-width: 4em;
padding: 0.25em;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
color: var(--box-foreground-color);
fill: var(--box-foreground-color);
background-color: var(--box-background-color);
}
.tc-box-content-list-scollable {
margin: -0.25em;
max-height: 25vh;
width: 12em;
}
.tc-box-content-list {
}
.tc-box-content-list-item {
font-size: 0.7em;
line-height: 1.1;
padding: 0.25em;
}
.tc-box-content-list-more {
font-size: 0.7em;
line-height: 1.1;
padding: 0.25em;
}
.tc-box-content-full-width-button {
display: block;
width: 100%;
text-align: left;
}
.tc-box-content-list-more,
.tc-box-content-list-more .tc-btn-invisible {
color: var(--box-background-color);
fill: var(--box-background-color);
background-color: var(--box-foreground-color);
}
.tc-box-content-list-item:nth-child(even) {
background: rgb(255, 255, 255, 0.5);
}
.tc-box-content-list-empty {
}
.tc-pill {
padding: 0.125em 0.25em;
margin: 0 0.25em;
border-radius: 6px;
color: var(--box-foreground-color);
background-color: var(--box-background-color);
}
.tc-split-pill {
display: inline-block;
padding: 0.125em 0.25em;
margin: 0 0.25em;
border-radius: 6px;
color: var(--box-foreground-color);
background-color: var(--box-background-color);
}
.tc-split-pill-top {
border-bottom: 1px solid var(--box-foreground-color);
}
.tc-split-pill-bottom {
}
/*
** Filter Inspection
*/
.tc-inspect-filter-box {
--box-background-color: <<colour code-border>>;
--box-foreground-color: <<colour code-foreground>>;
}
.tc-inspectable-filter-box {
--box-background-color: #ffebe1;
--box-foreground-color: #ff3f00;
}
.tc-inspectable-filter-trace-box {
--box-background-color: #ffdec1;
--box-foreground-color: #ff7a00;
}
.tc-inspect-filter-box.tc-inspect-filter-box-horizontal {
display: flex;
}
.tc-inspect-filter-box.tc-inspect-filter-box-horizontal > .tc-box > .tc-box-content,
.tc-inspect-filter-box.tc-inspect-filter-box-horizontal.tc-inspect-filter-box-unframed,
.tc-inspect-filter-box.tc-inspect-filter-box-horizontal .tc-inspect-run-box > .tc-box-content,
.tc-inspect-filter-box.tc-inspect-filter-box-horizontal .tc-inspect-operation-box > .tc-box-content,
.tc-inspect-filter-box.tc-inspect-filter-box-horizontal .tc-inspect-operator-box > .tc-box-content {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: flex-start;
}
.tc-inspectable-filter-box > .tc-box-content > ol {
list-style: none;
padding-left: 0;
}
.tc-inspect-operations-wrapper {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
}
.tc-inspect-run-box {
--box-background-color: #ffffcc;
--box-foreground-color: #444400;
}
.tc-inspect-operation-box {
--box-background-color: #ccffcc;
--box-foreground-color: #004400;
}
.tc-inspect-operator-box {
--box-background-color: #ffcccc;
--box-foreground-color: #440000;
}
.tc-box.tc-inspect-input-box {
--box-background-color: #ffccff;
--box-foreground-color: #440044;
}
.tc-box.tc-inspect-output-box {
--box-background-color: #4fd3d3;
--box-foreground-color: #004444;
}

View File

@@ -0,0 +1,28 @@
title: $:/plugins/tiddlywiki/internals/filterinspection/tests/wikitext/Simple
description: Test filter inspection
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
\procedure test-filter()
1 2 3 :sort[length[]add[1]]
\end
\function test-filter-wrapper()
[inspect<test-filter>]
\end
<$text text=<<test-filter>>/>
-
<$text text={{{ [<test-filter-wrapper>jsonindexes[]join[,]] }}}/>
-
<$text text={{{ [<test-filter-wrapper>jsonindexes[inputFilter]join[,]] }}}/>
-
<$text text={{{ [<test-filter-wrapper>jsonindexes[runs]join[,]] }}}/>
+
title: ExpectedResult
<p>1 2 3 :sort[length[]add[1]]-evaluationTime,input,inputFilter,output,runs--0,1,2,3</p>

View File

@@ -0,0 +1,3 @@
title: $:/plugins/tiddlywiki/internals/filterinspection/viewtemplatebody
<$transclude $variable="inspect-filter-output" jsonOutput={{!!text}} />

View File

@@ -0,0 +1,5 @@
title: $:/plugins/tiddlywiki/internals/filterinspection/cascades/viewtemplatebody
tags: $:/tags/ViewTemplateBodyFilter
list-before:
[tag[$:/tags/FilterInspectionOutput]type[application/json]then[$:/plugins/tiddlywiki/internals/filterinspection/viewtemplatebody]]

View File

@@ -0,0 +1,2 @@
title: $:/state/tab--1498284803
text: $:/core/ui/AdvancedSearch/Filter

View File

@@ -0,0 +1,2 @@
title: $:/state/tab--251342953
text: $:/plugins/tiddlywiki/internals/filterinspection/InspectResultsTab

View File

@@ -0,0 +1,2 @@
title: $:/config/FilterObservationionEnabled
text: yes

View File

@@ -0,0 +1,5 @@
title: $:/plugins/tiddlywiki/internals/testfilter
tags: $:/tags/InspectableFilter
type: text/plain
[list[$:/StoryList]]

View File

@@ -2,6 +2,6 @@
"title": "$:/plugins/tiddlywiki/internals",
"name": "Internals",
"description": "Tools for exploring the internals of TiddlyWiki",
"list": "readme",
"list": "readme docs",
"stability": "STABILITY_2_STABLE"
}

View File

@@ -1,10 +1,24 @@
title: $:/plugins/tiddlywiki/internals/readme
This plugin adds features to help explore the internals of TiddlyWiki:
This plugin adds several features to help explore the internals of TiddlyWiki, and to debug wikitext and filters.
* New preview panes showing:
** the parse tree
** the widget tree
** the raw HTML output
!! Inspecting Filter Traces
The first two include a dropdown for choosing block vs. inline parsing mode.
Filter inspection is based on a schematic visualisation that traces all the steps involved in evaluating a filter. These traces can be generated and accessed in several ways:
* Via two new tabs under the Advanced Search filter results:
** The ''Inspect'' tab shows the schematic trace for the current filter
** The ''Observe'' tab allows the current filter to be logged in the background. A new trace is generated every time the filter is evaluated, regardless of the context, if the results are different from previous evaluations
* Directly using the `<<inspect-filter>>` procedure, or the underlying `inspect[]` operator
Note that observing a filter is not the same as logging it. Observing a filter means that the filter is evaluated in the background, and a new trace is generated every time the filter is evaluated, regardless of the context. Logging a filter means that the filter is evaluated in the background, but only if the results are different from previous evaluations.
Filter observation has a performance impact, and disables certain optimisations such as caching of compiled filters.
!! Inspecting Parse Trees and Widget Trees
New preview panes for the tiddler editor that show
* the parse tree
* the widget tree
* the raw HTML output

Some files were not shown because too many files have changed in this diff Show More