mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-06-24 22:33:16 +00:00
Text-slicer improvements
1. Switch from using the text field of lists for storing the associated filter to using the field `toc-list-filter` (to make it harder to accidentally parse the text of an ordinary tiddler as a filter) 2. Fix several bugs
This commit is contained in:
parent
5dcb53abae
commit
4ea5dce284
|
@ -132,8 +132,8 @@ The tiddler representing the list itself has the following fields:
|
||||||
|
|
||||||
* ''toc-type'': the text "list"
|
* ''toc-type'': the text "list"
|
||||||
* ''toc-list-type'': the text "ul" or "ol"
|
* ''toc-list-type'': the text "ul" or "ol"
|
||||||
|
* ''toc-list-filter'': the default filter used to generate the titles of the list items
|
||||||
* ''title'': an automatically generated unique title
|
* ''title'': an automatically generated unique title
|
||||||
* ''text'': the default filter used to generate the titles of the list items
|
|
||||||
* ''list'': ordered list of titles of tiddlers representing the items in this list
|
* ''list'': ordered list of titles of tiddlers representing the items in this list
|
||||||
* ''tags'': tagged with the title of the parent heading
|
* ''tags'': tagged with the title of the parent heading
|
||||||
** In addition, any CSS classes found in the HTML are converted into tags
|
** In addition, any CSS classes found in the HTML are converted into tags
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
title: $:/plugins/tiddlywiki/text-slicer/exporters/full-doc
|
title: $:/plugins/tiddlywiki/text-slicer/exporters/full-doc
|
||||||
|
|
||||||
{{||$:/plugins/tiddlywiki/text-slicer/templates/static/document}}
|
{{||$:/plugins/tiddlywiki/text-slicer/templates/static/document}}
|
|
@ -175,8 +175,9 @@ Slicer.prototype.processNode = function(domNode) {
|
||||||
this.parentStack.push({type: tagName, title: this.addTiddler({
|
this.parentStack.push({type: tagName, title: this.addTiddler({
|
||||||
"toc-type": "list",
|
"toc-type": "list",
|
||||||
"toc-list-type": tagName,
|
"toc-list-type": tagName,
|
||||||
|
"toc-list-filter": "[tag<currentTiddler>!has[draft.of]]",
|
||||||
|
text: "",
|
||||||
title: title,
|
title: title,
|
||||||
text: "[tag<currentTiddler>!has[draft.of]]",
|
|
||||||
list: [],
|
list: [],
|
||||||
tags: tags
|
tags: tags
|
||||||
})});
|
})});
|
||||||
|
|
|
@ -23,7 +23,7 @@ $:/config/plugins/tiddlywiki/text-slicer/heading-status/$(currentTiddler)$
|
||||||
|
|
||||||
<$set name="tv-exclude-filter" value={{!!toc-exclude-filter}}>
|
<$set name="tv-exclude-filter" value={{!!toc-exclude-filter}}>
|
||||||
|
|
||||||
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler" listItem="item"/>
|
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler"/>
|
||||||
|
|
||||||
</$set>
|
</$set>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
title: $:/plugins/tiddlywiki/text-slicer/templates/interactive/heading
|
title: $:/plugins/tiddlywiki/text-slicer/templates/interactive/heading
|
||||||
|
|
||||||
\define config-heading-status()
|
\define config-heading-status()
|
||||||
$(tv-heading-status-config-title)$/$(currentTiddler)$
|
$(tv-heading-status-config-title)$/$(tv-heading-status-config-prefix)$/$(currentTiddler)$
|
||||||
\end
|
\end
|
||||||
|
|
||||||
\define body(level:"h1")
|
\define body(level:"h1")
|
||||||
|
@ -23,7 +23,7 @@ $(tv-heading-status-config-title)$/$(currentTiddler)$
|
||||||
<$view field="text"/>
|
<$view field="text"/>
|
||||||
</$link>
|
</$link>
|
||||||
<$reveal type="nomatch" state=<<tv-heading-status-config-title>> text="open" default=<<tv-default-heading-state>>>
|
<$reveal type="nomatch" state=<<tv-heading-status-config-title>> text="open" default=<<tv-default-heading-state>>>
|
||||||
<$list filter="[tag<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler" listItem="item"/>
|
<$list filter="[tag<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler"/>
|
||||||
</$reveal>
|
</$reveal>
|
||||||
</div>
|
</div>
|
||||||
</$set>
|
</$set>
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
title: $:/plugins/tiddlywiki/text-slicer/templates/interactive/list
|
title: $:/plugins/tiddlywiki/text-slicer/templates/interactive/list
|
||||||
|
|
||||||
{{||$:/plugins/tiddlywiki/text-slicer/templates/static/list}}
|
\define body(type:"ul")
|
||||||
|
<$type$>
|
||||||
|
<$list filter="""[all[current]] $(tv-exclude-filter)$ +[limit[1]]""" variable="item">
|
||||||
|
<$list filter={{!!toc-list-filter}} template="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler"/>
|
||||||
|
</$list>
|
||||||
|
</$type$>
|
||||||
|
\end
|
||||||
|
|
||||||
|
<$macrocall $name="body" type={{!!toc-list-type}}/>
|
||||||
|
|
|
@ -3,7 +3,7 @@ title: $:/plugins/tiddlywiki/text-slicer/templates/interactive/paragraph
|
||||||
\define body()
|
\define body()
|
||||||
<$link tag="div" class="tc-document-tiddler-link">
|
<$link tag="div" class="tc-document-tiddler-link">
|
||||||
|
|
||||||
<$list filter="""[all[current]] $(tv-exclude-filter)$""" listItem="item">
|
<$list filter="""[all[current]] $(tv-exclude-filter)$ +[limit[1]]""" variable="item">
|
||||||
|
|
||||||
<$transclude/>
|
<$transclude/>
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,6 @@ title: $:/plugins/tiddlywiki/text-slicer/templates/static/document
|
||||||
|
|
||||||
<$set name="tv-exclude-filter" value={{!!toc-exclude-filter}}>
|
<$set name="tv-exclude-filter" value={{!!toc-exclude-filter}}>
|
||||||
|
|
||||||
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler" listItem="item"/>
|
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler"/>
|
||||||
|
|
||||||
</$set>
|
</$set>
|
||||||
|
|
|
@ -4,7 +4,7 @@ title: $:/plugins/tiddlywiki/text-slicer/templates/static/heading
|
||||||
<$level$>
|
<$level$>
|
||||||
<$view field="text"/>
|
<$view field="text"/>
|
||||||
</$level$>
|
</$level$>
|
||||||
<$list filter="[tag<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler" listItem="item"/>
|
<$list filter="[tag<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler"/>
|
||||||
\end
|
\end
|
||||||
|
|
||||||
<$macrocall $name="body" level={{!!toc-heading-level}}/>
|
<$macrocall $name="body" level={{!!toc-heading-level}}/>
|
||||||
|
|
|
@ -2,8 +2,8 @@ title: $:/plugins/tiddlywiki/text-slicer/templates/static/list
|
||||||
|
|
||||||
\define body(type:"ul")
|
\define body(type:"ul")
|
||||||
<$type$>
|
<$type$>
|
||||||
<$list filter="""[all[current]] $(tv-exclude-filter)$""" listItem="item">
|
<$list filter="""[all[current]] $(tv-exclude-filter)$ +[limit[1]]""" variable="item">
|
||||||
<$list filter={{!!text}} template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler" listItem="item"/>
|
<$list filter={{!!toc-list-filter}} template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler"/>
|
||||||
</$list>
|
</$list>
|
||||||
</$type$>
|
</$type$>
|
||||||
\end
|
\end
|
||||||
|
|
|
@ -3,7 +3,7 @@ title: $:/plugins/tiddlywiki/text-slicer/templates/static/paragraph
|
||||||
\define body()
|
\define body()
|
||||||
<div class="tc-document-tiddler-link">
|
<div class="tc-document-tiddler-link">
|
||||||
|
|
||||||
<$list filter="""[all[current]] $(tv-exclude-filter)$""" listItem="item">
|
<$list filter="""[all[current]] $(tv-exclude-filter)$ +[limit[1]]""" variable="item">
|
||||||
|
|
||||||
<$transclude/>
|
<$transclude/>
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,25 @@
|
||||||
title: $:/plugins/tiddlywiki/text-slicer/templates/static/tiddler
|
title: $:/plugins/tiddlywiki/text-slicer/templates/static/tiddler
|
||||||
|
|
||||||
<$reveal type="match" state="!!toc-type" text="document">
|
<$vars toc-type={{!!toc-type}}>
|
||||||
|
|
||||||
|
<$list filter="[<toc-type>prefix[document]]" variable="item">
|
||||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/document" mode="block"/>
|
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/document" mode="block"/>
|
||||||
</$reveal>
|
</$list>
|
||||||
|
|
||||||
<$reveal type="match" state="!!toc-type" text="heading">
|
<$list filter="[<toc-type>prefix[heading]]" variable="item">
|
||||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/heading" mode="block"/>
|
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/heading" mode="block"/>
|
||||||
</$reveal>
|
</$list>
|
||||||
|
|
||||||
<$reveal type="match" state="!!toc-type" text="paragraph">
|
<$list filter="[<toc-type>prefix[paragraph]]" variable="item">
|
||||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/paragraph" mode="block"/>
|
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/paragraph" mode="block"/>
|
||||||
</$reveal>
|
</$list>
|
||||||
|
|
||||||
<$reveal type="match" state="!!toc-type" text="list">
|
<$list filter="[<toc-type>prefix[list]]" variable="item">
|
||||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/list" mode="block"/>
|
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/list" mode="block"/>
|
||||||
</$reveal>
|
</$list>
|
||||||
|
|
||||||
<$reveal type="match" state="!!toc-type" text="item">
|
<$list filter="[<toc-type>prefix[item]]" variable="item">
|
||||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/item" mode="block"/>
|
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/item" mode="block"/>
|
||||||
</$reveal>
|
</$list>
|
||||||
|
|
||||||
|
</$vars>
|
||||||
|
|
|
@ -9,7 +9,7 @@ title: $:/plugins/tiddlywiki/text-slicer/ui/document/header
|
||||||
<$checkbox tiddler=<<config-show-toolbar>> field="text" checked="yes" unchecked="no" default="no"> Show toolbar</$checkbox>
|
<$checkbox tiddler=<<config-show-toolbar>> field="text" checked="yes" unchecked="no" default="no"> Show toolbar</$checkbox>
|
||||||
|
|
||||||
<$button>
|
<$button>
|
||||||
<$action-sendmessage $message="tm-open-window" $param=<<currentTiddler>> template="$:/plugins/tiddlywiki/text-slicer/exporters/full-doc"/>
|
<$action-sendmessage $message="tm-open-window" $param=<<currentTiddler>> template="$:/plugins/tiddlywiki/text-slicer/templates/static/document" output="text/html"/>
|
||||||
View document
|
View document
|
||||||
</$button>
|
</$button>
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,10 @@ tags: $:/tags/AboveStory
|
||||||
|
|
||||||
<$scrollable fallthrough="no" class="tc-document-preview-column">
|
<$scrollable fallthrough="no" class="tc-document-preview-column">
|
||||||
|
|
||||||
<$set name="tv-default-heading-state" value="closed">
|
<$vars tv-default-heading-state="closed" tv-heading-status-config-prefix="preview-column">
|
||||||
|
|
||||||
<$list filter="[toc-type[document]!has[draft.of]sort[title]]" template="$:/plugins/tiddlywiki/text-slicer/templates/interactive/document"/>
|
<$list filter="[toc-type[document]!has[draft.of]sort[title]]" template="$:/plugins/tiddlywiki/text-slicer/templates/interactive/document"/>
|
||||||
|
|
||||||
</$set>
|
</$vars>
|
||||||
|
|
||||||
</$scrollable>
|
</$scrollable>
|
||||||
|
|
|
@ -11,11 +11,11 @@ tags: $:/tags/ViewTemplate
|
||||||
|
|
||||||
<div class="tc-view-template-document-tiddler">
|
<div class="tc-view-template-document-tiddler">
|
||||||
|
|
||||||
<$set name="tv-default-heading-state" value="open">
|
<$vars tv-default-heading-state="closed" tv-heading-status-config-prefix="view-template">
|
||||||
|
|
||||||
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler"/>
|
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler"/>
|
||||||
|
|
||||||
</$set>
|
</$vars>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user