From 98a509dbf33df2b52df14b0cf0876c5c5dad09ea Mon Sep 17 00:00:00 2001 From: Cameron Fischer Date: Sat, 26 Mar 2022 11:19:04 -0400 Subject: [PATCH] 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 --- core/ui/ControlPanel/Basics.tid | 3 ++ core/ui/ControlPanel/EditorTypes.tid | 1 + core/ui/EditTemplate.tid | 25 ++++++++++-- core/ui/Manager/ItemSidebarIcon.tid | 8 ++-- core/wiki/macros/tabs.tid | 13 +++--- core/wiki/macros/tree.tid | 11 +++-- .../expected-html-tabs-horizontal-all.tid | 30 +------------- .../expected-html-tabs-horizontal.tid | 40 +------------------ .../expected-html-tabs-vertical.tid | 40 +------------------ 9 files changed, 49 insertions(+), 122 deletions(-) diff --git a/core/ui/ControlPanel/Basics.tid b/core/ui/ControlPanel/Basics.tid index 4897d232a..46df7e77c 100644 --- a/core/ui/ControlPanel/Basics.tid +++ b/core/ui/ControlPanel/Basics.tid @@ -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$"""/>'' + {{$:/core/images/advanced-search-button}} \end +\whitespace trim |<> |''<>'' | |<$link to="$:/SiteTitle"><> |<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> | diff --git a/core/ui/ControlPanel/EditorTypes.tid b/core/ui/ControlPanel/EditorTypes.tid index e8d3e3a0a..833275fc4 100644 --- a/core/ui/ControlPanel/EditorTypes.tid +++ b/core/ui/ControlPanel/EditorTypes.tid @@ -3,6 +3,7 @@ tags: $:/tags/ControlPanel/Advanced caption: {{$:/language/ControlPanel/EditorTypes/Caption}} \define lingo-base() $:/language/ControlPanel/EditorTypes/ +\whitespace trim <> diff --git a/core/ui/EditTemplate.tid b/core/ui/EditTemplate.tid index 32dde8587..480a28658 100644 --- a/core/ui/EditTemplate.tid +++ b/core/ui/EditTemplate.tid @@ -1,19 +1,38 @@ title: $:/core/ui/EditTemplate \define delete-edittemplate-state-tiddlers() <$action-deletetiddler $filter="[] [] [] [] [] [] [] [] []"/> + \define save-tiddler-actions() +\whitespace trim <$action-sendmessage $message="tm-add-tag" $param={{{ [get[text]] }}}/> <$action-sendmessage $message="tm-add-field" $name={{{ [get[text]] }}} $value={{{ [get[text]] }}}/> <> <$action-sendmessage $message="tm-save-tiddler"/> \end + \define cancel-delete-tiddler-actions(message) -<> +\whitespace trim +<> <$action-sendmessage $message="tm-$message$-tiddler"/> \end -
> data-tags={{!!tags}} class={{{ tc-tiddler-frame tc-tiddler-edit-frame [is[tiddler]then[tc-tiddler-exists]] [is[missing]!is[shadow]then[tc-tiddler-missing]] [is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [is[system]then[tc-tiddler-system]] [{!!class}] [tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}}> + +\whitespace trim +
> + data-tags={{!!tags}} + class={{{ tc-tiddler-frame tc-tiddler-edit-frame [is[tiddler]then[tc-tiddler-exists]] [is[missing]!is[shadow]then[tc-tiddler-missing]] [is[shadow]then[tc-tiddler-exists tc-tiddler-shadow]] [is[system]then[tc-tiddler-system]] [{!!class}] [tags[]encodeuricomponent[]addprefix[tc-tagged-]] +[join[ ]] }}}> <$fieldmangler> -<$vars storyTiddler=<> newTagNameTiddler=<> newFieldNameTiddler=<> newFieldValueTiddler=<> newFieldNameInputTiddler=<> newFieldNameSelectionTiddler=<> newTagNameInputTiddler=<> newTagNameSelectionTiddler=<> typeInputTiddler=<> typeSelectionTiddler=<>> +<$vars + storyTiddler=<> + newTagNameTiddler=<> + newFieldNameTiddler=<> + newFieldValueTiddler=<> + newFieldNameInputTiddler=<> + newFieldNameSelectionTiddler=<> + newTagNameInputTiddler=<> + newTagNameSelectionTiddler=<> + typeInputTiddler=<> + typeSelectionTiddler=<>> <$keyboard key="((cancel-edit-tiddler))" actions=<> tag="div"> <$keyboard key="((save-tiddler))" actions=<> tag="div"> <$list filter="[all[shadows+tiddlers]tag[$:/tags/EditTemplate]!has[draft.of]]" variable="listItem"> diff --git a/core/ui/Manager/ItemSidebarIcon.tid b/core/ui/Manager/ItemSidebarIcon.tid index c9fe85a27..0d0637f25 100644 --- a/core/ui/Manager/ItemSidebarIcon.tid +++ b/core/ui/Manager/ItemSidebarIcon.tid @@ -2,6 +2,7 @@ title: $:/Manager/ItemSidebar/Icon tags: $:/tags/Manager/ItemSidebar caption: {{$:/language/Manager/Item/Icon}} +\whitespace trim

<$button popup=<> class="tc-btn-invisible"> @@ -12,10 +13,9 @@ caption: {{$:/language/Manager/Item/Icon}}
<$reveal state=<> type="nomatch" text="" default="" tag="div" class="tc-popup">
-<$macrocall $name="image-picker-include-tagged-images" actions=""" -<$action-setfield $field="icon" $value=<>/> -<$action-deletetiddler $tiddler=<>/> -"""/> +<$macrocall + $name="image-picker-include-tagged-images" + actions="<$action-setfield $field='icon' $value=<>/><$action-deletetiddler $tiddler=<>/>"/>
diff --git a/core/wiki/macros/tabs.tid b/core/wiki/macros/tabs.tid index 63f5222c2..936d3fbf0 100644 --- a/core/wiki/macros/tabs.tid +++ b/core/wiki/macros/tabs.tid @@ -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=<>> -<$vars tabsState={{{ [<__explicitState__>minlength[1]] ~[] }}}> +\whitespace trim +<$let + qualifiedState=<> + tabsState={{{ [<__explicitState__>minlength[1]] ~[] }}}>
-<$list filter="$tabsList$" variable="currentTab" storyview="pop"><$set name="save-currentTiddler" value=<>><$tiddler tiddler=<>><$button set=<> setTo=<> default="$default$" selectedClass="tc-tab-selected" tooltip={{!!tooltip}}> +<$list filter="$tabsList$" variable="currentTab" storyview="pop"><$set name="save-currentTiddler" value=<>> +<$tiddler tiddler=<>> +<$button set=<> setTo=<> default="$default$" selectedClass="tc-tab-selected" tooltip={{!!tooltip}}> <$tiddler tiddler=<>> <$set name="tv-wikilinks" value="no"> <$transclude tiddler="$buttonTemplate$" mode="inline"> @@ -33,6 +37,5 @@ tags: $:/tags/Macro
- - + \end diff --git a/core/wiki/macros/tree.tid b/core/wiki/macros/tree.tid index 5bd877927..f73bd54fd 100644 --- a/core/wiki/macros/tree.tid +++ b/core/wiki/macros/tree.tid @@ -6,28 +6,31 @@ tags: $:/tags/Macro \end \define leaf-node(prefix,chunk) +\whitespace trim
  • <$list filter="[<__prefix__>addsuffix<__chunk__>is[shadow]] [<__prefix__>addsuffix<__chunk__>is[tiddler]]" variable="full-title"> <$list filter="[removeprefix<__prefix__>]" variable="chunk"> -{{$:/core/images/file}} <$macrocall $name="leaf-link" full-title=<> chunk=<>/> +{{$:/core/images/file}} <$macrocall $name="leaf-link" full-title=<> chunk=<>/>
  • \end \define branch-node(prefix,chunk,separator: "/") +\whitespace trim
  • <$set name="reveal-state" value={{{ [[$:/state/tree/]addsuffix<__prefix__>addsuffix<__chunk__>] }}}> <$reveal type="nomatch" stateTitle=<> text="show"> <$button setTitle=<> setTo="show" class="tc-btn-invisible"> -{{$:/core/images/folder}} <$text text=<<__chunk__>>/> +{{$:/core/images/folder}} <$text text=<<__chunk__>>/> <$reveal type="match" stateTitle=<> text="show"> <$button setTitle=<> setTo="hide" class="tc-btn-invisible"> -{{$:/core/images/folder}} <$text text=<<__chunk__>>/> +{{$:/core/images/folder}} <$text text=<<__chunk__>>/> + (<$count filter="[all[shadows+tiddlers]removeprefix<__prefix__>removeprefix<__chunk__>] -[<__prefix__>addsuffix<__chunk__>]"/>) <$reveal type="match" stateTitle=<> 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
      <$list filter="[all[shadows+tiddlers]removeprefix<__prefix__>splitbefore<__separator__>sort[]!suffix<__separator__>]" variable="chunk"> <$macrocall $name="leaf-node" prefix=<<__prefix__>> chunk=<> separator=<<__separator__>>/> @@ -48,6 +52,7 @@ tags: $:/tags/Macro \end \define tree(prefix: "$:/",separator: "/") +\whitespace trim
      <$text text=<<__prefix__>>/>
      diff --git a/editions/test/tiddlers/tests/data/tabs-macro/expected-html-tabs-horizontal-all.tid b/editions/test/tiddlers/tests/data/tabs-macro/expected-html-tabs-horizontal-all.tid index 6cd40a30a..152e2136e 100644 --- a/editions/test/tiddlers/tests/data/tabs-macro/expected-html-tabs-horizontal-all.tid +++ b/editions/test/tiddlers/tests/data/tabs-macro/expected-html-tabs-horizontal-all.tid @@ -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 -

      - -

      -
      - -
      -
      -
      -

      TabTwo

      Text tab 2

      -
      -
      - -

      \ No newline at end of file +

      TabTwo

      Text tab 2

      \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/tabs-macro/expected-html-tabs-horizontal.tid b/editions/test/tiddlers/tests/data/tabs-macro/expected-html-tabs-horizontal.tid index b64ce9941..e7bdee0dd 100644 --- a/editions/test/tiddlers/tests/data/tabs-macro/expected-html-tabs-horizontal.tid +++ b/editions/test/tiddlers/tests/data/tabs-macro/expected-html-tabs-horizontal.tid @@ -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 -

      - -

      -
      - -
      -
      -
      -

      Text tab 2

      -
      -
      - -

      \ No newline at end of file +

      Text tab 2

      \ No newline at end of file diff --git a/editions/test/tiddlers/tests/data/tabs-macro/expected-html-tabs-vertical.tid b/editions/test/tiddlers/tests/data/tabs-macro/expected-html-tabs-vertical.tid index e352f4ef0..940082a51 100644 --- a/editions/test/tiddlers/tests/data/tabs-macro/expected-html-tabs-vertical.tid +++ b/editions/test/tiddlers/tests/data/tabs-macro/expected-html-tabs-vertical.tid @@ -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 -

      - -

      -
      - -
      -
      -
      -

      Text tab 2

      -
      -
      - -

      \ No newline at end of file +

      Text tab 2

      \ No newline at end of file