Great addition Tony!
I may recommend to change line 6 in the script from <ul> to
<ul style="list-style:none;">
--Mohammad
On Saturday, January 18, 2020 at 2:54:32 PM UTC+3:30, TonyM wrote:
>
> Folks,
>
> Lets go advanced based on my first post.
>
> The Attached JSON can be dropped on TiddlyWiki.com or any wiki, it is
> still built on the first minimal example.
>
> This example is now to iterate the whole TOC but then you can activate
> details and button on the toc.
>
> It also demonstrates how easy it is to use tiddlywikis default buttons
> when your list is driven using the CurrentTiddler variable.
>
> There are range of trick and code patterns built into this, perhaps a
> useful project for someone getting to know TiddlyWiki. I have pasted the
> tiddler content below for with notes and challenges for your reference.
>
> Here a screen shot to tempt you;
>
> [image: Snag_d3b0063.png]
>
> The code in the attached tiddler
> \define each-other-level(filter)
> <$set name=level filter="[<level>add[1]]">
> <$wikify name=branch-number text=<<append-branch-number>> >
> <ul>
> <li><<branch-number>><!--$transclude tiddler={{!!icon}}/--> <$link
> to=<<currentTiddler>> ><$text text=<<currentTiddler>>/></$link>
> <$list filter="[{Recursion-Demo!!show-details}match[yes]]" variable=nul>
> (level:<<level>>) <!--parent: <<parentTiddler>-->
> <!--<position-in-parentTiddler-list>--></$list>
> <$list filter="[{Recursion-Demo!!show-buttons}match[yes]]" variable=nul>
> {{$:/core/ui/Buttons/permalink}} {{||$:/core/ui/Buttons/edit}}
> {{||$:/core/ui/Buttons/clone}} <<copy-title>> <<copy-content>></$list>
> </li>
> <$set name=parentTiddler value=<<currentTiddler>> >
> <$list filter="$filter$">
> <<each-other-level $filter$>>
> </$list>
> </$set>
> </ul>
> </$wikify></$set>
> \end
> \define first-level(filter)
> <h3><$link to=<<currentTiddler>> ><$text
> text=<<currentTiddler>>/></$link></h3>
> <$set name=parentTiddler value=<<currentTiddler>> >
> <$set name=level value="">
> <$list filter="$filter$">
> <<each-other-level $filter$>>
> </$list>
> </$set></$set>
> End all<br>
> \end
> \define append-branch-number()
> $(branch-number)$<<position-in-parentTiddler-list>>.
> \define position-in-list() {{{
> +[allbefore:include<currentTiddler>count[]] }}}
> \define position-in-parentTiddler-list()
> <$list filter="[<parentTiddler>tagging[]]
> +[allbefore:include<currentTiddler>count[]]" variable=position><$text
> text=<<position>>/></$list>
> \end
> \define copy-title()
> <$button message="tm-copy-to-clipboard" param=<<currentTiddler>>
> tooltip="Copy the Tiddler Title to the clipboard" class="tc-btn-invisible">
> {{$:/core/images/copy-clipboard}}title
> </$button>
> \end
> \define copy-content()
> <$button message="tm-copy-to-clipboard" param={{!!text}} tooltip="Copy the
> Tiddler Content to the clipboard" class="tc-btn-invisible">
> {{$:/core/images/copy-clipboard}}content
> </$button>
> \end
>
> <h2>Recursion and a Table of Contents</h2>
>
> :This is a demonstration of simple <$button tooltip="No other tiddler is
> required to make this work, only the tiddlers to be listed, does not use
> the TOC macros" class="tc-btn-invisible tc-tiddlylink">"single
> tiddler"</$button> recursion macro, allowing designer influence of a TOC.
> *A Table of contents Macro is designed to build a hierarchy from tiddlers
> tagging tiddlers
> *All that is needed is to call one macro from another. However it will
> call the second macro for each level down it finds.
> **The two essential macros are ''first-level'' and ''each-other-level''.
> **And additional macro "append-branch" is define to concatenate the
> current level on a branch.
> *When all items are listed at a given level it falls back to the last
> items in the previous level
> *This macro is not checking to Avoid an infinite loop that may cause
> infinite recursion
> *The "level" variable displayed in (n) shows how many levels deep you are
> *Icons will be displayed if they exist in tiddlers (uncomment
> `<!--$transclude tiddler={{!!icon}}/-->`)
> *by setting the parentTiddler before calling the next level we can search
> its list field to see where the current tiddler comes in the list (this
> adds a bit of time using the trick discussed [[here|
> https://groups.google.com/forum/?hl=en#!topic/tiddlywiki/wY6haW2cYMA]]
> *Change `<!--parent: <<parentTiddler>-->` to `<parent: <<parentTiddler>>`
> to see each parent displayed.
> ;Challenges
> *Generate a way to generate a number for the exact position in the list eg
> 1, 2, 3... in sequence for every tiddler listed
> *A Popup or modal to preview the content of each listed tiddler, perhaps
> even with mouse over.
> <$checkbox field="show-details" checked="yes" unchecked="no" default="no">
> Show details</$checkbox>
> <$checkbox field="show-buttons" checked="yes" unchecked="no" default="no">
> Show Action Buttons</$checkbox>
>
> <$tiddler tiddler="TableOfContents">
> <$set name=branch-number value="">
> <<first-level "[is[current]tagging[]]">>
> </$set>
> </$tiddler>
>
> I am creating a modified version of the tag macro, where it displays a
> label rather than long and unwieldy tiddler titles, to be made available on
> any tiddler than has children, ie tags, so that drag and drop reordering is
> simple.
>
> Enjoy this and please ask questions or provide feedback, just as mark just
> did.
>
> Thanks
> Tony
>
--
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/dce72786-af70-4df9-8826-554dcf9455b3%40googlegroups.com.