1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 12:07:19 +00:00

Text-slicer: Introduce separate static templates

Much easier to have separate sets of templates for interactive vs
static document trees
This commit is contained in:
Jermolene 2015-08-31 19:50:56 +01:00
parent cc4bef9c0e
commit 0be82ea7fb
13 changed files with 62 additions and 23 deletions

View File

@ -1,4 +1,3 @@
title: $:/plugins/tiddlywiki/text-slicer/exporters/full-doc title: $:/plugins/tiddlywiki/text-slicer/exporters/full-doc
tags: $:/tags/ViewTemplate
<$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/static/tiddler" listItem="item"/>

View File

@ -21,7 +21,10 @@ $:/config/plugins/tiddlywiki/text-slicer/heading-status/$(currentTiddler)$
<$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>
{{||$:/plugins/tiddlywiki/text-slicer/ui/view-document-button}} <$button>
<$action-sendmessage $message="tm-open-window" $param=<<currentTiddler>> template="$:/plugins/tiddlywiki/text-slicer/exporters/full-doc"/>
View document
</$button>
</div> </div>

View File

@ -8,8 +8,6 @@ $(tv-heading-status-config-title)$/$(currentTiddler)$
<$set name="tv-heading-status-config-title" value=<<config-heading-status>>> <$set name="tv-heading-status-config-title" value=<<config-heading-status>>>
<div class="tc-document-tiddler"> <div class="tc-document-tiddler">
<div class="tc-document-tiddler-toolbar"> <div class="tc-document-tiddler-toolbar">
<$list filter="[<tv-show-gadgets>prefix[yes]]" variable="hasToolbar">
<$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>>>
<$button set=<<tv-heading-status-config-title>> setTo="open" class="tc-btn-invisible"> <$button set=<<tv-heading-status-config-title>> setTo="open" class="tc-btn-invisible">
{{$:/core/images/down-arrow}} {{$:/core/images/down-arrow}}
@ -20,8 +18,6 @@ $(tv-heading-status-config-title)$/$(currentTiddler)$
{{$:/core/images/right-arrow}} {{$:/core/images/right-arrow}}
</$button> </$button>
</$reveal> </$reveal>
</$list>
</div> </div>
<$link tag="$level$" class="tc-document-tiddler-link"> <$link tag="$level$" class="tc-document-tiddler-link">
<$view field="text"/> <$view field="text"/>

View File

@ -0,0 +1,3 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/static/document
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler" listItem="item"/>

View File

@ -0,0 +1,10 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/static/heading
\define body(level:"h1")
<$level$>
<$view field="text"/>
</$level$>
<$list filter="[tag<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler" listItem="item"/>
\end
<$macrocall $name="body" level={{!!toc-heading-level}}/>

View File

@ -0,0 +1,7 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/static/item
<$link tag="li" class="tc-document-tiddler-link">
<$transclude/>
</$link>

View File

@ -0,0 +1,9 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/static/list
\define body(type:"ul")
<$type$>
<$list filter={{!!text}} template="$:/plugins/tiddlywiki/text-slicer/templates/static/tiddler" listItem="item"/>
</$type$>
\end
<$macrocall $name="body" type={{!!toc-list-type}}/>

View File

@ -0,0 +1,7 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/static/paragraph
<$link tag="div" class="tc-document-tiddler-link">
<$transclude/>
</$link>

View File

@ -0,0 +1,21 @@
title: $:/plugins/tiddlywiki/text-slicer/templates/static/tiddler
<$reveal type="match" state="!!toc-type" text="document">
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/document" mode="block"/>
</$reveal>
<$reveal type="match" state="!!toc-type" text="heading">
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/heading" mode="block"/>
</$reveal>
<$reveal type="match" state="!!toc-type" text="paragraph">
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/paragraph" mode="block"/>
</$reveal>
<$reveal type="match" state="!!toc-type" text="list">
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/list" mode="block"/>
</$reveal>
<$reveal type="match" state="!!toc-type" text="item">
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/static/item" mode="block"/>
</$reveal>

View File

@ -5,12 +5,8 @@ tags: $:/tags/AboveStory
<$set name="tv-default-heading-state" value="closed"> <$set name="tv-default-heading-state" value="closed">
<$set name="tv-show-gadgets" value="yes">
<$list filter="[toc-type[document]!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/interactive/document"/> <$list filter="[toc-type[document]!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/interactive/document"/>
</$set> </$set>
</$set>
</$scrollable> </$scrollable>

View File

@ -1,7 +1,5 @@
title: $:/plugins/tiddlywiki/text-slicer/ui/toolbar/tiddler-toolbar title: $:/plugins/tiddlywiki/text-slicer/ui/toolbar/tiddler-toolbar
<$list filter="[<tv-show-gadgets>prefix[yes]]" variable="hasToolbar">
<div class="tc-slice-toolbar"> <div class="tc-slice-toolbar">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/TextSlicerToolbar]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list> <$list filter="[all[shadows+tiddlers]tag[$:/tags/TextSlicerToolbar]!has[draft.of]]" variable="listItem"><$transclude tiddler=<<listItem>>/></$list>
</div> </div>
</$list>

View File

@ -1,6 +0,0 @@
title: $:/plugins/tiddlywiki/text-slicer/ui/view-document-button
<$button>
<$action-sendmessage $message="tm-open-window" $param=<<currentTiddler>> template="$:/plugins/tiddlywiki/text-slicer/exporters/full-doc"/>
View document
</$button>

View File

@ -13,14 +13,10 @@ tags: $:/tags/ViewTemplate
<$set name="tv-default-heading-state" value="open"> <$set name="tv-default-heading-state" value="open">
<$set name="tv-show-gadgets" value="yes">
<$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler"/> <$transclude tiddler="$:/plugins/tiddlywiki/text-slicer/templates/interactive/tiddler"/>
</$set> </$set>
</$set>
</div> </div>
</$reveal> </$reveal>