> Glad you get it working. Let us know if you end up with something pretty 
> and useful.
>

I don't know how pretty the results are or if anyone but me will find this 
useful but here is what I ended up with.

As Danielo suggested: I added $:/core/modules/filters/match.js from 
http://eucaly-tw5.tiddlyspot.com/#%24%3A%2Fplugins%2Feucaly%2Fmatchfilter%2Freadme
 
... Eucaly's site has a number of interesting plugins and examples that 
make it well worth lingering.

The main tiddler, which I named My ToC contains this code, which is some 
minor modification of the code Danielo suggested:

\define regex-feature-header() (^!+.*)(?gmi)
<div class="box">
<h2><u>Table of Contents</u></h2>
<div class="TOC">
<ul style="list-style-type:square">
<$list filter="[all[current]match:text<regex-feature-header>]">
<li>

{{!!title}}
</li>
</$list>
</ul>
</div>
</div>

I also have a file called $:/_tw5.com-styles which is tagged with 
$:/tags/Stylesheet and $:/tags/stylesheet so I use it in both newer and 
older versions of Tiddlywiki. That contains the following

box { display:inline-block; -moz-border-radius: 10px; border-radius: 10px; 
padding:0.1em 1em; background-color:#ececec; }

.TOC H1 {font-size:100%; font-weight: bold; line-height: 80%;}

.TOC H2 {font-size:100%; text-indent: 15px; line-height: 80%; }

.TOC h3 {font-size:100%; text-indent: 30px; line-height: 80%; }

.TOC h4 {font-size:100%; text-indent: 45px; line-height: 80%; } 

.TOC h5 {font-size:100%; text-indent: 60px; line-height: 80%; } 

.TOC h6 {font-size:100%; text-indent: 75px; line-height: 80%; }
I chose the font-size to force the wikified '!' headers into a constant 
size. Text-indent pushes the subheaders out to the right depending on their 
level while the line-height reduces the double spacing a bit.

I transclude the tiddler with: <$transclude tiddler="My ToC" mode="block"/> 
The table of contents will appear wherever you put the $transclude line and 
ends up looking something like this:
 
*Table of Contents* 

   - How I created my In Tiddler Table of Contents:
   - Main Subject
   -     First Subheader
   -         title - Level 3
   -         other title - Level 3
   -             A title four levels
   -                 Fifth Level
   -         Back to third
   -     Here's another header - Level 2

 in a grey box with rounded corners.

Obviously this could use improvement and I'm certain some of our clever 
folks could code it much more tightly. Still, it accomplishes what I 
wanted. 
    

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to