(Relevant export of tiddler attached.)
A no-fuss no-muss sorted list, displayed in a sidebar tab, of all macros in all tiddlers tagged as macro tiddlers.
Screenshots followed by the code.
\define d() \\
<$let m={{{ [tag[$:/tags/Macro]!is[draft]get[text]join[...]] }}} >
<$list filter="[<m>split[...]search-replace:g:regexp[\n],[:::]split[:::]regexp<d>search-replace:g:regexp<d>,[]sort[]]">
<$let l={{{ [{!!title}search-replace[(],[\(]search-replace[)],[\)]search-replace[)],[):::]split[:::]nth[1]] }}}>
<$link to={{{ [tag[$:/tags/Macro]!is[draft]regexp:text<l>] }}}>
<$text text={{{ [{!!title}removeprefix[define ]search-replace[)],[):::]split[:::]nth[1]] }}}/>
</$link> <br>
</$let>
</$list>
</$let>
Macros in Macro Tiddlers.json (738 Bytes)
Oops, in making sure I only get lines that start with a backslash, I forgot to exclude lines that have \end.
Modified code:
- added the
e macro
- added
!regexp<e> to the list widget’s filter
\define d() \\
\define e() \\end
<$let m={{{ [tag[$:/tags/Macro]!is[draft]get[text]join[...]] }}} >
<$list filter="[<m>split[...]search-replace:g:regexp[\n],[:::]split[:::]!regexp<e>regexp<d>search-replace:g:regexp<d>,[]sort[]]">
<$let l={{{ [{!!title}search-replace[(],[\(]search-replace[)],[\)]search-replace[)],[):::]split[:::]nth[1]] }}}>
<$link to={{{ [tag[$:/tags/Macro]!is[draft]regexp:text<l>] }}}>
<$text text={{{ [{!!title}removeprefix[define ]search-replace[)],[):::]split[:::]nth[1]] }}}/>
</$link> <br>
</$let>
</$list>
</$let>
Updated. Code below screenshots.
Sidebar:
The tiddler for the sidebar tab:
\define d() \\
\define e() \\end
<$list filter="[tag[$:/tags/Macro]!is[draft]]">
<<details """{{ || tFL }}"""
"""<hr><$list filter="[{!!text}split[...]search-replace:g:regexp[\n],[:::]split[:::]!regexp<e>regexp<d>search-replace:g:regexp<d>,[]sort[]]">
<$let l={{{ [{!!title}search-replace[(],[\(]search-replace[)],[\)]search-replace[)],[):::]split[:::]nth[1]] }}}>
<$text text={{{ [{!!title}removeprefix[define ]search-replace[)],[):::]split[:::]nth[1]] }}}/><hr>
</$let>
</$list>
""">>
</$list>
The details widget macro:
\define details( summary content )
<details><summary>$summary$</summary>
<div style="margin-left:20px;">
$content$
</div>
</details>
\end
The “tFL” template tiddler:
{{!!title}} ^^<$link>🐟</$link>^^