Commit
This allows table of contents to contain heading entries that do not function as links, like the one in the sidebar.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,18 +5,18 @@ tags: $:/tags/Macro | |
<ol class="tc-toc"> | ||
<$list filter="[tag[$tag$]$sort$]"> | ||
<li> | ||
<$link> | ||
<$list filter="[is[current]toc-link[no]]" emptyMessage="<$link><$view field='caption'><$view field='title'/></$view></$link>"> | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Jermolene
Owner
|
||
<$view field="caption"> | ||
<$view field="title"/> | ||
</$view> | ||
</$link> | ||
</$list> | ||
<$macrocall $name="toc" tag=<<currentTiddler>>/> | ||
</li> | ||
</$list> | ||
</ol> | ||
\end | ||
|
||
\define toc-expandable-body(tag,sort:"") | ||
\define toc-linked-expandable-body(tag,sort:"") | ||
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>> | ||
<li> | ||
<$link> | ||
|
@@ -41,15 +41,43 @@ tags: $:/tags/Macro | |
</$set> | ||
\end | ||
|
||
\define toc-unlinked-expandable-body(tag,sort:"") | ||
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>> | ||
<li> | ||
<$reveal type="nomatch" state=<<toc-state>> text="open"> | ||
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible"> | ||
{{$:/core/images/right-arrow}} | ||
<$view field="caption"> | ||
<$view field="title"/> | ||
</$view> | ||
</$button> | ||
</$reveal> | ||
<$reveal type="match" state=<<toc-state>> text="open"> | ||
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible"> | ||
{{$:/core/images/down-arrow}} | ||
<$view field="caption"> | ||
<$view field="title"/> | ||
</$view> | ||
</$button> | ||
</$reveal> | ||
<$reveal type="match" state=<<toc-state>> text="open"> | ||
<$macrocall $name="toc-expandable" tag=<<currentTiddler>> sort="$sort$"/> | ||
</$reveal> | ||
</li> | ||
</$set> | ||
\end | ||
|
||
\define toc-expandable(tag,sort:"") | ||
<ol class="tc-toc toc-expandable"> | ||
<$list filter="[tag[$tag$]$sort$]"> | ||
<<toc-expandable-body tag:"$tag$" sort:"$sort$">> | ||
<$list filter="[is[current]toc-link[no]]" emptyMessage="<<toc-linked-expandable-body tag:'$tag$' sort:'$sort$'>>"> | ||
<<toc-unlinked-expandable-body tag:"$tag$" sort:"$sort$">> | ||
</$list> | ||
</$list> | ||
</ol> | ||
\end | ||
|
||
\define toc-selective-expandable-body(tag,sort:"") | ||
\define toc-linked-selective-expandable-body(tag,sort:"") | ||
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>> | ||
<li> | ||
<$link> | ||
|
@@ -76,10 +104,40 @@ tags: $:/tags/Macro | |
</$set> | ||
\end | ||
|
||
\define toc-unlinked-selective-expandable-body(tag,sort:"") | ||
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$-$(currentTiddler)$">>> | ||
<li> | ||
<$list filter="[all[current]tagging[]limit[1]]" emptyMessage="<$button class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>"> | ||
<$reveal type="nomatch" state=<<toc-state>> text="open"> | ||
<$button set=<<toc-state>> setTo="open" class="tc-btn-invisible"> | ||
{{$:/core/images/right-arrow}} | ||
<$view field="caption"> | ||
<$view field="title"/> | ||
</$view> | ||
</$button> | ||
</$reveal> | ||
<$reveal type="match" state=<<toc-state>> text="open"> | ||
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible"> | ||
{{$:/core/images/down-arrow}} | ||
<$view field="caption"> | ||
<$view field="title"/> | ||
</$view> | ||
</$button> | ||
</$reveal> | ||
</$list> | ||
<$reveal type="match" state=<<toc-state>> text="open"> | ||
<$macrocall $name="toc-selective-expandable" tag=<<currentTiddler>> sort="$sort$"/> | ||
</$reveal> | ||
</li> | ||
</$set> | ||
\end | ||
|
||
\define toc-selective-expandable(tag,sort:"") | ||
<ol class="tc-toc toc-selective-expandable"> | ||
<$list filter="[tag[$tag$]$sort$]"> | ||
<<toc-selective-expandable-body tag:"$tag$" sort:"$sort$">> | ||
<$list filter="[is[current]toc-link[no]]" emptyMessage="<<toc-linked-selective-expandable-body tag:'$tag$' sort:'$sort$'>>"> | ||
<<toc-unlinked-selective-expandable-body tag:"$tag$" sort:"$sort$">> | ||
</$list> | ||
</$list> | ||
</ol> | ||
\end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
title: SecondThree | ||
tags: Second | ||
list: SecondThreeOne SecondThreeTwo SecondThreeThree | ||
toc-link: no | ||
|
||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |
5 comments
on commit ba3f800
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't wait to see this! An awesome feature I would never have imagined possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @giffmex - was pretty easy to do (albeit verbose). I've just pushed a build to http://tw5test.tiddlyspot.com for you to look at
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmmm...not sure it is functioning as we first intended. I created a tiddler and added
<div class='tc-table-of-contents'>
<<toc-selective-expandable 'Topics'>>
</div>
Then created New Tiddler 1 and New Tiddler 2. Both were tagged Topics, but the second one has a field of toc-link with the word no in it. The second one doesn't appear at all in the list. But what we want is for the title to appear, without being a link to the tiddler. Also, will it be possible, for my own uses later, to assign a different color to these, to distinguish them from actual links? Even for our purposes, I am afraid a user might click on one of these 'dead' links and think something is wrong. How might we distinguish them from the actual links?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then created New Tiddler 1 and New Tiddler 2. Both were tagged Topics, but the second one has a field of toc-link with the word no in it. The second one doesn't appear at all in the list. But what we want is for the title to appear, without being a link to the tiddler.
Then something has gone wrong - look at the example in TableOfContentsMacro, where it is working.
Also, will it be possible, for my own uses later, to assign a different color to these, to distinguish them from actual links? Even for our purposes, I am afraid a user might click on one of these 'dead' links and think something is wrong. How might we distinguish them from the actual links?
You can use CSS to set different colours; the non-linked entries have different HTML. The examples in TableOfContentsMacro show this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I must have done something wrong. The example tiddlers are proof enough to me. Will play with it more carefully later.
What does this feature have to do with filters?