Ciao passingby
Again helpful. I think the more accurate "takes" on bracketing there are
the more it gets easier to understand.
My emphasis & small edits.
Best wishes
Josiah
passingby wrote:
>
> *Eric* wrote this somewhere and I copied and kept it in my TW. I ll paste
> this as it is (wikitext), so that you can copy and paste it in a tiddler:
> *THANK
> YOU ERIC!*
>
> PS: I might also add, Eric is the best teacher when it comes to explaining
> code.
>
> !! Types of Brackets
>
> Brackets are used to indicate the ''type of operand'':
>
> * `[]` - square brackets surround ''literal'' values,
> * `{}` - curly braces around ''field references'',
> * `<>` - angle brackets around ''variable names''.
>
> !! Single or Double Brackets - `<` vs `<<`
> In TiddlyWiki ''content'', ''variables'' and ''macros'' are referenced
> using `<<variableName>>`. The ''double''-bracket syntax is used to avoid
> conflicts with standard HTML syntax (i.e., `<b>` starts normal HTML bold
> formatting, while `<<b>>` embeds the value of a TiddlyWiki variable named
> "b").
>
> However, ''within'' TiddlyWiki ''filters'', there is no need to double
> the brackets, as HTML is not allowed ''within'' the filter, so only
> single `<variableName>` is used.
>
> Thus, inside a filter we can use a pair of ''single'' angle brackets, like
> this:
>
> ```
> <$list filter="[is[current]!has<eachfield>]" variable=null>
> ```
>
> !! Brackets within filters
>
> <<<
> Why I don't have to wrap `<fieldname>` with `[<fieldname>]` in a filter?
> <<<
>
>
> Think of the brackets in filters as part of the operand itself rather than
> a "container" for the operand. As explained above, the type of bracket
> indicates the type of operand being used:
>
> * use `[...]` for ''literal'' values, e.g., `[texthere]`
> * use `{...}` for ''field'' references, e.g., `{!!fieldname}`
> * use `<...>` for ''variables'' e.g. `<currentTiddler>`
>
> Thus, to split the literal text, "sometext", you could write:
> `[title[sometext]splitbefore[t]removesuffix[t]]`
> you would get "some" as a result:
>
> Ex: `<<list-links "[title[sometext]splitbefore[t]removesuffix[t]]">>`
>
> <<list-links "[title[sometext]splitbefore[t]removesuffix[t]]">>
>
> If the value "sometext" is stored in a field named "somefield" in the
> current tiddler, you could write: `[{!!somefield}splitbefore[t]
> removesuffix[t]]`
>
> and, if the value "sometext" is stored in a variable named "somevariable",
> you could write: `[<somevariable>splitbefore[t]removesuffix[t]]`
>
> As a slightly more complex example, suppose the value to split on was also
> stored in a variable. Then you could write:
> `[<somevariable>splitbefore<othervariable>removesuffix<othervariable>]`
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/fec92b29-1454-4b81-be73-e28eac0bf898%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.