On Saturday, August 15, 2020 at 8:39:40 AM UTC-7, Adithya B M wrote:
>
> Please look at the code below. In this, the get-extract() should called if
> the description field is absent. How could this be made to work?
> \define get_description()
> <$text text={{{ [<currentTiddler>get[description]else<get-extract
> <currentTiddler>>] }}} />
> \end
>
> \define get-extract(title)
> <$wikify name="output" text={{$title$}} mode="block" output="text">
> <$text text={{{ [<output>split[]first[500]join[]] }}}/>
> </$wikify>
> \end
>
Unfortunately, you can't invoke a macro with parameters from inside a
filter. Instead, you can "pre-compute" the extract value, and then use the
filter, like this:
\define get_description()
<$wikify name="extract" text={{{ [<currentTiddler>get[text]split[]first[500]
join[]] }}}>
<$text text={{{ [<currentTiddler>get[description]else<extract>] }}} />
</$wikify>
\end
Note that for the $wikify widget, mode="block" and output="text" parameters
are the defaults, so they can be omitted.
-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/b64baed2-8a75-4dee-bf25-b67b66ad51e6o%40googlegroups.com.