This solves the problem halfway. This seems to print the title as a link to the <currentTiddler>.
<$text text={{{ [all[current]get[name]else{!!title}] }}} /><$text text={{{ [<currentTiddler>get[name]else<currentTiddler>] }}} />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
\define get_description()
<$wikify name="extract" text={{{ [<currentTiddler>get[text]split[]first[500]join[]] }}}>
<$text text={{{ [<currentTiddler>get[description]else<extract>] }}} />
</$wikify>
\end
Can you suggest any better way to extract the a "excerpt" of a tiddler?I found this get_extract function searching this forum but it kind of breaks the text by eating the formatting html. I just want plaintext of the first 140 characters or so with non-relevant characters replaced by spaces (and multiple spaces trimmed to one).
\define get_description()
<$wikify name="out" text={{{ [<currentTiddler>get[text]] }}}>
<$vars extract={{{ [<out>split[]first[140]join[]] }}}>
<$text text={{{ [<currentTiddler>get[description]else<extract>] }}} />
</$vars>
</$wikify>
\end
if the list of input titles is empty then return a list consisting of a single constant string, otherwise return the original titles
What I don't understand, is why this filter didn't work :[{!!name}else{!!title}]If name doesn't exist, then it doesn't display anything, despite the definition of "else"if the list of input titles is empty then return a list consisting of a single constant string, otherwise return the original titlesWithout "name", then {!!name} should be empty and the "else" operator should kick in. But it doesn't.
If the corresponding tiddler contains field F, and the value of this field is not empty, then its value is appended to the output.
The "else" filter only works if the preceding filter produces NO result... but if the {!!name} field exists, it has a value... it's just blank text.
On Saturday, August 15, 2020 at 11:36:52 AM UTC-7, Eric Shulman wrote:The "else" filter only works if the preceding filter produces NO result... but if the {!!name} field exists, it has a value... it's just blank text.But that's not the puzzling situation. If name doesn't exist, then there is NO output. I hadn't even checked the case where name exists but is empty.