I think a lot of people intentionally or unintentionally try and
concatenate or join together text and Tiddlywiki values, and this often
causes grief.
As a result of a "discord discussion" I realised on of the common reasons
has its own "concatenation tool" the Qualify Macro (see below)
However this prompts me to ask the community, *Why would you use
concatenation?*
- This will help us identify how to document this sometimes tricky
aspect of TiddlyWiki
- Please post in this thread any reasons you need to concatenate, and it
will inform the documentation.
Thanks in advance
Tony
*The Qualify Macro*
eg One common use is to generate a tiddler name to use as a state field
that includes the current tiddler name.
The Qualify macro provides a short cut for this <<qualify $:/state/tiddler>>
will generate a title such as $:/state/tiddler--1383354177
The number is a hash of the currentTiddler title and can be regenerated
eg with the same "currentTiddler" <<qualify $:/temp/state>> will generate
$:/temp/state--1383354177
*A Quick note on concatenation *
Should a search bring you to this thread.
Many of you will realise your instinct to try and concatenate more than one
value will not work. Here we explain how to do this.
For example value="<<variableormacro>>{{transclusion}}Text" used in a
widget parameter including with the $macrocall widget, does not work.
- In this case you can see that the value="a literal unevaluated
version" so it will return precisely
<<variableormacro>>{{transclusion}}Text which is unlikely what you
intended.
Also consider value=<<variableormacro>>{{transclusion}} used in a widget
parameter including with the $macrocall widget, does not work either.
- Another way to look at it is as value=<<variableormacro>> and
value={{transclusion}} works the << >> and {{ }} are acting to delineate
the beginning and end of the value, combining them is like providing more
than one beginning and end to the value and causes errors.
use the following methods to concatenate a number of values after first
evaluating them
*With the Wikify widget*
<$wikify name=varname text="<<variableormacro>>{{transclusion}}Text">
<<varname>> valid until wikify closed
</$wikify>
*Concatenating Within Macro definitions*
\define varname() <<variableormacro>>{{transclusion}}Text
Remember here the following also work Within Macro definitions (only)
$parametername$
$(externalvariable)$
Note the values differentiated by "$" signs are substituted before being
evaluated so examples such as [[$parametername$]] should work
*Concatenating Within Filters*
- addprefix, add suffix and more
- More info to follow
--
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/bd643a66-01c9-43f4-bb28-eb6050e99342%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.