Docs: Clarify that whitespace trim is inherited by procedure and widget definitions

This commit is contained in:
Jeremy Ruston 2023-09-21 18:11:54 +01:00
parent 697dc8db4c
commit bd99cf3385
3 changed files with 13 additions and 5 deletions

View File

@ -1,13 +1,17 @@
created: 20220917113002350
modified: 20230419103154329
modified: 20230921180332436
tags: Pragmas
title: Pragma: \whitespace
type: text/vnd.tiddlywiki
<<.from-version "5.1.15">> The ''\whitespace'' [[pragma|Pragmas]] determines how spaces and newlines are treated within wikitext. Note that this only applies to the printable text, and not to other text, such as the values of attributes.
<<.from-version "5.1.15">> The ''\whitespace'' [[pragma|Pragmas]] determines how spaces and newlines are treated within wikitext.
* ''notrim'' -- whitespace text is not subject to special processing (the default)
* ''trim'' -- whitespace text is removed
* ''trim'' -- whitespace text is ignored
Note that the processing only applies to the printable text, and not to other text, such as the values of attributes.
The whitespace setting only applies to the parsed content in which it appears. The setting is inherited by embedded [[Procedure Definitions]] and [[Custom Widgets]] definitions, but is not inherited by [[Macro definitions]].
```
\whitespace trim|notrim

View File

@ -1,5 +1,5 @@
created: 20221007125701001
modified: 20230419103154329
modified: 20230921180332436
tags: WikiText Procedures
title: Procedure Definitions
type: text/vnd.tiddlywiki
@ -18,6 +18,8 @@ This is the procedure text (param=<<param>>)
\end
```
Note that the [[Pragma: \whitespace]] setting is inherited from the parsing context in which the procedure definition occurs. That means that a tiddler containing multiple procedure definitions only needs a single whitespace pragma at the top of the tiddler, and the setting will be automatically inherited by the procedure definitions without needing the pragma to be repeated.
!! Procedure Definition with Set Widget
Procedures are implemented as a special kind of [[variable|Variables]] and so internally are actually defined with a <<.wlink SetWidget>> widget.

View File

@ -1,5 +1,5 @@
created: 20221007144237585
modified: 20230419103154328
modified: 20230921180332436
tags: Concepts Reference
title: Custom Widgets
type: text/vnd.tiddlywiki
@ -22,6 +22,8 @@ This is the widget, and the attribute is <<attribute>>.
The name of the widget must start with a dollar sign. If it is a user defined widget that does not override an existing widget then it must include at least one period (dot) within the name (for example `$my.widget` or `$acme.logger`).
Note that the [[Pragma: \whitespace]] setting is inherited from the parsing context in which the procedure definition occurs. That means that a tiddler containing multiple procedure definitions only needs a single whitespace pragma at the top of the tiddler, and the setting will be automatically inherited by the procedure definitions without needing the pragma to be repeated.
!! Using Custom Widgets
Custom widgets are called in the same way as ordinary built-in widgets: