1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-17 01:14:21 +00:00
Commit Graph

89 Commits

Author SHA1 Message Date
jeremy@jermolene.com
b6181e1cb1 Refactor data widget implementation
To avoid code duplication
2023-04-13 08:42:18 +01:00
jeremy@jermolene.com
683414f51e Fix positional parameters in widget.evaluateVariable()
This should clear up the remaining anomalies in #7009, let me know how you get on @btheado
2023-01-23 16:34:08 +00:00
jeremy@jermolene.com
34afe4e143 Refactor function invocation
* Introduce new widget helper function to evaluate variables.Functions are evaluated as parameterised filter strings, macros as text with textual substitution of parameters and variables, and procedures and widgets as plain text
* Refactor the function operator and unknown operator to use the new helper
* Use the new helper to evaluate variables within filter strings, thus fixing a bug whereby functions called in such a way were being returned as plain text instead of being evaluated
* Refactor the transclude widget to use the new helper
* Update tests
2023-01-21 22:07:34 +00:00
jeremy@jermolene.com
9f42007899 Filter run prefixes should use widget.makeFakeWidgetWithVariables 2022-10-25 14:13:38 +01:00
jeremy@jermolene.com
668168dfea Some widget.js cleanups 2022-09-27 08:58:10 +01:00
jeremy@jermolene.com
e3d13696c8 Remove implementation of $:/globals/
Performance with this implementation is inherently poor because of the need to perform a wiki lookup for each child widget created.
2022-09-24 12:56:06 +01:00
jeremy@jermolene.com
1aba8a1f65 Slight optimisation to user defined widgets 2022-09-24 12:41:28 +01:00
jeremy@jermolene.com
fddaa9fdb1 Merge branch 'master' into parameterised-transclusions 2022-09-24 11:07:53 +01:00
jeremy@jermolene.com
81ac987484 Optimise variable prototype chain handling
With this improvement and 53d229592d I'm measuring a 10-15% performance improvement between v5.2.3 and master using https://github.com/Jermolene/tiddlywiki-performance-test-rig
2022-09-24 08:28:16 +01:00
jeremy@jermolene.com
00b6645c94 Disable overriding core widgets in safe mode 2022-09-03 12:58:10 +01:00
jeremy@jermolene.com
79b20bdaa8 Fix up handling of slot/fill for custom widgets
Previously we were wrapping the body in an implicit `<$fill $name="ts-body">` widget
2022-06-09 18:02:47 +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
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
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
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
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
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
8f69c27632 Reuse attribute objects when executing custom widgets 2022-05-03 09:38:41 +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
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
21b10a225f Initial commit
Everything is draft.
2022-04-24 21:24:38 +01:00
Jeremy Ruston
fd0b985ac5
action-setfield shouldn't write to the current tiddler if the $tiddler attribute is present but has evaluated to a missing attribute
Fixes #5916
2022-04-16 18:02:27 +01:00
Jeremy Ruston
ab3109d84b
Add support for directly setting style.* attributes on HTML elements (#6388)
* Support direct style attributes on the element widget

* Fix tests

Not all parse tree nodes have an "orderedAttributes" member (eg. the error message generated at 5613bcc884/core/modules/widgets/transclude.js (L73-L75))

* Ensure ordering isn't insertion dependent if orderedAttributes is missing

* Add docs
2022-02-21 15:24:06 +00:00
Saq Imtiaz
76cdc17f3b
Support macro parameters in filter run prefixes (#6164)
* Support macro params in filter run prefixes and support substitution for variables set by filter run prefixes

* feat: add support macro parameters and variable substitution for all filter run prefixes

* fix: rename options argument to opts for disambiguation

* feat: add support for macro params to cascade filterrun prefix
2021-11-23 13:51:42 +00:00
Cameron Fischer
2bfe522b72
Add $let widget (#6148)
* $let widget added and tested

* Documentation for $let, doc improvements for $vars

* let properly avoids refreshing when possible

* $let Changes as recommended by others

* Removed superfluous super method call

Also improved $let test
2021-10-30 11:42:22 +01:00
jeremy@jermolene.com
4d87ef4231 Add a comment on the default value of tv-action-refresh-policy 2021-10-26 09:51:00 +01:00
jeremy@jermolene.com
3094e06236 Add support for full refreshing of action widgets
Fixes #5791
2021-07-02 14:33:38 +01:00
jeremy@jermolene.com
056e6541a1 Revert 582b156d5f2b9b8b92f9289aa1288e1edb637450: Refresh non-action widgets before invocation 2021-06-02 21:47:28 +01:00
jeremy@jermolene.com
55c522ab8f Improve comments
As per @pmario's comment at 582b156d5f (commitcomment-51566608)
2021-06-01 11:49:05 +01:00
jeremy@jermolene.com
582b156d5f Refresh non-action widgets before invoking them
Fixes #5744
2021-06-01 09:28:04 +01:00
Joe Bordes
82ec63e711
style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
jeremy@jermolene.com
80ee5adb14 Extend transclude widget to optionally set variables
Partially fixes #5199
2021-03-19 15:37:59 +00:00
Jeremy Ruston
0b1a05d10d
Cache result of parsing macro calls which don't use text subsitution (#5205) 2020-12-06 09:43:06 +00:00
jeremy@jermolene.com
9637a29e55 Rename widget.executeStartupTiddlers() to invokeActionsByTag()
This method was introduced earlier in v5.1.23 in  5cc1600072

It is not in fact restricted to startup tiddlers.
2020-11-26 12:41:24 +00:00
jeremy@jermolene.com
5cc1600072 Introduce post-render startup actions 2020-10-25 16:22:21 +00:00
jeremy@jermolene.com
33d973fb91 Add originating widget to event objects 2020-05-09 15:53:38 +01:00
Cameron Fischer
b67e088e55 Reducing function calls across board (#4102) 2019-07-14 16:20:27 +01:00