1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-18 03:19:55 +00:00

Enhance tabbed toc macro with navigation control

Now there are two variants of the macro: the default one opens links
externally, the other opens links internally
This commit is contained in:
Jermolene 2014-11-14 17:06:21 +00:00
parent d8cc283b3a
commit 47481ed52a
2 changed files with 27 additions and 2 deletions

View File

@ -163,17 +163,24 @@ tags: $:/tags/Macro
\end
\define toc-tabbed(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText)
<$linkcatcher to="$selectedTiddler$">
<$tiddler tiddler={{$selectedTiddler$}}>
<div class="tc-tabbed-table-of-contents">
<$linkcatcher to="$selectedTiddler$">
<div class="tc-table-of-contents">
<$macrocall $name="toc-selective-expandable" tag="""$tag$""" sort="""$sort$""" itemClassFilter=<<toc-tabbed-selected-item-filter selectedTiddler:"""$selectedTiddler$""">>/>
</div>
</$linkcatcher>
<div class="tc-tabbed-table-of-contents-content">
<h1><$view field="caption"><$view field="title"/></$view></h1>
<$transclude mode="block">$unselectedText$</$transclude>
</div>
</div>
</$tiddler>
\end
\define toc-tabbed-internal-nav(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText)
<$linkcatcher to="""$selectedTiddler$""">
<$macrocall $name="toc-tabbed" tag="""$tag$""" sort="""$sort$""" selectedTiddler="""$selectedTiddler$""" unselectedText="""$unselectedText$"""/>
</$linkcatcher>
\end

View File

@ -4,6 +4,24 @@ tags: table-of-contents-example
!! Tabbed Table of Contents
The tabbed table of contents macro renders a selective expandable table of contents with an attached panel that displays the currently selected tiddler.
!!! Internal navigation
This example shows how to construct a tabbed table of contents with internal navigation, so that clicking links in the displayed tiddler will replace the displayed tiddler.
<$macrocall $name='wikitext-example-without-html'
src='<<toc-tabbed tag:"TableOfContents" sort:"" selectedTiddler:"$:/temp/toc/selectedTiddler" unselectedText:"Select a topic in the table of contents. Click the arrow to expand a topic.">>
src='<<toc-tabbed-internal-nav tag:"TableOfContents" selectedTiddler:"$:/temp/toc/selectedTiddler" unselectedText:"Select a topic in the table of contents. Click the arrow to expand a topic.">>
'/>
!!! External navigation
This example shows how to construct a tabbed table of contents with external navigation, so that clicking links in the displayed tiddler will open those tiddlers in the story river in the usual way.
<$macrocall $name='wikitext-example-without-html'
src='<<toc-tabbed tag:"TableOfContents" selectedTiddler:"$:/temp/toc/selectedTiddler" unselectedText:"Select a topic in the table of contents. Click the arrow to expand a topic.">>
'/>