Hello,
Usually I am asking stupid questions but this time I wanted to share a tip.
I put together a TiddlyWiki document consisting of many documents all with
tables of contents embedded in the top and tiddlers with the document tag
below. I found when I wanted to change the format of the tables of content,
I had to go through every document. Also when I cloned the document to
start a new one, I had to hand edit the call to the TOC macro. Rather than
make a custom TOC macro call for each document, I made a generic global
macro that can be embedded in each document that will produce the TOC for
that document based on the current tiddler title.
Howto:
Put this macro in a separate tiddler:
\define currenttoc()
<div class="tc-table-of-contents">
<$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>>
sort="nsort[order]" />
</div>
\end
and tag the tiddler with $:/tags/Macro to make the macro usable in all
tiddlers.
Now in each new document, just add <<currenttoc>> where you want a TOC.
Combine this with a:
{{{[tag<currentTiddler>nsort[order]]||document_template_tiddler}}}
in the same tiddler and you have a very reusable document seed. Every new
sub-document text simply contains:
<<currenttoc>>
{{{[tag<currentTiddler>nsort[order]]||document_template_tiddler}}}
All that is needed to start a new document is clone an existing one, change
the tiddler title and start adding sections using the "New Here" option on
the section root tiddler.
It is easy to globally control the format/filter of all your separate
sub-documents via two tiddlers, the one containing the global currenttoc
macro and document_template_tiddler.
I added the nsort[order] filter so that I could add an order field to my
sections and manually change the ordering. Alphabetical-numerical
order based on title isn't always what you want for section headings
(e.g. §1.1, §1.2, §1.3 ... §1.10, §1.11, §1.12).
Hope this helps someone,
/Mike
--
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.