Hi,
yes that is very possible and here is how you would do it:
|\define toc-selective-single-expandable(tag,sort:"",itemClassFilter)
<ol class="tc-toc toc-selective-expandable">
<$list filter="[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$]">
<$list filter="[all[current]toc-link[no]]" variable="ignore"
emptyMessage="<<toc-linked-selective-single-expandable-body tag:'$tag$' sort:'$sort$'
itemClassFilter:'$itemClassFilter$'>>">
<<toc-unlinked-selective-single-expandable-body tag:"""$tag$""" sort:"""$sort$"""
itemClassFilter:"""$itemClassFilter$""">>
</$list>
</$list>
</ol>
\end
\define toc-linked-selective-single-expandable-body(tag,sort:"",itemClassFilter)
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$">>>
<$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected"
emptyValue="toc-item">
<li class=<<toc-item-class>>>
<$link>
<$list filter="[all[current]tagging[]limit[1]]" variable="ignore" emptyMessage="<$button
class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>">
<$reveal type="nomatch" state=<<toc-state>> text=<<currentTiddler>>>
<$button set=<<toc-state>> setTo=<<currentTiddler>> class="tc-btn-invisible">
{{$:/core/images/right-arrow}}
</$button>
</$reveal>
<$reveal type="match" state=<<toc-state>> text=<<currentTiddler>>>
<$button set=<<toc-state>> setTo="x-all-close" class="tc-btn-invisible">
{{$:/core/images/down-arrow}}
</$button>
</$reveal>
</$list>
<<toc-caption>>
</$link>
<$reveal type="match" state=<<toc-state>> text=<<currentTiddler>>>
<$macrocall $name="toc-selective-single-expandable" tag=<<currentTiddler>> sort="""$sort$"""
itemClassFilter="""$itemClassFilter$"""/>
</$reveal>
</li>
</$set>
</$set>
\end
\define
toc-unlinked-selective-single-expandable-body(tag,sort:"",itemClassFilter)
<$set name="toc-state" value=<<qualify "$:/state/toc/$tag$">>>
<$set name="toc-item-class" filter="""$itemClassFilter$""" value="toc-item-selected"
emptyValue="toc-item">
<li class=<<toc-item-class>>>
<$list filter="[all[current]tagging[]limit[1]]" variable="ignore" emptyMessage="<$button
class='tc-btn-invisible'>{{$:/core/images/blank}}</$button> <$view field='caption'><$view
field='title'/></$view>">
<$reveal type="nomatch" state=<<toc-state>> text=<<currentTiddler>>>
<$button set=<<toc-state>> setTo=<<currentTiddler>> class="tc-btn-invisible">
{{$:/core/images/right-arrow}}
<<toc-caption>>
</$button>
</$reveal>
<$reveal type="match" state=<<toc-state>> text=<<currentTiddler>>>
<$button set=<<toc-state>> setTo="close" class="tc-btn-invisible">
{{$:/core/images/down-arrow}}
<<toc-caption>>
</$button>
</$reveal>
</$list>
<$reveal type="match" state=<<toc-state>> text=<<currentTiddler>>>
<$macrocall $name="""toc-selective-single-expandable""" tag=<<currentTiddler>> sort="""$sort$"""
itemClassFilter="""$itemClassFilter$"""/>
</$reveal>
</li>
</$set>
</$set>
\end|
Copy and append this either in|$:/core/macros/toc|or make a new tiddler
copy this into it and tag it|$:/tags/Macro|. Then use it with:
|<<toc-selective-single-expandable 'TableOfContents'>>|
Alternatively you can just drag&drop the attached file and import the
tiddlers.
/Andreas
Am 03.03.2015 um 09:23 schrieb magev958:
Hello, I was wondering if it is possible to auto-collapse open
categories in the TOC when you click on another.
I have 800 *links* in 40 or 50 subcategories, making a very long list
if everything is open
category (TOC link: no)
subcategory (TOC link: no)
sub-sub-category (TOC link: no)
*link*
--
You received this message because you are subscribed to the Google
Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to tiddlywiki+unsubscr...@googlegroups.com
<mailto:tiddlywiki+unsubscr...@googlegroups.com>.
To post to this group, send email to tiddlywiki@googlegroups.com
<mailto:tiddlywiki@googlegroups.com>.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.
[
{
"created": "20150303113913148",
"text": "\\define
toc-selective-single-expandable(tag,sort:\"\",itemClassFilter)\n<ol
class=\"tc-toc toc-selective-expandable\">\n<$list
filter=\"[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$]\">\n<$list
filter=\"[all[current]toc-link[no]]\" variable=\"ignore\"
emptyMessage=\"<<toc-linked-selective-single-expandable-body tag:'$tag$'
sort:'$sort$'
itemClassFilter:'$itemClassFilter$'>>\">\n<<toc-unlinked-selective-single-expandable-body
tag:\"\"\"$tag$\"\"\" sort:\"\"\"$sort$\"\"\"
itemClassFilter:\"\"\"$itemClassFilter$\"\"\">>\n</$list>\n</$list>\n</ol>\n\\end\n\n\\define
toc-linked-selective-single-expandable-body(tag,sort:\"\",itemClassFilter)\n<$set
name=\"toc-state\" value=<<qualify \"$:/state/toc/$tag$\">>>\n<$set
name=\"toc-item-class\" filter=\"\"\"$itemClassFilter$\"\"\"
value=\"toc-item-selected\" emptyValue=\"toc-item\">\n<li
class=<<toc-item-class>>>\n<$link>\n<$list
filter=\"[all[current]tagging[]limit[1]]\" variable=\"ignore\"
emptyMessage=\"<$button
class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>\">\n<$reveal
type=\"nomatch\" state=<<toc-state>> text=<<currentTiddler>>>\n<$button
set=<<toc-state>> setTo=<<currentTiddler>>
class=\"tc-btn-invisible\">\n{{$:/core/images/right-arrow}}\n</$button>\n</$reveal>\n<$reveal
type=\"match\" state=<<toc-state>> text=<<currentTiddler>>>\n<$button
set=<<toc-state>> setTo=\"x-all-close\"
class=\"tc-btn-invisible\">\n{{$:/core/images/down-arrow}}\n</$button>\n</$reveal>\n</$list>\n<<toc-caption>>\n</$link>\n<$reveal
type=\"match\" state=<<toc-state>> text=<<currentTiddler>>>\n<$macrocall
$name=\"toc-selective-single-expandable\" tag=<<currentTiddler>>
sort=\"\"\"$sort$\"\"\"
itemClassFilter=\"\"\"$itemClassFilter$\"\"\"/>\n</$reveal>\n</li>\n</$set>\n</$set>\n\\end\n\n\\define
toc-unlinked-selective-single-expandable-body(tag,sort:\"\",itemClassFilter)\n<$set
name=\"toc-state\" value=<<qualify \"$:/state/toc/$tag$\">>>\n<$set
name=\"toc-item-class\" filter=\"\"\"$itemClassFilter$\"\"\"
value=\"toc-item-selected\" emptyValue=\"toc-item\">\n<li
class=<<toc-item-class>>>\n<$list filter=\"[all[current]tagging[]limit[1]]\"
variable=\"ignore\" emptyMessage=\"<$button
class='tc-btn-invisible'>{{$:/core/images/blank}}</$button> <$view
field='caption'><$view field='title'/></$view>\">\n<$reveal type=\"nomatch\"
state=<<toc-state>> text=<<currentTiddler>>>\n<$button set=<<toc-state>>
setTo=<<currentTiddler>>
class=\"tc-btn-invisible\">\n{{$:/core/images/right-arrow}}\n<<toc-caption>>\n</$button>\n</$reveal>\n<$reveal
type=\"match\" state=<<toc-state>> text=<<currentTiddler>>>\n<$button
set=<<toc-state>> setTo=\"close\"
class=\"tc-btn-invisible\">\n{{$:/core/images/down-arrow}}\n<<toc-caption>>\n</$button>\n</$reveal>\n</$list>\n<$reveal
type=\"match\" state=<<toc-state>> text=<<currentTiddler>>>\n<$macrocall
$name=\"\"\"toc-selective-single-expandable\"\"\" tag=<<currentTiddler>>
sort=\"\"\"$sort$\"\"\"
itemClassFilter=\"\"\"$itemClassFilter$\"\"\"/>\n</$reveal>\n</li>\n</$set>\n</$set>\n\\end",
"title": "$:/core/macros/toc-single",
"tags": "$:/tags/Macro autocollaps",
"modified": "20150303114034072"
},
{
"created": "20150303113637394",
"text": "Hi,\n\nyes that is very possible and here is how you would do
it:\n\n```\n\\define
toc-selective-single-expandable(tag,sort:\"\",itemClassFilter)\n<ol
class=\"tc-toc toc-selective-expandable\">\n<$list
filter=\"[all[shadows+tiddlers]tag[$tag$]!has[draft.of]$sort$]\">\n<$list
filter=\"[all[current]toc-link[no]]\" variable=\"ignore\"
emptyMessage=\"<<toc-linked-selective-single-expandable-body tag:'$tag$'
sort:'$sort$'
itemClassFilter:'$itemClassFilter$'>>\">\n<<toc-unlinked-selective-single-expandable-body
tag:\"\"\"$tag$\"\"\" sort:\"\"\"$sort$\"\"\"
itemClassFilter:\"\"\"$itemClassFilter$\"\"\">>\n</$list>\n</$list>\n</ol>\n\\end\n\n\\define
toc-linked-selective-single-expandable-body(tag,sort:\"\",itemClassFilter)\n<$set
name=\"toc-state\" value=<<qualify \"$:/state/toc/$tag$\">>>\n<$set
name=\"toc-item-class\" filter=\"\"\"$itemClassFilter$\"\"\"
value=\"toc-item-selected\" emptyValue=\"toc-item\">\n<li
class=<<toc-item-class>>>\n<$link>\n<$list
filter=\"[all[current]tagging[]limit[1]]\" variable=\"ignore\"
emptyMessage=\"<$button
class='tc-btn-invisible'>{{$:/core/images/blank}}</$button>\">\n<$reveal
type=\"nomatch\" state=<<toc-state>> text=<<currentTiddler>>>\n<$button
set=<<toc-state>> setTo=<<currentTiddler>>
class=\"tc-btn-invisible\">\n{{$:/core/images/right-arrow}}\n</$button>\n</$reveal>\n<$reveal
type=\"match\" state=<<toc-state>> text=<<currentTiddler>>>\n<$button
set=<<toc-state>> setTo=\"x-all-close\"
class=\"tc-btn-invisible\">\n{{$:/core/images/down-arrow}}\n</$button>\n</$reveal>\n</$list>\n<<toc-caption>>\n</$link>\n<$reveal
type=\"match\" state=<<toc-state>> text=<<currentTiddler>>>\n<$macrocall
$name=\"toc-selective-single-expandable\" tag=<<currentTiddler>>
sort=\"\"\"$sort$\"\"\"
itemClassFilter=\"\"\"$itemClassFilter$\"\"\"/>\n</$reveal>\n</li>\n</$set>\n</$set>\n\\end\n\n\\define
toc-unlinked-selective-single-expandable-body(tag,sort:\"\",itemClassFilter)\n<$set
name=\"toc-state\" value=<<qualify \"$:/state/toc/$tag$\">>>\n<$set
name=\"toc-item-class\" filter=\"\"\"$itemClassFilter$\"\"\"
value=\"toc-item-selected\" emptyValue=\"toc-item\">\n<li
class=<<toc-item-class>>>\n<$list filter=\"[all[current]tagging[]limit[1]]\"
variable=\"ignore\" emptyMessage=\"<$button
class='tc-btn-invisible'>{{$:/core/images/blank}}</$button> <$view
field='caption'><$view field='title'/></$view>\">\n<$reveal type=\"nomatch\"
state=<<toc-state>> text=<<currentTiddler>>>\n<$button set=<<toc-state>>
setTo=<<currentTiddler>>
class=\"tc-btn-invisible\">\n{{$:/core/images/right-arrow}}\n<<toc-caption>>\n</$button>\n</$reveal>\n<$reveal
type=\"match\" state=<<toc-state>> text=<<currentTiddler>>>\n<$button
set=<<toc-state>> setTo=\"close\"
class=\"tc-btn-invisible\">\n{{$:/core/images/down-arrow}}\n<<toc-caption>>\n</$button>\n</$reveal>\n</$list>\n<$reveal
type=\"match\" state=<<toc-state>> text=<<currentTiddler>>>\n<$macrocall
$name=\"\"\"toc-selective-single-expandable\"\"\" tag=<<currentTiddler>>
sort=\"\"\"$sort$\"\"\"
itemClassFilter=\"\"\"$itemClassFilter$\"\"\"/>\n</$reveal>\n</li>\n</$set>\n</$set>\n\\end\n```\n\nCopy
and append this either in `$:/core/macros/toc` or make a new tiddler copy this
into it and tag it `$:/tags/Macro`.\nThen use it
with:\n\n```\n<<toc-selective-single-expandable
'TableOfContents'>>\n```\n\n/Andreas\n",
"title": "Re: [tw] [TW5] Autocollaps TOC categories",
"tags": "autocollaps",
"modified": "20150303114036277"
}
]