mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Add selective expandable table of contents macro
And improve the layout of the examples
This commit is contained in:
parent
c4b76ceb0b
commit
58730b7452
@ -14,7 +14,7 @@ tags: $:/tags/Macro
|
||||
</ol>
|
||||
\end
|
||||
|
||||
\define toc-body(tag,show-button-filter)
|
||||
\define toc-expandable-body(tag,show-button-filter)
|
||||
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>>
|
||||
<li>
|
||||
<$link>
|
||||
@ -40,7 +40,40 @@ tags: $:/tags/Macro
|
||||
\define toc-expandable(tag)
|
||||
<ol>
|
||||
<$list filter="[tag[$tag$]]">
|
||||
<<toc-body tag:"$tag$">>
|
||||
<<toc-expandable-body tag:"$tag$">>
|
||||
</$list>
|
||||
</ol>
|
||||
\end
|
||||
|
||||
\define toc-selective-expandable-body(tag,show-button-filter)
|
||||
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>>
|
||||
<li>
|
||||
<$link>
|
||||
<$list filter="[all[current]tagging[]limit[1]]">
|
||||
<$reveal type="nomatch" state=<<toc-state>> text="open">
|
||||
<$button set=<<toc-state>> setTo="open" class="btn-invisible">
|
||||
{{$:/core/images/right-arrow}}
|
||||
</$button>
|
||||
</$reveal>
|
||||
<$reveal type="match" state=<<toc-state>> text="open">
|
||||
<$button set=<<toc-state>> setTo="close" class="btn-invisible">
|
||||
{{$:/core/images/down-arrow}}
|
||||
</$button>
|
||||
</$reveal>
|
||||
</$list>
|
||||
<$view field="title"/>
|
||||
</$link>
|
||||
<$reveal type="match" state=<<toc-state>> text="open">
|
||||
<$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>>/>
|
||||
</$reveal>
|
||||
</li>
|
||||
</$set>
|
||||
\end
|
||||
|
||||
\define toc-selective-expandable(tag)
|
||||
<ol>
|
||||
<$list filter="[tag[$tag$]]">
|
||||
<<toc-selective-expandable-body tag:"$tag$">>
|
||||
</$list>
|
||||
</ol>
|
||||
\end
|
||||
|
@ -0,0 +1,11 @@
|
||||
title: TableOfContentsMacro Expandable Example
|
||||
caption: Expandable
|
||||
tags: table-of-contents-example
|
||||
|
||||
!! Expandable Table of Contents
|
||||
|
||||
<$macrocall $name="wikitext-example-without-html"
|
||||
src="<div class='tw-table-of-contents'>
|
||||
<<toc-expandable 'Contents'>>
|
||||
</div>
|
||||
"/>
|
@ -0,0 +1,11 @@
|
||||
title: TableOfContentsMacro Selective Expandable Example
|
||||
caption: Selective Expandable
|
||||
tags: table-of-contents-example
|
||||
|
||||
!! Selective Expandable Table of Contents
|
||||
|
||||
<$macrocall $name="wikitext-example-without-html"
|
||||
src="<div class='tw-table-of-contents'>
|
||||
<<toc-selective-expandable 'Contents'>>
|
||||
</div>
|
||||
"/>
|
@ -0,0 +1,11 @@
|
||||
title: TableOfContentsMacro Simple Example
|
||||
caption: Simple
|
||||
tags: table-of-contents-example
|
||||
|
||||
!! Simple Table of Contents
|
||||
|
||||
<$macrocall $name="wikitext-example-without-html"
|
||||
src="<div class='tw-table-of-contents'>
|
||||
<<toc 'Contents'>>
|
||||
</div>
|
||||
"/>
|
@ -10,6 +10,7 @@ There are several variants of the macro:
|
||||
|
||||
* `<<toc>>` produces a simple hierarchical tree of links
|
||||
* `<<toc-expandable>>` produces an expandable tree of links
|
||||
* `<<toc-selective-expandable>>` produces an expandable tree of links where the expand/contract buttons are only shown for entries that possess child nodes
|
||||
|
||||
! Parameters
|
||||
|
||||
@ -18,18 +19,4 @@ There are several variants of the macro:
|
||||
|
||||
! Examples
|
||||
|
||||
!! Simple Table of Contents
|
||||
|
||||
<$macrocall $name="wikitext-example-without-html"
|
||||
src="<div class='tw-table-of-contents'>
|
||||
<<toc 'Contents'>>
|
||||
</div>
|
||||
"/>
|
||||
|
||||
!! Expandable Table of Contents
|
||||
|
||||
<$macrocall $name="wikitext-example-without-html"
|
||||
src="<div class='tw-table-of-contents'>
|
||||
<<toc-expandable 'Contents'>>
|
||||
</div>
|
||||
"/>
|
||||
<<tabs "[tag[table-of-contents-example]]" "TableOfContentsMacro Simple Example">>
|
||||
|
Loading…
Reference in New Issue
Block a user