From bd99cf3385ef876cfeae8863997948821c7e7c13 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 21 Sep 2023 18:11:54 +0100 Subject: [PATCH] Docs: Clarify that whitespace trim is inherited by procedure and widget definitions --- .../tw5.com/tiddlers/pragmas/Pragma_ _whitespace.tid | 10 +++++++--- .../tiddlers/procedures/Procedure Definitions.tid | 4 +++- editions/tw5.com/tiddlers/widgets/Custom Widgets.tid | 4 +++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/editions/tw5.com/tiddlers/pragmas/Pragma_ _whitespace.tid b/editions/tw5.com/tiddlers/pragmas/Pragma_ _whitespace.tid index 273a35bea..6e9f78287 100644 --- a/editions/tw5.com/tiddlers/pragmas/Pragma_ _whitespace.tid +++ b/editions/tw5.com/tiddlers/pragmas/Pragma_ _whitespace.tid @@ -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 diff --git a/editions/tw5.com/tiddlers/procedures/Procedure Definitions.tid b/editions/tw5.com/tiddlers/procedures/Procedure Definitions.tid index aa6d37a72..7d2ef564c 100644 --- a/editions/tw5.com/tiddlers/procedures/Procedure Definitions.tid +++ b/editions/tw5.com/tiddlers/procedures/Procedure Definitions.tid @@ -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=<>) \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. diff --git a/editions/tw5.com/tiddlers/widgets/Custom Widgets.tid b/editions/tw5.com/tiddlers/widgets/Custom Widgets.tid index 3d762bed2..b8c48b2c3 100644 --- a/editions/tw5.com/tiddlers/widgets/Custom Widgets.tid +++ b/editions/tw5.com/tiddlers/widgets/Custom Widgets.tid @@ -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 <>. 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: