1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 10:07:19 +00:00

Merge branch 'tiddlywiki-com'

This commit is contained in:
Jeremy Ruston 2023-07-31 12:16:12 +01:00
commit ed82536a55
26 changed files with 223 additions and 103 deletions

View File

@ -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

View File

@ -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="""<<tag>>"""/>
<$macrocall $name=".example" n="2" eg="""<<tag Concepts>>"""/>
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="[<currentTiddler>tags[]]"> <<tag>> </$list>
</$list>"""/>
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="[<currentTiddler>tags[]]"> <<tag>> </$list>
</$list>"""/>
A slightly more performant option is to use the `variable="transclusion"` attribute in the list widget. In this case, the variable `<<transclusion>>` has to be used inside the list widget instead of the `<<currentTiddler>>` .
<$macrocall $name=".example" n="5" eg="""<$list filter="[tag[HelloThere]]" variable="transclusion">
* <$link to=<<transclusion>>/> is tagged with: <$list filter="[<transclusion>tags[]]"> <<tag>> </$list>
</$list>"""/>

View File

@ -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>
<$button>Close Window
<$action-sendmessage

View File

@ -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:

View File

@ -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.

View File

@ -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.

View File

@ -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""">>

View File

@ -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:

View File

@ -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.

View File

@ -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

View File

@ -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.

View File

@ -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''

View File

@ -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.

View File

@ -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-name>(<param-name>[:<param-default-value>],<param-name>[:<param-default-value>]...) <single-line-definition-text>
\procedure <procedure-name>(<param-name>[:<param-default-value>],<param-name>[:<param-default-value>]...) <single-line-definition-text>
```
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:

View File

@ -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 <rule-list>
\rules only|except <rule-list>
```
The list of available parser rules can be consulted in $:/ControlPanel -> Info -> Advanced -> Parsing.

View File

@ -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__>> - <<a1>>
\procedure p1(a1) $a1$ - <<__a1__>> - <<a1>>
\function f1(a1) "$a1$" "-" [<__a1__>] ="-" [<a1>] :and[join[ ]]
Invoked in normal wikitext context: `<$transclude $variable=macro/>` or `<<macro>>`
{{Behaviour of variables invoked via normal wikitext}}
Invoked via widget attribute: `<div class=<<macro>>/>`
{{Behaviour of variables invoked via widget attributes}}
Invoked via filter operator parameter: `[<macro>]`
{{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 `<<a1>>` 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__>> - <<a1>>
\procedure p1(a1) $a1$ - <<__a1__>> - <<a1>>
\function f1(a1) $a1$ "-" [<__a1__>] ="-" [<a1>] :and[join[ ]]
```
| !Variable transclusion|!output |
| `<<m1 foo>>`|<<m1 foo>>|
| `<<p1 foo>>`|<<p1 foo>>|
| `<<f1 foo>>`|<<f1 foo>>|
| !Widget attribute|!output |
| `<$text text=<<m1 foo>>/>`|<$text text=<<m1 foo>>/>|
| `<$text text=<<p1 foo>>/>`|<$text text=<<p1 foo>>/>|
| `<$text text=<<f1 foo>>/>`|<$text text=<<f1 foo>>/>|
| !Filter operator parameter|!output |
| `[<m1 foo>]`|<$text text={{{[<m1 foo>]}}}/>|
| `[<p1 foo>]`|<$text text={{{[<p1 foo>]}}}/>|
| `[<f1 foo>]`|<$text text={{{[<f1 foo>]}}}/>|
| !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]]}}}/>|

View File

@ -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.|

View File

@ -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.|

View File

@ -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 (`<<macro>>`) 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|

View File

@ -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 `<div class=<<macro>>/>`, it is a synonym for `<div class={{{[function[macro]]}}}/>`. 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|

View File

@ -1,13 +1,9 @@
created: 20230421020225031
modified: 20230422144812613
modified: 20230726145912019
tags:
title: Variable Usage
type: text/vnd.tiddlywiki
\define m1(a1) $a1$ - <<__a1__>> - <<a1>>
\procedure p1(a1) $a1$ - <<__a1__>> - <<a1>>
\function f1(a1) "$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
</$let>
!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 `<<macro>>` 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 (`<<macro>>`) 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: `<div class=<<macro>>/>`|\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 `<div class=<<macro>>/>`, it is a synonym for `<div class={{{[function[macro]]}}}/>`. 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: `[<macro>]`|\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 `<<a1>>` 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__>> - <<a1>>
\procedure p1(a1) $a1$ - <<__a1__>> - <<a1>>
\function f1(a1) $a1$ "-" [<__a1__>] ="-" [<a1>] :and[join[ ]]
```
| !Variable transclusion|!output |
| `<<m1 foo>>`|<<m1 foo>>|
| `<<p1 foo>>`|<<p1 foo>>|
| `<<f1 foo>>`|<<f1 foo>>|
| !Widget attribute|!output |
| `<$text text=<<m1 foo>>/>`|<$text text=<<m1 foo>>/>|
| `<$text text=<<p1 foo>>/>`|<$text text=<<p1 foo>>/>|
| `<$text text=<<f1 foo>>/>`|<$text text=<<f1 foo>>/>|
| !Filter operator parameter|!output |
| `[<m1 foo>]`|<$text text={{{[<m1 foo>]}}}/>|
| `[<p1 foo>]`|<$text text={{{[<p1 foo>]}}}/>|
| `[<f1 foo>]`|<$text text={{{[<f1 foo>]}}}/>|
| !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

View File

@ -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.

View File

@ -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.
<<wikitext-example src:"@@some highlighted text@@">>
<<wikitext-example src:"@@Highlighted text@@">>
Style attributes, e.g. `color`, each followed by `;` semicolon can be introduced immediately after the opening `@@`.
!! Styles
<<wikitext-example src:"@@color:steelblue;background-color:lightcyan;some styled text@@">>
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:
<<wikitext-example src:"@@color:steelblue;background-color:lightcyan;Text with custom style@@">>
Similarly, styles can be applied to //block content//. Wrapping block content in `@@` without specifying style or class has no effect.
<<wikitext-example src:"@@background-color:lightcyan;
* Item one
@ -23,18 +25,49 @@ Similarly a style can be applied to a multiline content:
@@
">>
A class may be applied to a multiline content only:
!! Classes
<<wikitext-example src:"@@.tc-double-spaced-list
* Item one
* Item two
The following `coloured-text` and `coloured-bg` classes are defined in this tiddler for demonstration purposes:
```
.coloured-text {color: darkkhaki;}
.coloured-bg {background-color: cornsilk;}
```
<style>
.coloured-text {color: darkkhaki;}
.coloured-bg {background-color: cornsilk;}
</style>
Multiple classes, each prefixed with `.`, can be introduced immediately after the opening `@@`, followed by a ` ` space. This works both for inline and block content:
<<wikitext-example src:"@@.coloured-text.coloured-bg Inline content with two assigned classes@@">>
<<wikitext-example src:"@@.coloured-bg
* Block content
* With one assigned class
@@">>
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.
<<wikitext-example src:"@@.tc-double-spaced-list
@@width:400px;background-color:lightcyan;
* Item one
* Item two
@@
<<wikitext-example src:"@@font-size:1.5em;.coloured-text.coloured-bg Text with custom style and 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 `@@`:
<<wikitext-example src:"@@font-size:1.5em;
@@.coloured-text
@@.coloured-bg
* Block content
* With custom style and classes
@@">>
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.
<<wikitext-example src:"!!!.coloured-bg Heading with a custom background class.
* Standard list element.
*.coloured-bg List element with a custom background colour class.
*.coloured-text List element with a custom text colour class.
*.coloured-bg.coloured-text List element with both of the custom classes.
">>

View File

@ -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
...
</div>
```
<<.warning "The text from the definition of the macro will be retrieved and text substitution will be performed (i.e. <<.param $param$>> and <<.param &#36;(...)&#36;>> 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.">>
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}}

View File

@ -20,6 +20,7 @@ Note that widgets inherit all the features of [[HTML in WikiText]]:
** Macro invocations (eg `attr=<<myMacro>>`)
** 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

View File

@ -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