1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 00:50:28 +00:00

Trim Saga: Another batch of medium-sized files (#6270)

* adding trim: Last of the macros I think

* adding trim: EditTemplate and ItemSidebarIcon

* adding trim: control panel basics

* Another hidden space to guide the uglifier

* More consistent nested quoting

* Reconciling tests for \whitespace trim
This commit is contained in:
Cameron Fischer 2022-03-26 11:19:04 -04:00 committed by GitHub
parent 5d69fe7bef
commit 98a509dbf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 49 additions and 122 deletions

View File

@ -5,6 +5,7 @@ caption: {{$:/language/ControlPanel/Basics/Caption}}
\define lingo-base() $:/language/ControlPanel/Basics/
\define show-filter-count(filter)
\whitespace trim
<$button class="tc-btn-invisible">
<$action-setfield $tiddler="$:/temp/advancedsearch" $value="""$filter$"""/>
<$action-setfield $tiddler="$:/temp/advancedsearch/input" $value="""$filter$"""/>
@ -13,9 +14,11 @@ caption: {{$:/language/ControlPanel/Basics/Caption}}
<$action-navigate $to="$:/AdvancedSearch"/>
<$action-sendmessage $message="tm-focus-selector" $param=".tc-advanced-search input"/>
''<$count filter="""$filter$"""/>''
&#32;
{{$:/core/images/advanced-search-button}}
</$button>
\end
\whitespace trim
|<<lingo Version/Prompt>> |''<<version>>'' |
|<$link to="$:/SiteTitle"><<lingo Title/Prompt>></$link> |<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> |

View File

@ -3,6 +3,7 @@ tags: $:/tags/ControlPanel/Advanced
caption: {{$:/language/ControlPanel/EditorTypes/Caption}}
\define lingo-base() $:/language/ControlPanel/EditorTypes/
\whitespace trim
<<lingo Hint>>

View File

@ -1,19 +1,38 @@
title: $:/core/ui/EditTemplate
\define delete-edittemplate-state-tiddlers() <$action-deletetiddler $filter="[<newFieldNameTiddler>] [<newFieldValueTiddler>] [<newFieldNameInputTiddler>] [<newFieldNameSelectionTiddler>] [<newTagNameTiddler>] [<newTagNameInputTiddler>] [<newTagNameSelectionTiddler>] [<typeInputTiddler>] [<typeSelectionTiddler>]"/>
\define save-tiddler-actions()
\whitespace trim
<$action-sendmessage $message="tm-add-tag" $param={{{ [<newTagNameTiddler>get[text]] }}}/>
<$action-sendmessage $message="tm-add-field" $name={{{ [<newFieldNameTiddler>get[text]] }}} $value={{{ [<newFieldValueTiddler>get[text]] }}}/>
<<delete-edittemplate-state-tiddlers>>
<$action-sendmessage $message="tm-save-tiddler"/>
\end
\define cancel-delete-tiddler-actions(message)
<<delete-edittemplate-state-tiddlers>>
\whitespace trim
<<delete-edittemplate-state-tiddlers>>
<$action-sendmessage $message="tm-$message$-tiddler"/>
\end
<div data-tiddler-title=<<currentTiddler>> data-tags={{!!tags}} class={{{ tc-tiddler-frame tc-tiddler-edit-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}}>
\whitespace trim
<div
data-tiddler-title=<<currentTiddler>>
data-tags={{!!tags}}
class={{{ tc-tiddler-frame tc-tiddler-edit-frame [<currentTiddler>is[tiddler]then[tc-tiddler-exists]] [<currentTiddler>is[missing]!is[shadow]then[tc-tiddler-missing]] [<currentTiddler>is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [<currentTiddler>is[system]then[tc-tiddler-system]] [{!!class}] [<currentTiddler>tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}}>
<$fieldmangler>
<$vars storyTiddler=<<currentTiddler>> newTagNameTiddler=<<qualify "$:/temp/NewTagName">> newFieldNameTiddler=<<qualify "$:/temp/NewFieldName">> newFieldValueTiddler=<<qualify "$:/temp/NewFieldValue">> newFieldNameInputTiddler=<<qualify "$:/temp/NewFieldName/input">> newFieldNameSelectionTiddler=<<qualify "$:/temp/NewFieldName/selected-item">> newTagNameInputTiddler=<<qualify "$:/temp/NewTagName/input">> newTagNameSelectionTiddler=<<qualify "$:/temp/NewTagName/selected-item">> typeInputTiddler=<<qualify "$:/temp/Type/input">> typeSelectionTiddler=<<qualify "$:/temp/Type/selected-item">>>
<$vars
storyTiddler=<<currentTiddler>>
newTagNameTiddler=<<qualify "$:/temp/NewTagName">>
newFieldNameTiddler=<<qualify "$:/temp/NewFieldName">>
newFieldValueTiddler=<<qualify "$:/temp/NewFieldValue">>
newFieldNameInputTiddler=<<qualify "$:/temp/NewFieldName/input">>
newFieldNameSelectionTiddler=<<qualify "$:/temp/NewFieldName/selected-item">>
newTagNameInputTiddler=<<qualify "$:/temp/NewTagName/input">>
newTagNameSelectionTiddler=<<qualify "$:/temp/NewTagName/selected-item">>
typeInputTiddler=<<qualify "$:/temp/Type/input">>
typeSelectionTiddler=<<qualify "$:/temp/Type/selected-item">>>
<$keyboard key="((cancel-edit-tiddler))" actions=<<cancel-delete-tiddler-actions "cancel">> tag="div">
<$keyboard key="((save-tiddler))" actions=<<save-tiddler-actions>> tag="div">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/EditTemplate]!has[draft.of]]" variable="listItem">

View File

@ -2,6 +2,7 @@ title: $:/Manager/ItemSidebar/Icon
tags: $:/tags/Manager/ItemSidebar
caption: {{$:/language/Manager/Item/Icon}}
\whitespace trim
<p>
<div class="tc-manager-icon-editor">
<$button popup=<<qualify "$:/state/popup/image-picker">> class="tc-btn-invisible">
@ -12,10 +13,9 @@ caption: {{$:/language/Manager/Item/Icon}}
<div class="tc-block-dropdown-wrapper" style="position: static;">
<$reveal state=<<qualify "$:/state/popup/image-picker">> type="nomatch" text="" default="" tag="div" class="tc-popup">
<div class="tc-block-dropdown tc-popup-keep" style="width: 80%; left: 10%; right: 10%; padding: 0.5em;">
<$macrocall $name="image-picker-include-tagged-images" actions="""
<$action-setfield $field="icon" $value=<<imageTitle>>/>
<$action-deletetiddler $tiddler=<<qualify "$:/state/popup/image-picker">>/>
"""/>
<$macrocall
$name="image-picker-include-tagged-images"
actions="<$action-setfield $field='icon' $value=<<imageTitle>>/><$action-deletetiddler $tiddler=<<qualify '$:/state/popup/image-picker'>>/>"/>
</div>
</$reveal>
</div>

View File

@ -2,11 +2,15 @@ title: $:/core/macros/tabs
tags: $:/tags/Macro
\define tabs(tabsList,default,state:"$:/state/tab",class,template,buttonTemplate,retain,actions,explicitState)
<$set name="qualifiedState" value=<<qualify "$state$">>>
<$vars tabsState={{{ [<__explicitState__>minlength[1]] ~[<qualifiedState>] }}}>
\whitespace trim
<$let
qualifiedState=<<qualify "$state$">>
tabsState={{{ [<__explicitState__>minlength[1]] ~[<qualifiedState>] }}}>
<div class="tc-tab-set $class$">
<div class="tc-tab-buttons $class$">
<$list filter="$tabsList$" variable="currentTab" storyview="pop"><$set name="save-currentTiddler" value=<<currentTiddler>>><$tiddler tiddler=<<currentTab>>><$button set=<<tabsState>> setTo=<<currentTab>> default="$default$" selectedClass="tc-tab-selected" tooltip={{!!tooltip}}>
<$list filter="$tabsList$" variable="currentTab" storyview="pop"><$set name="save-currentTiddler" value=<<currentTiddler>>>
<$tiddler tiddler=<<currentTab>>>
<$button set=<<tabsState>> setTo=<<currentTab>> default="$default$" selectedClass="tc-tab-selected" tooltip={{!!tooltip}}>
<$tiddler tiddler=<<save-currentTiddler>>>
<$set name="tv-wikilinks" value="no">
<$transclude tiddler="$buttonTemplate$" mode="inline">
@ -33,6 +37,5 @@ tags: $:/tags/Macro
</$list>
</div>
</div>
</$vars>
</$set>
</$let>
\end

View File

@ -6,28 +6,31 @@ tags: $:/tags/Macro
\end
\define leaf-node(prefix,chunk)
\whitespace trim
<li>
<$list filter="[<__prefix__>addsuffix<__chunk__>is[shadow]] [<__prefix__>addsuffix<__chunk__>is[tiddler]]" variable="full-title">
<$list filter="[<full-title>removeprefix<__prefix__>]" variable="chunk">
<span>{{$:/core/images/file}}</span> <$macrocall $name="leaf-link" full-title=<<full-title>> chunk=<<chunk>>/>
<span>{{$:/core/images/file}}</span>&#32;<$macrocall $name="leaf-link" full-title=<<full-title>> chunk=<<chunk>>/>
</$list>
</$list>
</li>
\end
\define branch-node(prefix,chunk,separator: "/")
\whitespace trim
<li>
<$set name="reveal-state" value={{{ [[$:/state/tree/]addsuffix<__prefix__>addsuffix<__chunk__>] }}}>
<$reveal type="nomatch" stateTitle=<<reveal-state>> text="show">
<$button setTitle=<<reveal-state>> setTo="show" class="tc-btn-invisible">
{{$:/core/images/folder}} <$text text=<<__chunk__>>/>
{{$:/core/images/folder}}&#32;<$text text=<<__chunk__>>/>
</$button>
</$reveal>
<$reveal type="match" stateTitle=<<reveal-state>> text="show">
<$button setTitle=<<reveal-state>> setTo="hide" class="tc-btn-invisible">
{{$:/core/images/folder}} <$text text=<<__chunk__>>/>
{{$:/core/images/folder}}&#32;<$text text=<<__chunk__>>/>
</$button>
</$reveal>
&#32;
<span>(<$count filter="[all[shadows+tiddlers]removeprefix<__prefix__>removeprefix<__chunk__>] -[<__prefix__>addsuffix<__chunk__>]"/>)</span>
<$reveal type="match" stateTitle=<<reveal-state>> text="show">
<$macrocall $name="tree-node" prefix={{{ [<__prefix__>addsuffix<__chunk__>] }}} separator=<<__separator__>>/>
@ -37,6 +40,7 @@ tags: $:/tags/Macro
\end
\define tree-node(prefix,separator: "/")
\whitespace trim
<ol>
<$list filter="[all[shadows+tiddlers]removeprefix<__prefix__>splitbefore<__separator__>sort[]!suffix<__separator__>]" variable="chunk">
<$macrocall $name="leaf-node" prefix=<<__prefix__>> chunk=<<chunk>> separator=<<__separator__>>/>
@ -48,6 +52,7 @@ tags: $:/tags/Macro
\end
\define tree(prefix: "$:/",separator: "/")
\whitespace trim
<div class="tc-tree">
<span><$text text=<<__prefix__>>/></span>
<div>

View File

@ -2,32 +2,4 @@ title: expected-html-tabs-horizontal-all
type: text/html
description: Horizontal tabs with all parameters active. This is the expected HTML output from a test in test-wikitext-tabs-macro.js
<p>
<div class="tc-tab-set ">
<div class="tc-tab-buttons ">
<button class="">
t 1
</button><button class=" tc-tab-selected">
t 2
</button><button class="">
desc
</button><button class="">
TabFour
</button>
</div>
<div class="tc-tab-divider "></div>
<div class="tc-tab-content ">
<div class=" tc-reveal" hidden="true"></div><div class=" tc-reveal"><h2 class=""><a class="tc-tiddlylink tc-tiddlylink-resolves" href="#TabTwo">TabTwo</a></h2><p><p>Text tab 2</p></p></div><div class=" tc-reveal" hidden="true"></div><div class=" tc-reveal" hidden="true"></div>
</div>
</div>
</p>
<p><div class="tc-tab-set "><div class="tc-tab-buttons "><button class="">t 1</button><button class=" tc-tab-selected">t 2</button><button class="">desc</button><button class="">TabFour</button></div><div class="tc-tab-divider "></div><div class="tc-tab-content "><div class=" tc-reveal" hidden="true"></div><div class=" tc-reveal"><h2 class=""><a class="tc-tiddlylink tc-tiddlylink-resolves" href="#TabTwo">TabTwo</a></h2><p><p>Text tab 2</p></p></div><div class=" tc-reveal" hidden="true"></div><div class=" tc-reveal" hidden="true"></div></div></div></p>

View File

@ -2,42 +2,4 @@ title: expected-html-tabs-horizontal
type: text/html
description: Horizontal tabs test - This is the expected HTML output from a test in test-wikitext-tabs-macro.js
<p>
<div class="tc-tab-set ">
<div class="tc-tab-buttons ">
<button class="">
t 1
</button><button class=" tc-tab-selected">
t 2
</button><button class="">
t 3
</button><button class="">
TabFour
</button>
</div>
<div class="tc-tab-divider "></div>
<div class="tc-tab-content ">
<div class=" tc-reveal" hidden="true"></div><div class=" tc-reveal"><p>Text tab 2</p></div><div class=" tc-reveal" hidden="true"></div><div class=" tc-reveal" hidden="true"></div>
</div>
</div>
</p>
<p><div class="tc-tab-set "><div class="tc-tab-buttons "><button class="">t 1</button><button class=" tc-tab-selected">t 2</button><button class="">t 3</button><button class="">TabFour</button></div><div class="tc-tab-divider "></div><div class="tc-tab-content "><div class=" tc-reveal" hidden="true"></div><div class=" tc-reveal"><p>Text tab 2</p></div><div class=" tc-reveal" hidden="true"></div><div class=" tc-reveal" hidden="true"></div></div></div></p>

View File

@ -2,42 +2,4 @@ title: expected-html-tabs-vertical
type: text/html
description: Vertical tabs test -- This is the expected HTML output from the test in test-wikitext-tabs-macro.js
<p>
<div class="tc-tab-set tc-vertical">
<div class="tc-tab-buttons tc-vertical">
<button class="">
t 1
</button><button class=" tc-tab-selected">
t 2
</button><button class="">
t 3
</button><button class="">
TabFour
</button>
</div>
<div class="tc-tab-divider tc-vertical"></div>
<div class="tc-tab-content tc-vertical">
<div class=" tc-reveal" hidden="true"></div><div class=" tc-reveal"><p>Text tab 2</p></div><div class=" tc-reveal" hidden="true"></div><div class=" tc-reveal" hidden="true"></div>
</div>
</div>
</p>
<p><div class="tc-tab-set tc-vertical"><div class="tc-tab-buttons tc-vertical"><button class="">t 1</button><button class=" tc-tab-selected">t 2</button><button class="">t 3</button><button class="">TabFour</button></div><div class="tc-tab-divider tc-vertical"></div><div class="tc-tab-content tc-vertical"><div class=" tc-reveal" hidden="true"></div><div class=" tc-reveal"><p>Text tab 2</p></div><div class=" tc-reveal" hidden="true"></div><div class=" tc-reveal" hidden="true"></div></div></div></p>