1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-05-17 19:02:18 +00:00
Commit Graph

863 Commits

Author SHA1 Message Date
jeremy@jermolene.com 613f4af20f Fix refreshing of global variables
Global variables access within attributes will automatically trigger a refresh if the attribute text changes, but that wasn't happening for transclusions.
2022-05-31 09:19:01 +01:00
jeremy@jermolene.com 006ae6e759 Refactor $parameters widget
The objective is to add a $depth attribute so that it is possible to reach up to retrieve the parameters of ancestor transclusions. However, doing so requires changing the encoding of parameter names so that it is not possible for a user parameter to clash with an attribute like $depth. So now we have to double up dollars on any attribute names seen by the parameters widget, just like with the transclude widget itself.
2022-05-31 09:03:20 +01:00
jeremy@jermolene.com 150266c731 Use underscores for new system fields for global variable tiddlers
For consistency with `_canonical_uri`; unlike many system fields, the behaviour of these fields is baked into the core JS code.
2022-05-30 18:38:25 +01:00
jeremy@jermolene.com 0c3f82855b Minor cleanups 2022-05-29 10:55:15 +01:00
jeremy@jermolene.com f636349007 Introduce true global variables
The basic idea is that if we don't find a variable `foo` then we fallback to retrieving the value from the tiddler `$:/global/foo`, if it exists.

This allows us to replace the usual importvariables-based mechanism for global definitions, avoiding cluttering up the variable namespace with every macro.

