From 5dfdbc8ea0f0b1382b06d6d3691e645edda9af05 Mon Sep 17 00:00:00 2001 From: Mario Pietsch Date: Fri, 7 Nov 2025 20:27:20 +0100 Subject: [PATCH] [DOCS] Slightly improve the substitution documentation (#9357) --- ...ating a text reference to create a URL.tid | 13 ++++ ...oncatenating variables to create a URL.tid | 13 ++++ .../substitute Operator (Examples).tid | 77 ++++++++++++------- .../tiddlers/filters/substitute Operator.tid | 4 +- ...and variables using macro substitution.tid | 2 +- .../wikitext/Substituted Attribute Values.tid | 20 ++--- 6 files changed, 84 insertions(+), 45 deletions(-) create mode 100644 editions/tw5.com/tiddlers/Concatenating a text reference to create a URL.tid create mode 100644 editions/tw5.com/tiddlers/Concatenating variables to create a URL.tid diff --git a/editions/tw5.com/tiddlers/Concatenating a text reference to create a URL.tid b/editions/tw5.com/tiddlers/Concatenating a text reference to create a URL.tid new file mode 100644 index 000000000..91e0abb3c --- /dev/null +++ b/editions/tw5.com/tiddlers/Concatenating a text reference to create a URL.tid @@ -0,0 +1,13 @@ +created: 20251021142729667 +modified: 20251021142729667 +tags: +title: Concatenating a text reference to create a URL +type: text/vnd.tiddlywiki + +!! Concatenating variables and a text reference to create a URL + +<$macrocall $name=wikitext-example src="""<$let hash={{{ [encodeuricomponent[]] }}}> +this tiddler on tiddlywiki.com +"""/> + +See: [[Substituted Attribute Values]] diff --git a/editions/tw5.com/tiddlers/Concatenating variables to create a URL.tid b/editions/tw5.com/tiddlers/Concatenating variables to create a URL.tid new file mode 100644 index 000000000..0aeff2fab --- /dev/null +++ b/editions/tw5.com/tiddlers/Concatenating variables to create a URL.tid @@ -0,0 +1,13 @@ +created: 20251021142733998 +modified: 20251021142733998 +tags: +title: Concatenating variables to create a URL +type: text/vnd.tiddlywiki + +!! Concatenating strings and variables to create a URL + +<$macrocall $name=wikitext-example src="""<$let hash={{{ [encodeuricomponent[]] }}}> +this tiddler on tiddlywiki.com +"""/> + +See: [[Substituted Attribute Values]] \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/filters/examples/substitute Operator (Examples).tid b/editions/tw5.com/tiddlers/filters/examples/substitute Operator (Examples).tid index ece8aecf6..7d738b957 100644 --- a/editions/tw5.com/tiddlers/filters/examples/substitute Operator (Examples).tid +++ b/editions/tw5.com/tiddlers/filters/examples/substitute Operator (Examples).tid @@ -1,37 +1,60 @@ created: 20230614225302905 -modified: 20230614233448662 +modified: 20251021140446753 tags: [[Operator Examples]] [[substitute Operator]] title: substitute Operator (Examples) type: text/vnd.tiddlywiki -\define time() morning -\define field() modified +!! Substitute operator parameters + +The following example uses a ''function definition'' and a ''function call'' with a ''filter expression'' + +<> +""">> + +--- + +The following example uses a [[filtered transclusion|Transclusion in WikiText]] with a [[filter expression|Filter Syntax]] creating a link and a text output. + +< +""">> + + +!! Substitute variables and parameters + +The following example uses [[variable definitions|Pragma: \procedure]] "name", "address", a ''filtered transclusion'' assigned to a ''text-widget''. The variables "name" and "address" are used as ''substitute parameters''. + +<,
] }}}/> +""">> + +!! Substitute $(variables)$ + +The following examples use the variables "name" and "address" and directly substitute the with the [[attribute substitution|Substituted Attribute Values]] syntax. + +< +""">> + +!! Substitute a filter expression and a variable + +The following example uses a procedure, that defines the text with substitution placeholders. `$(field)$` is defined as a variable. `${ ... }$` is filtered <<.olink2 "substitution placeholder" to:"substitute">>. + +<> operator parameters -<<.operator-example 1 "[[Hi, I'm $1$ and I live in $2$]substitute[Bugs Bunny],[Rabbit Hole Hill]]">> +<$text text={{{ [substitute[]] }}}/> -!Substitute variables -This example uses the following variables: +--- -* name: <$codeblock code=<>/> -* address: <$codeblock code=<
>/> +<$text text=`This tiddler was last $(field)$ on ${[{!!modified}format:date[DDth MMM YYYY]]}$`/> -<<.operator-example 2 "[[Hi, I'm $(name)$ and I live in $(address)$]substitute[]]">> - -!Substitute variables and operator parameters -This example uses the following variable: - -* time: <$codeblock code=<