[TW5] Separate link CSS for table of contents?

90 views
Skip to first unread message

David Gifford

unread,
Aug 30, 2014, 9:21:36 AM8/30/14
to tiddl...@googlegroups.com
I would like the links in the table of contents to be different than the standard links.

I have tried

#tw-table-of-contents a.tw-tiddlylink {}

and some similar items to no avail. Any ideas?

Dave

Andreas Hahn

unread,
Aug 30, 2014, 9:51:18 AM8/30/14
to tiddl...@googlegroups.com
Have a look at the toc macro in $:/core/macros/toc.

As you can see it uses <ol>-elements with currently no specific class. So you can style those with:

ol>li>a.tw-tiddlylink {
    color: red;
}

Alternatively you can change the <<toc>>-macro so that the elements have css classes.

/Andreas
--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

David Gifford

unread,
Aug 30, 2014, 10:29:16 AM8/30/14
to tiddl...@googlegroups.com
So I changed the macro to

\define toc(tag,sort:"")
<ol class="blacktoc">
<$list filter="[tag[$tag$]!tag[$:/Note]$sort$]">
<li>
<$link>
<$view field="title"/>
</$link><$macrocall $name="toc" tag=<<currentTiddler>>/>
</li>
</$list>
</ol>
\end


And in CSS I put

.blacktoc li a.tw-tiddlylink {}

What am I doing wrong?



--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/iIF1MM4QlX4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.



--
David Gifford
Christian Reformed World Missions, Mexico City

David Gifford

unread,
Aug 30, 2014, 10:36:08 AM8/30/14
to tiddl...@googlegroups.com
Never mind, I found the problem.

Jeremy Ruston

unread,
Aug 31, 2014, 5:16:47 AM8/31/14
to TiddlyWiki
Hi Dave

You don't need to modify the toc macro in order to be able to style it's output.

<div class="my-toc">
<<toc "[tag[stuff]]">>
</div>

Then in your stylesheet:

.my-toc .tw-tiddlylink {
background: red;
}

Best wishes

Jeremy

Jeremy Ruston
mailto:jeremy...@gmail.com

David Gifford

unread,
Aug 31, 2014, 7:31:14 AM8/31/14
to tiddl...@googlegroups.com

Jeremy Ruston

unread,
Aug 31, 2014, 7:33:13 AM8/31/14
to TiddlyWiki
Sorry Dave my example should have read:

<div class="my-toc">
<<toc "stuff">>
</div>

Best wishes

Jeremy

David Gifford

unread,
Aug 31, 2014, 7:37:02 AM8/31/14
to tiddl...@googlegroups.com
Thanks, Jeremy!

Dave
Reply all
Reply to author
Forward
0 new messages