In order to permit subprocedures to be overridden, we also introduce a mechanism for conditional definitions: preceding the word definition|procedure|function|widget with a + causes the definition only to occur if the specified variable doesn't already exist. In the next commit we'll apply this mechanism to the tabs macro
2022-05-28 12:23:50 +01:00
jeremy@jermolene.com dec45f0fc3 Fix importvariables to work with setvariables as well as set (they are aliases) 2022-05-26 21:11:32 +01:00
jeremy@jermolene.com cbce4ebb7b Allow custom functions to be invoked as attributes 2022-05-23 20:18:54 +01:00
jeremy@jermolene.com 22e7ec2381 Procedures and widgets inherit whitespace trim setting from their definition 2022-05-23 15:30:33 +01:00
jeremy@jermolene.com 170c4b1799 Merge branch 'master' into parameterised-transclusions 2022-05-23 11:28:12 +01:00
jeremy@jermolene.com ec1ec8ccd8 Fix invocation of JS macros 2022-05-21 16:31:34 +01:00
jeremy@jermolene.com e50101322f Require $$ for custom widgets, and that overridden JS widgets must exist
See https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1133637763
2022-05-21 15:47:19 +01:00
jeremy@jermolene.com bbd9e2f243 Rename <$value> widget to <$fill> 2022-05-13 09:18:25 +01:00
jeremy@jermolene.com 36cf50aa96 Use \widget for custom widget definitions, and remove need for angle brackets
Need to do some refactoring of all those isFunctionDefinition/isProcedureDefinition/isWidgetDefinition flags into a single property
2022-05-13 08:49:53 +01:00
jeremy@jermolene.com 904e30a0e2 Detect recursion by tracking widget tree depth
The old recursion marker approach was very slow, and didn't catch test cases like editions/test/tiddlers/tests/data/transclude/Recursion.tid
2022-05-12 16:26:33 +01:00
jeremy@jermolene.com 774459fa73 Transclude: replace paramNames/paramValues with more robust JSON payload
More details at https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1123719153
2022-05-11 13:51:11 +01:00
jeremy@jermolene.com 0b11b499c2 Better backwards compatibility for legacy recursion marker
Fixes the problem with tag dropdowns @btheado
2022-05-10 10:21:56 +01:00
jeremy@jermolene.com eef7d180a5 Remove obsolete code
Left over after refactoring
2022-05-10 10:21:19 +01:00
jeremy@jermolene.com e092113f9f Switch to using \procedure to define new-style macros, and \function for custom filter operator functions
I now need to update the OP!
2022-05-09 18:00:09 +01:00
jeremy@jermolene.com 64448ae774 Make the macrocall widget delegate to the transclude widget 2022-05-08 20:48:33 +01:00
jeremy@jermolene.com e9630328f1 Extend transclude widget to work with old-style macros and use it for the macrocall shortcut syntax 2022-05-08 15:59:20 +01:00
jeremy@jermolene.com 9be05f6f38 Use consistent parse tree node property for params 2022-05-07 13:22:53 +01:00
jeremy@jermolene.com 2fe2d20ddf Genesis widget should pass raw attributes onto child widget...
...so that it can more efficiently handle refreshing itself.
2022-05-07 11:41:28 +01:00
Simon Huber 4b8594c4a8 Fix: eventcatcher widget - variables can be undefined (#6668)
* Fix: eventcatcher widget - variables can be undefined

* Fix: selectedNode can be an svg where offsetLeft ... are undefined

* Make check for offsetLeft short

* remove second collectDOMNodeVariables
2022-05-06 17:11:13 +01:00
jeremy@jermolene.com a9938a6c67 Improve recursion detection
While retaining backwards compatibility
2022-05-06 15:00:10 +01:00
jeremy@jermolene.com e5164113c4 Don't create variables with value undefined for missing parameters 2022-05-05 14:47:22 +01:00
jeremy@jermolene.com f307f00e32 Fixes to enable the transclude widget itself to be overridden
There are two big changes here:

Replace the previous "ts-wrapper" mechanism, which we had been using to redefine custom widgets inside their definitions to prevent recursive calls. Now we've got the genesis widget we can instead control recursion through a new "$remappable" attribute that allows the custom widget mechanism to be skipped.

We also extend the slot widget to allow a depth to be specified; it then reaches up by the indicated number of transclusion widgets to find the one from which it should retrieve the slot value.
2022-05-05 08:20:14 +01:00
jeremy@jermolene.com e99137f4cc Cache parse trees when transcluding variables 2022-05-03 17:59:45 +01:00
jeremy@jermolene.com 56c2242e4e Introduce genesis widget for dynamically creating widgets
See the "RedefineLet" test for a contrived example of usage
2022-05-03 12:55:10 +01:00
jeremy@jermolene.com e1df50d981 Fix parameter handling 2022-05-03 12:54:29 +01:00
jeremy@jermolene.com c4743ebbec Fix importing of function definitions 2022-05-03 09:39:05 +01:00
jeremy@jermolene.com 8f69c27632 Reuse attribute objects when executing custom widgets 2022-05-03 09:38:41 +01:00
jeremy@jermolene.com 2ea0374b55 Allow the let widget to create variables starting with $ 2022-05-03 08:44:33 +01:00
jeremy@jermolene.com 3000d3339c Remove extraneous code 2022-05-03 08:11:00 +01:00
jeremy@jermolene.com a10106a4a6 Fix crash when transcluding an undefined variable
Thanks @pmario

See https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1114692359
2022-05-02 11:15:18 +01:00
jeremy@jermolene.com 5f02cc49fd Add support for accessing function parameters as name/value pairs 2022-05-02 10:00:50 +01:00
jeremy@jermolene.com bbc6661192 Remove erroneous "tag" property 2022-05-02 09:26:18 +01:00
jeremy@jermolene.com c9bd1b5274 Add wikitext shortcut for new-style function definitions 2022-04-30 12:44:26 +01:00
jeremy@jermolene.com 886c8620f5 Replace ubertransclude widget with transclude widget 2022-04-30 10:00:38 +01:00
jeremy@jermolene.com aac2d6ccb0 Refactor ubertransclude functionality into transclude widget 2022-04-30 09:54:55 +01:00
jeremy@jermolene.com c4991fff9e Refactor transclude widget before uberfying it 2022-04-30 09:30:25 +01:00
jeremy@jermolene.com f78e1f6f7d Importvariables should skip parameters widgets 2022-04-29 22:36:07 +01:00
jeremy@jermolene.com 89b7a3bd28 Ubertransclusion positional parameters should be based on name, not position 2022-04-29 16:28:03 +01:00
jeremy@jermolene.com 9713da5071 Add support for positional parameters 2022-04-26 21:55:43 +01:00
jeremy@jermolene.com 31c3abb7ab Add a definition for the value widget just so that it doesn't cause errors
Of course, it doesn't actually need to be a JS widget, it could be a wikitext widget...
2022-04-26 14:36:05 +01:00
jeremy@jermolene.com a401732995 Use ts- prefix for system slot names 2022-04-26 14:27:28 +01:00
jeremy@jermolene.com fae038dcbc Remove need to explicitly clear widget mapping variable when invoking overridden widget 2022-04-26 14:24:31 +01:00
jeremy@jermolene.com 35616a0b39 Don't worry about ordered attributes
The changes in 0bffae2108 mean that we don't need to explicitly maintain the ordered attributes
2022-04-26 14:05:56 +01:00
jeremy@jermolene.com 7299d4fd1d Merge branch 'master' into parameterised-transclusions 2022-04-26 14:03:03 +01:00
jeremy@jermolene.com 0bffae2108 Add utility method for getting ordered attributes 2022-04-26 14:02:31 +01:00
jeremy@jermolene.com cd0617f033 Use the ubertransclude widget for the wikitext transclusion syntax 2022-04-26 12:45:05 +01:00