Robin,

This is an area with a gap in the doco, I is hard to find it in one place. 
here are a few

https://tiddlywiki.com/#TextReference
http://tobibeer.github.io/tb5/#Dynamic%20Contents%20In%20Macros
http://tobibeer.github.io/tb5/#Variables%20vs.%20Parameters
http://tobibeer.github.io/tb5/#Variables%20In%20Nested%20Lists



*A great explanation from Jeremy*

In TiddlyWiki *content*, variables 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 doubling the brackets, 
as HTML is not allowed *within* the filter, so only single <variableName> is 
used.

...and why I don't have to wrap <fieldname> with [<fieldname>] before giving it 
to split. 

Think of the brackets in filters as part of the operand itself rather than a 
"container" for the operand.  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.

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


Regards
Tony

On Tuesday, May 1, 2018 at 11:46:37 AM UTC+10, Robin wrote:
>
> Yay it works thanks a lot for this.
>
> Also good tip for the macro names, I didn't think of that.
>
> But I still don't know why this works.
> can I allways replace [ ]  with { }  in a filter ?
>
> That part of the syntax eludes me a bit.
>
>
>

-- 
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/1bdd063d-2dd9-49c4-801b-f48d4f18b624%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to