mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-29 02:14:45 +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:
parent
d8cc283b3a
commit
47481ed52a
@ -163,17 +163,24 @@ tags: $:/tags/Macro
|
|||||||
\end
|
\end
|
||||||
|
|
||||||
\define toc-tabbed(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText)
|
\define toc-tabbed(tag,sort:"",selectedTiddler:"$:/temp/toc/selectedTiddler",unselectedText)
|
||||||
<$linkcatcher to="$selectedTiddler$">
|
|
||||||
<$tiddler tiddler={{$selectedTiddler$}}>
|
<$tiddler tiddler={{$selectedTiddler$}}>
|
||||||
<div class="tc-tabbed-table-of-contents">
|
<div class="tc-tabbed-table-of-contents">
|
||||||
|
<$linkcatcher to="$selectedTiddler$">
|
||||||
<div class="tc-table-of-contents">
|
<div class="tc-table-of-contents">
|
||||||
<$macrocall $name="toc-selective-expandable" tag="""$tag$""" sort="""$sort$""" itemClassFilter=<<toc-tabbed-selected-item-filter selectedTiddler:"""$selectedTiddler$""">>/>
|
<$macrocall $name="toc-selective-expandable" tag="""$tag$""" sort="""$sort$""" itemClassFilter=<<toc-tabbed-selected-item-filter selectedTiddler:"""$selectedTiddler$""">>/>
|
||||||
</div>
|
</div>
|
||||||
|
</$linkcatcher>
|
||||||
<div class="tc-tabbed-table-of-contents-content">
|
<div class="tc-tabbed-table-of-contents-content">
|
||||||
<h1><$view field="caption"><$view field="title"/></$view></h1>
|
<h1><$view field="caption"><$view field="title"/></$view></h1>
|
||||||
<$transclude mode="block">$unselectedText$</$transclude>
|
<$transclude mode="block">$unselectedText$</$transclude>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</$tiddler>
|
</$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>
|
</$linkcatcher>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
|
@ -4,6 +4,24 @@ tags: table-of-contents-example
|
|||||||
|
|
||||||
!! Tabbed Table of Contents
|
!! 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'
|
<$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.">>
|
||||||
|
|
||||||
|
'/>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user