Eric,
I stumbled on two things recently that may interest you. Although I dare
say you know they exist;
They can may writing wikitext and macros much easier.
*The First - Using templates with filtered transclusions*
Consider the filtered transclusion in this thread
{{{ [all[current]tagging[]butfirst[]count[]compare:number:gt[1]then[several]
else[single]] }}}
And displaying it in text
<$text text={{{
[all[current]tagging[]butfirst[]count[]compare:number:gt[1]then[several]else[single]]
}}}/>
I have started using short template names, so in a tiddler called (text) it
contains;
<$text text=<<currentTiddler>>/>
So now we can get the filtered transclusion to return it in text form as
follows
{{{ [all[current]tagging[]butfirst[]count[]compare:number:gt[1]then[several]
else[single]] *|| (text)* }}}
I have taken this lot further for a range of situations and created short
tiddlers of the form "(name)" to be used as templates.
- Do you see any problems with this approach?
- I don't mind they come up in searches, although we could filter them
out, it is actually convenient to find them.
- They all operate in currentTiddler and can this be placed inside
lists, as parameters and a lot more.
I will share my current list if you are interested.
*The Second is using transclusions as concatenation*
- In wiki text we can freely concatenate all sorts of items for example
"{{!!fieldname}}{{{ filter }}}<<varname>>even<<macroname parameter>> works"
- But to write macros or be forced to wikify makes concatenation can be
quite complicated.
- However if you put this in a tiddler and transclude it is done for you
- However this means using more than one tiddler, OK for reusable
concatenations, but not for ad hoc ones.
- Yet you can use a field on the current tiddler to do this
"concatenation" by wiki text and simply transclude eg use {{!!working}}
when the working field contains
{{!!fieldname}}{{{ filter }}}<<varname>>even<<macroname parameter>>works
For example place this in a New tiddler on TiddlyWiki.com
\define macroname(param) The Macro Output <<transclusion>> with $param$
{{!!working}}+
Then add *fieldname* with a value
Add the working field containing
{{!!fieldname}}{{{ [<currentTiddler>removeprefix[New]] }}}<<transclusion>>
even<<macroname parameter>> works
and see this in action for yourself.
Once again for this original thread we can place the filtered transclusion
in the working field
*All that remains* is to find a way to ensure the result from a working
field is text only when needed.
Regards
Tones
On Wednesday, 14 October 2020 22:01:27 UTC+11, Eric Shulman wrote:
>
> On Wednesday, October 14, 2020 at 3:37:15 AM UTC-7, Jean-Pierre Rivière
> wrote:
>>
>> Thank you Eric. Once again, I stumble upon the terrible rule "macro do
>> only text substitution". I know it, but I have not yet realized all what it
>> means. I selected the wikify approach of method #1 as I want to keep using
>> the countTaggedBySelf macro to avoid duplicating code.
>>
>> Simplification #3 creates a link, which is not wanted. Is there a similar
>> quick notation to just get the raw text instead of an internal link? Note
>> that is why I created my macro with the count widget inside.
>>
>
> Use the <$text> widget, like this:
> <$text text={{{
> [all[current]tagging[]butfirst[]count[]compare:number:gt[1]then[several]else[single]]
>
> }}}/>
>
> -e
>
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/3213e62f-a2df-49ea-a51e-f3740f744dd5o%40googlegroups.com.