toc enhancement help needed

90 views
Skip to first unread message

Laurent Bonet

unread,
Jul 9, 2019, 2:33:43 AM7/9/19
to TiddlyWiki
Hello all,

I would like to be able to pass a template to toc macros.
This would allow for example to display the number of tiddlers of the sub level.

1.png

I develop a set of "xtoc" macros (attached to the post).

The previous example is created throug the following call

2.png

with the following template

3.png


xtoc, xtoc-expandable, xtoc-selective-expandable are working fine but I have an issue with xtoc-tabbel-internal-nav 


<$macrocall $name="xtoc-tabbed-internal-nav" tag="home" selectedTiddler="$:/temp/toc/selectedTiddler" unselectedText="<p>Select a topic in the table of contents. Click the arrow to expand a topic.</p>" missingText="<p>Missing tiddler.</p>" tocTemplate="/internal/template/xtoc-template" />


which display like this (with a dirty carriage return before each toc item) :-(

4.png


The display issue seems to be linked to the combination of two DIV and their associated style sheets in 


\define xtoc-tabbed-external-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText,missingText,template:"",tocTemplate:"")

<$tiddler tiddler={{{ [<__selectedTiddler__>get[text]] }}}>

  <div class="tc-tabbed-table-of-contents">

    <$linkcatcher to=<<__selectedTiddler__>>>

      <div class="tc-table-of-contents">

        <$macrocall $name="xtoc-selective-expandable" tag=<<__tag__>> sort=<<__sort__>> itemClassFilter="[all[current]field:title<__selectedTiddler__>]" tocTemplate=<<__tocTemplate__>>/>

      </div>

    </$linkcatcher>



I'm unfortunately reaching my knowledge limits to solve this :-( so help would be appreciated.


Laurent







_internal_macros_xtoc.tid

Stephan Hradek

unread,
Jul 10, 2019, 3:41:01 AM7/10/19
to TiddlyWiki
Hi Laurent.

I do not completely understand your issue and I also haven't looked into your macro.

Is the issue the linebreak before the numbers?

In that case I'd suggest you try to get rid of all linebreaks in your macro and the call of your macro. My experience with TW is that this whitespace is important. Just give it a try. maybe it works.

PMario

unread,
Jul 10, 2019, 3:58:06 AM7/10/19
to TiddlyWiki
Hi,
your attachment doesn't contain the template.
-m

PMario

unread,
Jul 10, 2019, 4:16:30 AM7/10/19
to TiddlyWiki
Hi,

It's a CSS problem. try the attachment.

-m
xtoc-styles.json

PMario

unread,
Jul 10, 2019, 4:21:37 AM7/10/19
to TiddlyWiki
Hi,
I think element counters with (0) shouldn't be shown.
-m

Laurent Bonet

unread,
Jul 10, 2019, 10:52:10 AM7/10/19
to TiddlyWiki
Works perfectly !!! :-)
Thank you so much.
The support you are providing is just ... awesome!

Is there a risk of some side effect on classical toc macros? Will try to spend a little bit of time understanding css.

Is there a place to submit tiddlywiki enhancement proposals: I think this idea of template for toc deserves to be implemented in a clean manner by knowledgeable people (an not by a newbie like me).

Again thank you so much. 

PMario

unread,
Jul 10, 2019, 12:38:10 PM7/10/19
to tiddl...@googlegroups.com

On Wednesday, July 10, 2019 at 4:52:10 PM UTC+2, Laurent Bonet wrote:
Works perfectly !!! :-)
Thank you so much.
The support you are providing is just ... awesome!

Thx.
 
Is there a risk of some side effect on classical toc macros? Will try to spend a little bit of time understanding css.

It shouldn't. The CSS is very specific assigned to tc-tabbed-table-of-contents and children. ... 
 
Is there a place to submit tiddlywiki enhancement proposals:

The problem is, that the TOC is already a very complex piece of wikitext. ... You could have modified / overwritten the toc-caption() macro, without modifying all of them (maybe).

 
I think this idea of template for toc deserves to be implemented in a clean manner by knowledgeable people (an not by a newbie like me).

As I wrote: replacing toc-caption() macro would be an easier option. ... BUT if you hide the number (0) IMO you need to modify all the macros. :/

IMO there is a lot of room for plugins in the TOC area. We'll see in the future.

have fun!
mario


Reply all
Reply to author
Forward
0 new messages