diff --git a/editions/tw5.com/tiddlers/macros/TagMacro.tid b/editions/tw5.com/tiddlers/macros/TagMacro.tid index 7a7beb0bc..eda75dcb9 100644 --- a/editions/tw5.com/tiddlers/macros/TagMacro.tid +++ b/editions/tw5.com/tiddlers/macros/TagMacro.tid @@ -1,12 +1,14 @@ caption: tag created: 20141206130540337 -modified: 20150221224326000 +modified: 20230725201240201 tags: Macros [[Core Macros]] title: tag Macro type: text/vnd.tiddlywiki The <<.def tag>> [[macro|Macros]] generates a tag pill for a specified tag. Clicking the tag pill opens a dropdown. This can be compared to the [[tag-pill Macro]] which also features other parameters. +<<.tip """If a [[list widget|ListWidget]] generates multiple tag macros for the same tag, clicking on one of them will open dropdowns on all of them. The simplest way to prevent this is to add the `counter="transclusion"` attribute to the list widget. See the examples below for more details.""">> + !! Parameters ;tag diff --git a/editions/tw5.com/tiddlers/macros/examples/tag.tid b/editions/tw5.com/tiddlers/macros/examples/tag.tid index 915c175e5..103a5eab7 100644 --- a/editions/tw5.com/tiddlers/macros/examples/tag.tid +++ b/editions/tw5.com/tiddlers/macros/examples/tag.tid @@ -1,8 +1,29 @@ created: 20150221211317000 -modified: 20150221224519000 +modified: 20230725203751870 tags: [[tag Macro]] [[Macro Examples]] title: tag Macro (Examples) type: text/vnd.tiddlywiki <$macrocall $name=".example" n="1" eg="""<>"""/> <$macrocall $name=".example" n="2" eg="""<>"""/> + +If a [[list widget|ListWidget]] generates multiple tag macros for the same tag, clicking any of them opens dropdowns on all of them, as in the example below. This is usually unwanted. +<$macrocall $name=".example" n="3" eg="""<$list filter="[tag[HelloThere]]"> + +* <$link/> is tagged with: <$list filter="[tags[]]"> <> + +"""/> + +Adding the `counter="transclusion"` attribute to the list widget that generates multiple identical tag macros causes each of them to be identified as a unique one. Clicking on any of them opens only a single dropdown. +<$macrocall $name=".example" n="4" eg="""<$list filter="[tag[HelloThere]]" counter="transclusion"> + +* <$link/> is tagged with: <$list filter="[tags[]]"> <> + +"""/> + +A slightly more performant option is to use the `variable="transclusion"` attribute in the list widget. In this case, the variable `<>` has to be used inside the list widget instead of the `<>` . +<$macrocall $name=".example" n="5" eg="""<$list filter="[tag[HelloThere]]" variable="transclusion"> + +* <$link to=<>/> is tagged with: <$list filter="[tags[]]"> <> + +"""/> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-close-window.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-close-window.tid index 739efb192..07b69e5b9 100644 --- a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-close-window.tid +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-close-window.tid @@ -1,6 +1,6 @@ caption: tm-open-window created: 20220228140417116 -modified: 20220409092811188 +modified: 20230723220539648 tags: Messages title: WidgetMessage: tm-close-window type: text/vnd.tiddlywiki @@ -29,7 +29,7 @@ src=""" width="400" height="500" windowID="window1" - something="I just in over in a variable, and boy is my Hashmap tired." /> + something="I just flew in on a variable, and boy is my Hashmap tired." /> <$button>Close Window <$action-sendmessage diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-download-file.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-download-file.tid index 128966501..e80c1aba8 100644 --- a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-download-file.tid +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-download-file.tid @@ -1,15 +1,15 @@ +caption: tm-download-file created: 20140811112201235 -modified: 20220123141646321 +modified: 20230723214745520 tags: Messages title: WidgetMessage: tm-download-file type: text/vnd.tiddlywiki -caption: tm-download-file The download file message causes the current saver module to prompt the user to download the result of parsing a specified template tiddler as a file. It requires the following properties on the `event` object: |!Name |!Description | |param |Title of a tiddler to use as a template for the new tiddler | -|paramObject |Optional hashmap of variable values to use for the rendering | +|//{any other params}// |Any other parameters are made available as variables within the context of the widget message. | The following variable names have special behaviour: diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-bitmap-operation.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-bitmap-operation.tid index e8df75efd..edbc5ce5d 100644 --- a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-bitmap-operation.tid +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-bitmap-operation.tid @@ -1,6 +1,6 @@ caption: tm-edit-bitmap-operation created: 20160424204236050 -modified: 20160424215219517 +modified: 20230723214716576 tags: Messages title: WidgetMessage: tm-edit-bitmap-operation type: text/vnd.tiddlywiki @@ -30,12 +30,12 @@ Clears the contents of the image and fills it with a solid colour. Parameters in \end - A `tm-edit-bitmap-operation` invokes one of the available operations on a __surrounding__ bitmap editor. Therefore the message has to be dispatched within the editor in order for it to catch it. The following properties on the `event` object are required: |!Name |!Description | |param |Name of the operation to be executed, see ''below'' for a list of possible operations | -|paramObject| Hashmap of additional parameters required by the operation top be executed | +|//{any other params}// |Any other parameters are made available as variables within the context of the widget message. | + The `tm-edit-bitmap-operation` message is usually generated by a ButtonWidget or an ActionWidget and is handled by the surrounding bitmap editor. diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-text-operation.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-text-operation.tid index 9737c3b24..a34fe3fc0 100644 --- a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-text-operation.tid +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-edit-text-operation.tid @@ -1,6 +1,6 @@ caption: tm-edit-text-operation created: 20160424211339792 -modified: 20210520053923011 +modified: 20230723214636245 tags: Messages title: WidgetMessage: tm-edit-text-operation type: text/vnd.tiddlywiki @@ -121,7 +121,7 @@ A `tm-edit-text-operation` invokes one of the available operations on a __surrou |!Name |!Description | |param |Name of the operation to be executed, see ''below'' for a list of possible operations | -|paramObject|Hashmap of additional parameters required by the operation top be executed | +|//{any other params}// |Any other parameters are made available as variables within the context of the widget message. | The `tm-edit-text-operation` message is usually generated by a ButtonWidget or an ActionWidget and is handled by the surrounding text editor. diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-focus-selector.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-focus-selector.tid index 1b33502ed..c041e15dc 100644 --- a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-focus-selector.tid +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-focus-selector.tid @@ -1,6 +1,6 @@ caption: tm-focus-selector created: 20190628162542132 -modified: 20190628162542132 +modified: 20230723215122038 tags: Messages title: WidgetMessage: tm-focus-selector type: text/vnd.tiddlywiki @@ -9,6 +9,6 @@ The `tm-focus-selector` message sets the focus to the DOM element identified by |!Name |!Description | |param |Selector identifying the DOM element to be focussed | -|paramObject |Optional hashmap of additional parameters to be passed to the [[focus()|https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus]] method | +|//{any other params}// |Any other parameters to be passed to the [[focus()|https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus]] method as variables.| <<.tip """Use preventScroll="true" to prevent the browser from scrolling to the focused element""">> diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request.tid index 9c441c524..9ae71cf7a 100644 --- a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request.tid +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-http-request.tid @@ -1,6 +1,6 @@ caption: tm-http-request created: 20230429161453032 -modified: 20230717104212742 +modified: 20230723215344887 tags: Messages title: WidgetMessage: tm-http-request type: text/vnd.tiddlywiki @@ -11,7 +11,7 @@ It uses the following properties on the `event` object: |!Name |!Description | |param |Not used | -|paramObject |Hashmap of parameters (see below) | +|//{any other params}// |Any other parameters are made available as variables within the context of the widget message. See below. | The following parameters are used: diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-modal.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-modal.tid index 9b459fb7b..158bb7878 100644 --- a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-modal.tid +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-modal.tid @@ -1,13 +1,13 @@ caption: tm-modal created: 20140811112133701 -modified: 20201117081247738 +modified: 20230723215434712 tags: Messages title: WidgetMessage: tm-modal type: text/vnd.tiddlywiki |!Name |!Description | |param |Title of the tiddler to be displayed | -|paramObject |Hashmap of variables to be provided to the modal, contains all extra parameters passed to the widget sending the message. | +|//{any other params}// |Any other parameters are made available as variables within the context of the widget message. | |rootwindow |<<.from-version 5.1.18>> ''yes'' or ''true'' will always display a modal in the wiki-root-window | The modal message is usually generated with the ButtonWidget. The modal message is handled by the TiddlyWiki core. diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-new-tiddler.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-new-tiddler.tid index d435d5f4f..c487f015f 100644 --- a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-new-tiddler.tid +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-new-tiddler.tid @@ -1,6 +1,6 @@ caption: tm-new-tiddler created: 20140226194405353 -modified: 20220521143507491 +modified: 20230723215831560 tags: Messages navigator-message title: WidgetMessage: tm-new-tiddler type: text/vnd.tiddlywiki @@ -9,12 +9,12 @@ The new tiddler message creates a new draft tiddler and adds it to the current s |!Name |!Description | |param |The optional title of a tiddler to use as a template for the new tiddler | -|paramObject |Optional hashmap of additional tiddler fields | +|//{any other params}// |The names and values of additional tiddler fields. | |navigateFromTitle |Title of the tiddler from which the navigation to the new tiddler was initiated | The title for the draft tiddler is chosen according to these rules: -* If a hashmap was used and a title field was specified, use that title +* If additional parameters were used and a title field was specified, use that title * If a template tiddler was used, use the title of the template tiddler, making it unique with a numeric suffix * Otherwise, generate a new title based on the default new tiddler title with a numeric suffix to make it unique diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-notify.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-notify.tid index f44839f45..b64f4a573 100644 --- a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-notify.tid +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-notify.tid @@ -1,14 +1,14 @@ +caption: tm-notify created: 20140811112304772 -modified: 20160701140248738 +modified: 20230723220728382 tags: Messages title: WidgetMessage: tm-notify type: text/vnd.tiddlywiki -caption: tm-notify The notify message briefly displays a specified tiddler as a small alert in the upper right corner of the page. It requires the following properties on the `event` object: |!Name |!Description | |param |Title of the tiddler to be displayed | -|paramObject |Hashmap of variables to be provided to the notification | +|//{any other params}// |Any other parameters are made available as variables to the notify message. | The notify message is handled by the TiddlyWiki core. diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-open-external-window.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-open-external-window.tid index 960f94f2f..4e868312c 100644 --- a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-open-external-window.tid +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-open-external-window.tid @@ -1,6 +1,6 @@ caption: tm-open-external-window -created: 201701211823 -modified: 201701211825 +created: 20170121182300000 +modified: 20230723220850135 tags: Messages title: WidgetMessage: tm-open-external-window type: text/vnd.tiddlywiki @@ -11,7 +11,8 @@ The `tm-open-external-window` message opens an external link eg: "https://tiddly |!Name |!Description | |param |URL of the tiddler to be opened in a new browser window, defaults to the [[TiddlyWiki help|https://tiddlywiki.com/#WidgetMessage%3A%20tm-open-external-window if empty]] | -|paramObject |Optional: Hashmap of variables that will be provided to the window. see below | +|//{any other params}// |Any other parameters are made available as variables to the window. See below. | + ''parmObject'' diff --git a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-save-wiki.tid b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-save-wiki.tid index 605ee37e8..701caa4f2 100644 --- a/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-save-wiki.tid +++ b/editions/tw5.com/tiddlers/messages/WidgetMessage_ tm-save-wiki.tid @@ -1,15 +1,15 @@ +caption: tm-save-wiki created: 20140811112325641 -modified: 20141110133723696 +modified: 20230723220944427 tags: Messages title: WidgetMessage: tm-save-wiki type: text/vnd.tiddlywiki -caption: tm-save-wiki The save wiki message causes the current saver module to perform a full save operation. The save operation can involve user interaction. It requires the following properties on the `event` object: |!Name |!Description | |param |Title of a tiddler to use as a template for rendering the wiki (defaults to `$:/core/save/all`) | -|paramObject |Optional hashmap of variable values to use for the rendering | +|//{any other params}// |Any other parameters are made available as variables to use for the rendering. | The save wiki message is usually generated by the ButtonWidget. diff --git a/editions/tw5.com/tiddlers/pragmas/Pragma_ _procedure.tid b/editions/tw5.com/tiddlers/pragmas/Pragma_ _procedure.tid index 076d26687..06b0251d5 100644 --- a/editions/tw5.com/tiddlers/pragmas/Pragma_ _procedure.tid +++ b/editions/tw5.com/tiddlers/pragmas/Pragma_ _procedure.tid @@ -1,5 +1,5 @@ created: 20221007132845007 -modified: 20230518152756112 +modified: 20230724184009153 tags: Pragmas title: Pragma: \procedure type: text/vnd.tiddlywiki @@ -19,7 +19,7 @@ Note that the `\end` marker can optionally specify the name of the procedure to There is also a single line form for shorter procedures: ``` -\define ([:],[:]...) +\procedure ([:],[:]...) ``` The first line of the definition specifies the procedure name and any parameters. Each parameter has a name and, optionally, a default value that is used if no value is supplied on a particular call to the procedure. The lines that follow contain the text of the procedure text (i.e. the snippet represented by the procedure name), until `\end` appears on a line by itself: diff --git a/editions/tw5.com/tiddlers/pragmas/Pragma_ _rules.tid b/editions/tw5.com/tiddlers/pragmas/Pragma_ _rules.tid index 799c9b71c..56aa4d665 100644 --- a/editions/tw5.com/tiddlers/pragmas/Pragma_ _rules.tid +++ b/editions/tw5.com/tiddlers/pragmas/Pragma_ _rules.tid @@ -1,5 +1,5 @@ created: 20220917112931273 -modified: 20230419103154329 +modified: 20230724184044642 tags: Pragmas title: Pragma: \rules type: text/vnd.tiddlywiki @@ -7,7 +7,7 @@ type: text/vnd.tiddlywiki The ''\rules'' [[pragma|Pragmas]] adjusts the set of parser rules used to parse the remaining text. ``` -\rules only|expect +\rules only|except ``` The list of available parser rules can be consulted in $:/ControlPanel -> Info -> Advanced -> Parsing. diff --git a/editions/tw5.com/tiddlers/variables/Behaviour of invoked variables depends on how the variable was declared.tid b/editions/tw5.com/tiddlers/variables/Behaviour of invoked variables depends on how the variable was declared.tid new file mode 100644 index 000000000..319bf2c78 --- /dev/null +++ b/editions/tw5.com/tiddlers/variables/Behaviour of invoked variables depends on how the variable was declared.tid @@ -0,0 +1,52 @@ +created: 20230726145210484 +modified: 20230726145757234 +tags: [[Variable Usage]] +title: Behaviour of invoked variables depends on how the variable was declared +type: text/vnd.tiddlywiki + +\define m1(a1) $a1$ - <<__a1__>> - <> +\procedure p1(a1) $a1$ - <<__a1__>> - <> +\function f1(a1) "$a1$" "-" [<__a1__>] ="-" [] :and[join[ ]] + +Invoked in normal wikitext context: `<$transclude $variable=macro/>` or `<>` + +{{Behaviour of variables invoked via normal wikitext}} + +Invoked via widget attribute: `
>/>` + +{{Behaviour of variables invoked via widget attributes}} + +Invoked via filter operator parameter: `[]` + +{{Behaviour of variables invoked via filter operator parameter}} + +Invoked via function call in a filter expression: `[function[macro]]` + +{{Behaviour of variables invoked via filter expression function call}} + +!! Examples + +Below is an example macro, procedure and function definition. All three forms of parameter substitution `$a1$`, `<<__a1__>>`, and `<>` are included in each definition. The output helps illustrate when each form of substitution will or will not have affect. + +``` +\define m1(a1) $a1$ - <<__a1__>> - <> +\procedure p1(a1) $a1$ - <<__a1__>> - <> +\function f1(a1) $a1$ "-" [<__a1__>] ="-" [] :and[join[ ]] +``` + +| !Variable transclusion|!output | +| `<>`|<>| +| `<>`|<>| +| `<>`|<>| +| !Widget attribute|!output | +| `<$text text=<>/>`|<$text text=<>/>| +| `<$text text=<>/>`|<$text text=<>/>| +| `<$text text=<>/>`|<$text text=<>/>| +| !Filter operator parameter|!output | +| `[]`|<$text text={{{[]}}}/>| +| `[]`|<$text text={{{[]}}}/>| +| `[]`|<$text text={{{[]}}}/>| +| !Function call in filter expression|!output | +| `[function[m1],[foo]]`|<$text text={{{[function[m1],[foo]]}}}/>| +| `[function[p1],[foo]]`|<$text text={{{[function[p1],[foo]]}}}/>| +| `[function[f1],[foo]]`|<$text text={{{[function[f1],[foo]]}}}/>| \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via filter expression function call.tid b/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via filter expression function call.tid new file mode 100644 index 000000000..52d44c9fd --- /dev/null +++ b/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via filter expression function call.tid @@ -0,0 +1,10 @@ +created: 20230726143929233 +modified: 20230726150604831 +tags: [[Variable Usage]] +title: Behaviour of variables invoked via filter expression function call +type: text/vnd.tiddlywiki + +|tc-first-col-min-width|k +|!how declared|!behaviour| +|\define, <<.wlink SetWidget>>, <<.wlink LetWidget>>, <<.wlink VarsWidget>>, \procedure, \widget|Every function is a variable, but only variables defined using \function are invokable using the <<.olink function>> filter operator. Attempts to use a non-function variable is the same as if the function doesn't exist. The behavior in this case is like the identity function. All filter input is passed unchanged to the output.| +|\function|The body text of the function is treated as a filter expression and evaluated. This filter expression can itself contain a function call. Filter expressions can be factored out into functions arbitrarily deep.| \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via filter operator parameter.tid b/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via filter operator parameter.tid new file mode 100644 index 000000000..8c652488b --- /dev/null +++ b/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via filter operator parameter.tid @@ -0,0 +1,11 @@ +created: 20230726143617389 +modified: 20230726150625716 +tags: [[Variable Usage]] +title: Behaviour of variables invoked via filter operator parameter +type: text/vnd.tiddlywiki + +|tc-first-col-min-width|k +|!how declared|!behaviour| +|\define|Textual substitution of parameters is performed on the body text. No further processing takes place. The result after textual substitution is used as the filter operator's parameter.| +|<<.wlink SetWidget>>, <<.wlink LetWidget>>, <<.wlink VarsWidget>>, \procedure, \widget|Body text is retrieved as-is and used as the filter operator's parameter.| +|\function|The body text of the function is treated as a filter expression and evaluated. The first result is passed to the operator as a parameter. The remaining results are discarded.| \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via normal wikitext.tid b/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via normal wikitext.tid new file mode 100644 index 000000000..0caa74c26 --- /dev/null +++ b/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via normal wikitext.tid @@ -0,0 +1,11 @@ +created: 20230726142925020 +modified: 20230726150648189 +tags: [[Variable Usage]] +title: Behaviour of variables invoked via normal wikitext +type: text/vnd.tiddlywiki + +|tc-first-col-min-width|k +|!how declared|!behaviour| +|\define|All wikitext and variable substitution and textual substitution takes place| +|<<.wlink SetWidget>>, <<.wlink LetWidget>>, <<.wlink VarsWidget>>, \procedure, \widget|All wikitext and variable substitution takes place| +|\function|Invoking a function in this way (`<>`) is a synonym for `<$text text={{{[function[macro]]}}}/>`. As with any filtered transclusion (i.e. triple curly braces), all results except the first are discarded| \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via widget attributes.tid b/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via widget attributes.tid new file mode 100644 index 000000000..3bf06e219 --- /dev/null +++ b/editions/tw5.com/tiddlers/variables/Behaviour of variables invoked via widget attributes.tid @@ -0,0 +1,11 @@ +created: 20230726143332803 +modified: 20230726150616232 +tags: [[Variable Usage]] +title: Behaviour of variables invoked via widget attributes +type: text/vnd.tiddlywiki + +|tc-first-col-min-width|k +|!how declared|!behaviour| +|\define|Textual substitution of parameters is performed on the body text. No further processing takes place. The result after textual substitution is used as the attribute's value| +|<<.wlink SetWidget>>, <<.wlink LetWidget>>, <<.wlink VarsWidget>>, \procedure, \widget|Body text is retrieved as-is and used as the attribute's value.| +|\function|When a function is invoked as `
>/>`, it is a synonym for `
`. As with any filtered transclusion (i.e. triple curly braces), all results except the first are discarded. That first result is used as the attribute's value. Note that functions are recursively processed even when invoked in this form. In other words a filter expression in a function can invoke another function and the processing will continue| \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/variables/Variable Usage.tid b/editions/tw5.com/tiddlers/variables/Variable Usage.tid index 9db23a456..962137e68 100644 --- a/editions/tw5.com/tiddlers/variables/Variable Usage.tid +++ b/editions/tw5.com/tiddlers/variables/Variable Usage.tid @@ -1,13 +1,9 @@ created: 20230421020225031 -modified: 20230422144812613 +modified: 20230726145912019 tags: title: Variable Usage type: text/vnd.tiddlywiki -\define m1(a1) $a1$ - <<__a1__>> - <> -\procedure p1(a1) $a1$ - <<__a1__>> - <> -\function f1(a1) "$a1$" "-" [<__a1__>] ="-" [] :and[join[ ]] - !Ways to define variables and parameters |! how declared|! how parameters are defined|! accessing parameter values in the body| |\define|`()`|`$param$, <<__param__>>`| @@ -100,50 +96,10 @@ These examples are meant to provide insight into the various ways of defining an -!Behavior of invoked variables depends on how the variable was declared +!Behaviour of invoked variables depends on how the variable was declared -|!how invoked|!how declared|!behavior| -|`<$transclude $variable=macro/>` or `<>` in normal wikitext context|\define|All wikitext and variable substitution and textual substitution takes place| -|~|<<.wlink SetWidget>>, <<.wlink LetWidget>>, <<.wlink VarsWidget>>, \procedure, \widget|All wikitext and variable substitution takes place| -|~|\function|Invoking a function in this way (`<>`) is a synonym for `<$text text={{{[function[macro]]}}}/>`. As with any filtered transclusion (i.e. triple curly braces), all results except the first are discarded.| -|||| -|widget attribute: `
>/>`|\define|Textual substitution of parameters is performed on the body text. No further processing takes place. The result after textual substitution is used as the attribute's value| -|~|<<.wlink SetWidget>>, <<.wlink LetWidget>>, <<.wlink VarsWidget>>, \procedure, \widget|Body text is retrieved as-is and used as the attribute's value.| -|~|\function|When a function is invoked as `
>/>`, it is a synonym for `
`. As with any filtered transclusion (i.e. triple curly braces), all results except the first are discarded. That first result is used as the attribute's value. Note that functions are recursively processed even when invoked in this form. In other words a filter expression in a function can invoke another function and the processing will continue| -|||| -|filter operator parameter: `[]`|\define|Textual substitution of parameters is performed on the body text. No further processing takes place. The result after textual substitution is used as the filter operator's parameter.| -|~|<<.wlink SetWidget>>, <<.wlink LetWidget>>, <<.wlink VarsWidget>>, \procedure, \widget|Body text is retrieved as-is and used as the filter operator's parameter.| -|~|\function|The body text of the function is treated as a filter expression and evaluated. The first result is passed to the operator as a parameter. The remaining results are discarded| -|||| -|function call in a filter expression: `[function[macro]]`|\define, <<.wlink SetWidget>>, <<.wlink LetWidget>>, <<.wlink VarsWidget>>, \procedure, \widget|Every function is a variable, but only variables defined using \function are invokable using the <<.olink function>> filter operator. Attempts to use a non-function variable is the same as if the function doesn't exist. The behavior in this case is like the identity function. All filter input is passed unchanged to the output.| -|~|\function|The body text of the function is treated as a filter expression and evaluated. This filter expression can itself contain a function call. Filter expressions can be factored out into functions arbitrarily deep.| +{{Behaviour of invoked variables depends on how the variable was declared}} -!! Examples - -Below is an example macro, procedure and function definition. All three forms of parameter substitution `$a1$`, `<<__a1__>>`, and `<>` are included in each definition. The output helps illustrate when each form of substitution will or will not have affect. - -``` -\define m1(a1) $a1$ - <<__a1__>> - <> -\procedure p1(a1) $a1$ - <<__a1__>> - <> -\function f1(a1) $a1$ "-" [<__a1__>] ="-" [] :and[join[ ]] -``` - -| !Variable transclusion|!output | -| `<>`|<>| -| `<>`|<>| -| `<>`|<>| -| !Widget attribute|!output | -| `<$text text=<>/>`|<$text text=<>/>| -| `<$text text=<>/>`|<$text text=<>/>| -| `<$text text=<>/>`|<$text text=<>/>| -| !Filter operator parameter|!output | -| `[]`|<$text text={{{[]}}}/>| -| `[]`|<$text text={{{[]}}}/>| -| `[]`|<$text text={{{[]}}}/>| -| !Function call in filter expression|!output | -| `[function[m1],[foo]]`|<$text text={{{[function[m1],[foo]]}}}/>| -| `[function[p1],[foo]]`|<$text text={{{[function[p1],[foo]]}}}/>| -| `[function[f1],[foo]]`|<$text text={{{[function[f1],[foo]]}}}/>| !Namespaces diff --git a/editions/tw5.com/tiddlers/widgets/ListWidget.tid b/editions/tw5.com/tiddlers/widgets/ListWidget.tid index 0404f643f..b36d0f3bf 100644 --- a/editions/tw5.com/tiddlers/widgets/ListWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/ListWidget.tid @@ -1,6 +1,6 @@ caption: list created: 20131024141900000 -modified: 20220718120325494 +modified: 20230725203601441 tags: Widgets Lists title: ListWidget type: text/vnd.tiddlywiki @@ -119,6 +119,8 @@ Displays as: Note that using the `counter` attribute can reduce performance when working with list items that dynamically reorder or update themselves. The best advice is only to use it when it is really necessary: to obtain a numeric index, or to detect the first or last entries in the list. +Setting `counter="transclusion"` is a handy way to make child elements for each list element be identified as unique. A common use case are multiple [[tag macros|tag Macro]] for the same tag generated by a list widget. Refer to [[tag macro examples|tag Macro (Examples)]] for more details. + !! Edit mode The `<$list>` widget can optionally render draft tiddlers through a different template to handle editing, see DraftMechanism. diff --git a/editions/tw5.com/tiddlers/wikitext/Styles and Classes in WikiText.tid b/editions/tw5.com/tiddlers/wikitext/Styles and Classes in WikiText.tid index eadbd2227..82e37309f 100644 --- a/editions/tw5.com/tiddlers/wikitext/Styles and Classes in WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/Styles and Classes in WikiText.tid @@ -1,21 +1,23 @@ +caption: Styles and Classes created: 20131205160532119 -modified: 20131205160549129 +modified: 20230726105744098 tags: WikiText [[How to apply custom styles]] title: Styles and Classes in WikiText type: text/vnd.tiddlywiki -caption: Styles and Classes -Content can be wrapped in `@@`double at signs`@@` to apply specified CSS styles or classes to it. There are multiple ways to use this syntax, as presented below. +CSS styles and classes can be applied to inline or block content wrapped in `@@double at signs@@`. Classes can be applied to certain block WikiText elements. -Inline content wrapped in `@@`double at signs`@@` without specifying style or class will be assigned the `.tc-inline-style` and displayed as highlighted text. The foreground and background colours of the highlighted text are defined as `highlight-background` and `highlight-foreground` in the current palette. +//Inline content// wrapped in `@@double at signs@@` without specifying style or class will be assigned the `tc-inline-style` class and displayed as highlighted text. The foreground and background colours of the highlighted text are defined as `highlight-background` and `highlight-foreground` in the current palette. -<> +<> -Style attributes, e.g. `color`, each followed by `;` semicolon can be introduced immediately after the opening `@@`. +!! Styles -<> +Multiple style attributes, e.g. `color`, each followed by `;` semicolon can be introduced immediately after the opening `@@`, without spaces in between. -Similarly a style can be applied to a multiline content: +<> + +Similarly, styles can be applied to //block content//. Wrapping block content in `@@` without specifying style or class has no effect. <> -A class may be applied to a multiline content only: +!! Classes -< +.coloured-text {color: darkkhaki;} +.coloured-bg {background-color: cornsilk;} + + +Multiple classes, each prefixed with `.`, can be introduced immediately after the opening `@@`, followed by a ` ` space. This works both for inline and block content: + +<> + +<> -Multiple classes and styles can be used together: +Multiple classes and styles can be applied simultaneously. In case of inline content, the styles have to be defined first, followed by the classes. -<> +<> + +In case of block content, the styles and classes can be defined in a single line after the opening `@@` identically as for the inline content, or in separate lines, each beginning with `@@`: + +<> + +In a similar way classes, but not styles, can be applied to those block WikiText elements that are introduced through characters on the beginning of the line. The classes prefixed with `.` are specified immediately after the special characters, followed by a ` ` space. + +<> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/wikitext/Variable Attribute Values.tid b/editions/tw5.com/tiddlers/wikitext/Variable Attribute Values.tid index d65d81871..e233feb5a 100644 --- a/editions/tw5.com/tiddlers/wikitext/Variable Attribute Values.tid +++ b/editions/tw5.com/tiddlers/wikitext/Variable Attribute Values.tid @@ -1,5 +1,5 @@ created: 20230615045239825 -modified: 20230615045312961 +modified: 20230726151053593 tags: [[Widget Attributes]] WikiText title: Variable Attribute Values type: text/vnd.tiddlywiki @@ -11,4 +11,7 @@ Variable attribute values are indicated with double angle brackets around a [[ma ...
``` -<<.warning "The text from the definition of the macro will be retrieved and text substitution will be performed (i.e. <<.param $param$>> and <<.param $(...)$>> syntax). The value of the attribute value will be the resulting text. Any wiki syntax in that text (including further macro calls and variable references) will be left as-is.">> \ No newline at end of file + +The behaviour of variables invoked via widget attributes is not the same as when they are [[invoked via normal wikitext|Behaviour of variables invoked via normal wikitext]]. In addition, the behaviour depends on how the variable is declared: + +{{Behaviour of variables invoked via widget attributes}} diff --git a/editions/tw5.com/tiddlers/wikitext/Widgets in WikiText.tid b/editions/tw5.com/tiddlers/wikitext/Widgets in WikiText.tid index c23c3475f..67503cd89 100644 --- a/editions/tw5.com/tiddlers/wikitext/Widgets in WikiText.tid +++ b/editions/tw5.com/tiddlers/wikitext/Widgets in WikiText.tid @@ -20,6 +20,7 @@ Note that widgets inherit all the features of [[HTML in WikiText]]: ** Macro invocations (eg `attr=<>`) ** Transclusions (eg, `attr={{MyTiddler!!field}}`) ** Filtered transclusions (eg, `attr={{{ [filter[op]] }}}`) +** <<.from-version "5.3.0">> [[Substituted Attribute Values]] * The content of a widget is [[parsed|WikiText Parser Modes]] in [[inline mode|Inline Mode WikiText]] unless the opening tag is followed by two linebreaks, which forces [[block mode|Block Mode WikiText]] ** [[inline mode|Inline Mode WikiText]] means that [[block mode|Block Mode WikiText]] parse rules like headings, tables and lists are not recognised diff --git a/licenses/cla-individual.md b/licenses/cla-individual.md index c02612029..c2d215e86 100644 --- a/licenses/cla-individual.md +++ b/licenses/cla-individual.md @@ -538,4 +538,10 @@ WhiteFall, @Zacharia2, 2023/06/04 @oeyoews, 2023/06/30 +Eric Haberstroh, @pille1842, 2023/07/23 + +@lilscribby, 2023-07-24 + +@TiddlyTweeter, 2023/07/25 + @catter-fly, 2023/07/27