Please critique my solution

74 views
Skip to first unread message

talha131

unread,
Sep 14, 2020, 11:16:05 AM9/14/20
to TiddlyWiki

What’s the objective?

Show a list of tiddlers that link to the current tiddler, using either soft or hard links, and show the tiddlers current tiddler links to.

My solution

Create a template with the following code

<div class="tiddler-related-links">
<div class="backlinks">

! What Links here
<<list-links "[<currentTiddler>backlinks[]]" emptyMessage:"None" class:"tiddler-related-links-list" type:"ol">>
</div>

<div class="outbound">

! Outbound links

<<list-links "[<currentTiddler>links[]]" emptyMessage:"None" class:"tiddler-related-links-list" type:"ol">>
</div>

<div class="outbound">

! Search Result

<<list-links "[!is[system]!is[current]search:text:literal<currentTiddler>]">>

</div>
</div>

Problem 1

I could not find an operator that lists soft-links. So I relied on the search operator. What do you think of the following code?

<<list-links "[!is[system]!is[current]search:text:literal<currentTiddler>]">>

Problem 2

I could not figure out how to show the soft-links used in the current tiddler. I guess that I would have to use regex and search operators.

I am not sure what the perfect regex expression would be because you can create a soft-link in a number of ways, like using """ or using {{. Also, how to know that the text inside """ or {{ is part of a soft-link.

Request

Kindly review my code and let me know if I missed something or if it can be improved.

Also, please share a solution if you know a way to solve problem 2 reliably.

Reply all
Reply to author
Forward
0 new messages