On Saturday, August 4, 2018 at 11:06:47 AM UTC-6, @TiddlyTweeter wrote:
>
> I can't admit I understand the complexity of "Brackets" (<> <<>> [] [[]] 
> curly variants etc) or "Quotes" ("", ''  '', ''' ''' etc).
>
> Is there a *Crib Sheet* that gives an overview of their variant use? They 
> seem pretty important to understand well.
>
> Josiah
>

*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!*


!! 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>]`

hope this helps,

enjoy,
-e
Eric Shulman

-- 
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/73e0efa7-ca96-471a-87e5-648ac88be36b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to