Hello all:
I am using version 1.2.0 of
http://www.TiddlyTools.com/#SectionLinksPlugin.
As I mentioned in:
http://www.mail-archive.com/tiddl...@googlegroups.com/msg05141.html
I have an issue where I want to be able to suppress the toc that is
inserted by the <<sectionTOC>>
macro. At the bottom of my ViewTemplate I placed:
{{{
<span macro="sectionTOC '' silent"></span>
}}}
(note that is sectionTOC, two single quotes, silent and a double
quote).
I only want the TOC to show up if there is a {{sectionTOC{}}} (or
other specified class)
in the tiddler. To make this work I have modified the sectionTOC
definition to check for
a second parameter. So when invoked as: <<sectionTOC '' silent>> for
example, it suppresses
the default output at the location of the sectionTOC macro.
The following patch:
{{{
--- orig 2009-07-03 23:36:25.734375000 -0400
+++ new 2009-07-03 23:36:44.703125000 -0400
@@ -156,6 +156,7 @@
handler: function
(place,macroName,params,wikifier,paramString,tiddler) {
var out=[];
var targetClass=params[0]||this.targetClass;
+ var silent=params[1]||0; // if param1 exists display output only if
class marker exists.
var t=story.findContainingTiddler(place); if (!t) return;
var elems=t.getElementsByTagName("*");
var level=5; // topmost heading level
@@ -174,7 +175,12 @@
if (level>1) for (var i=0; i<out.length; i++) out[i]=out[i].substr
(level-1);
// show numbered list
if (target && target.style.display=='none')
target.style.display='block';
- wikify(out.join("\n"),target||place);
+ if ( ! silent ) {
+ wikify(out.join("\n"),target||place);
+ } else {
+ wikify(out.join("\n"),target);
+ }
+
}
}
//}}}
}}}
applied to the SectionLinksPlugin tiddler implements this
functionality.
A change to the documentation similar to:
{{{
Simply place the following macro at the //end of the tiddler
content// (i.e., following all section headings):
{ { {
<<sectionTOC>> or <<sectionTOC className [silent]>>
} } }
>Note: The macro must occur at the end of the tiddler in order to locate the rendered section headings that precede it. By default it places the table of contents at the location ofthe sectionTOC macro. However if the optional second parameter silent is supplied, no text will be produced at the location of the sectionTOC macro.
However, you can still position the ....
}}}
is also needed. Hopefully this will be useful to somebody and will
make it into a future version
of Eric Shulman's SectionLinksPlugin.
-- rouilj