1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-02 14:29:55 +00:00

add 2 testcase examples for toc-simple

This commit is contained in:
pmario 2024-07-24 12:09:02 +02:00
parent 7b6c940ca7
commit a44fb50cf7
4 changed files with 69 additions and 8 deletions

View File

@ -0,0 +1,42 @@
title: Narrative
* The following code defines a "Simple Table of Contents" using "root" as the base tag.
* Click through all the tabs to get additional info
{{Narrative-extended}}
+
title: root
list: First Third Fourth
The list-field in the "root" tag-tiddler can be used to define the "sort order" of the TOC
+
title: First
tags: root
1st 1st 1st 1st 1st
+
title: Second
tags: First
2nd 2nd 2nd 2nd 2nd
+
title: Third
tags: root
3rd 3rd 3rd 3rd 3rd
+
title: Fourth
caption: fourth-caption
tags: root
4th 4th 4th 4th 4th
This tiddler contains a caption, which will be shown in the TOC instead of the tiddler title
+
title: Output
<div class="tc-table-of-contents">
<<toc tag:"root">>
</div>

View File

@ -0,0 +1,7 @@
created: 20240724070813184
description: Simple TOC
display-format: wikitext
modified: 20240724100513345
tags: $:/tags/wiki-test-spec
title: Examples/TOC/SimpleToc
type: text/vnd.tiddlywiki-multiple

View File

@ -0,0 +1,20 @@
created: 20240724082221230
modified: 20240724100646572
tags:
title: Examples/TOC/SimpleToc/captionField
type: text/vnd.tiddlywiki
<$testcase testOutput="Output">
<$data title="Description" text="Simple TOC - captionField parameter"/>
<$data title="Narrative-extended" text="""* The "Fifth" tiddler has an alternative "caption-field" """/>
<$data $compound-tiddler="Examples/TOC/SimpleToc"/>
<$data title="Fifth" tags="Fourth" text="5th" alt="alt-caption"/>
<$data title="Output" text="""<div class="tc-table-of-contents">
<<toc tag:"root" captionField:"alt">>
</div>
"""/>

View File

@ -1,8 +0,0 @@
code-body: yes
created: 20240618150559884
modified: 20240618150722129
tags: $:/tags/Global
title: test-tags/Global-tv-toc-show-new-child
type: text/vnd.tiddlywiki
\define tv-toc-show-new-child() yes