On Saturday, December 2, 2017 at 7:29:05 PM UTC-8, Diego Mesa wrote:
Can some one clarify on the use of << vs < when referencing variables...
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>]
hope this helps,
enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals