mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-27 01:14:44 +00:00
Merge branch 'master' of https://github.com/jermolene/TiddlyWiki5
This commit is contained in:
commit
8e54a4577c
@ -14,6 +14,7 @@ Listing/Preview/Fields: Fields
|
||||
Listing/Preview/Diff: Diff
|
||||
Listing/Preview/DiffFields: Diff (Fields)
|
||||
Listing/Rename/Tooltip: Rename tiddler before importing
|
||||
Listing/Rename/Prompt: Rename to:
|
||||
Listing/Rename/ConfirmRename : Rename tiddler
|
||||
Listing/Rename/CancelRename : Cancel
|
||||
Upgrader/Plugins/Suppressed/Incompatible: Blocked incompatible or obsolete plugin
|
||||
|
@ -2,6 +2,6 @@ title: $:/core/save/all-external-js
|
||||
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/core]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||
\end
|
||||
{{$:/core/templates/tiddlywiki5-external-js.html}}
|
||||
|
@ -2,6 +2,6 @@ title: $:/core/save/all
|
||||
|
||||
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
|
||||
\define saveTiddlerFilter()
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||
[is[tiddler]] -[prefix[$:/state/popup/]] -[prefix[$:/temp/]] -[prefix[$:/HistoryList]] -[status[pending]plugin-type[import]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
|
||||
\end
|
||||
{{$:/core/templates/tiddlywiki5.html}}
|
||||
|
@ -11,7 +11,7 @@ first-search-filter: [all[shadows]search<userInput>sort[title]limit[250]] -[[$:/
|
||||
|
||||
\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/>
|
||||
|
||||
\define input-accept-variant-actions() <$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>
|
||||
\define input-accept-variant-actions() <$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/></$list>
|
||||
|
||||
<<lingo Shadows/Hint>>
|
||||
|
||||
|
@ -11,7 +11,7 @@ caption: {{$:/language/Search/Standard/Caption}}
|
||||
|
||||
\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/>
|
||||
|
||||
\define input-accept-variant-actions() <$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>
|
||||
\define input-accept-variant-actions() <$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/></$list>
|
||||
|
||||
<<lingo Standard/Hint>>
|
||||
|
||||
|
@ -10,7 +10,7 @@ first-search-filter: [is[system]search<userInput>sort[title]limit[250]] -[[$:/te
|
||||
|
||||
\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/>
|
||||
|
||||
\define input-accept-variant-actions() <$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>
|
||||
\define input-accept-variant-actions() <$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/></$list>
|
||||
|
||||
<<lingo System/Hint>>
|
||||
|
||||
|
@ -21,7 +21,7 @@ $(currentTiddler)$!!popup-$(payloadTiddler)$
|
||||
\end
|
||||
|
||||
\define renameFieldState()
|
||||
$:/state/import-rename-$(payloadTiddler)$
|
||||
$(currentTiddler)$!!state-rename-$(payloadTiddler)$
|
||||
\end
|
||||
|
||||
\define select-all-actions()
|
||||
@ -51,27 +51,34 @@ $:/state/import-rename-$(payloadTiddler)$
|
||||
<$checkbox field=<<selectionField>> checked="checked" unchecked="unchecked" default="checked"/>
|
||||
</td>
|
||||
<td>
|
||||
<$reveal type="nomatch" stateTitle=<<renameFieldState>> text="yes" tag="div">
|
||||
<$reveal type="nomatch" state=<<previewPopupState>> text="yes" tag="div">
|
||||
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<previewPopupState>> setTo="yes">
|
||||
{{$:/core/images/right-arrow}}<span class="tc-small-gap-left"><$text text={{{[<currentTiddler>get<renameField>minlength[1]else<payloadTiddler>]}}}/></span>
|
||||
<$reveal type="nomatch" state=<<renameFieldState>> text="yes" tag="div">
|
||||
<$reveal type="nomatch" state=<<previewPopupState>> text="yes" tag="div" class="tc-flex">
|
||||
<$button class="tc-btn-invisible tc-btn-dropdown tc-flex-grow-1" set=<<previewPopupState>> setTo="yes">
|
||||
<span class="tc-small-gap-right">{{$:/core/images/right-arrow}}</span><$text text={{{[<currentTiddler>get<renameField>minlength[1]else<payloadTiddler>]}}}/>
|
||||
</$button>
|
||||
<$button class="tc-btn-invisible" setTitle=<<renameFieldState>> setTo="yes" tooltip={{{[<lingo-base>addsuffix[Listing/Rename/Tooltip]get[text]]}}}>{{$:/core/images/edit-button}}</$button>
|
||||
<$button class="tc-btn-invisible tc-small-gap-left" set=<<renameFieldState>> setTo="yes" tooltip={{{[<lingo-base>addsuffix[Listing/Rename/Tooltip]get[text]]}}}>{{$:/core/images/edit-button}}</$button>
|
||||
</$reveal>
|
||||
<$reveal type="match" state=<<previewPopupState>> text="yes" tag="div">
|
||||
<$button class="tc-btn-invisible tc-btn-dropdown" set=<<previewPopupState>> setTo="no">
|
||||
{{$:/core/images/down-arrow}}<span class="tc-small-gap-left"><$text text=<<payloadTiddler>>/></span>
|
||||
<span class="tc-small-gap-right">{{$:/core/images/down-arrow}}</span><$text text={{{[<currentTiddler>get<renameField>minlength[1]else<payloadTiddler>]}}}/>
|
||||
</$button>
|
||||
</$reveal>
|
||||
</$reveal>
|
||||
<$reveal type="match" stateTitle=<<renameFieldState>> text="yes" tag="div">
|
||||
<$edit-text tiddler=<<newImportTitleTiddler>> default=<<payloadTiddler>> tag="input" class="tc-import-rename"/><$button class="tc-btn-invisible" setTitle=<<renameFieldState>> setTo="no" tooltip={{{[<lingo-base>addsuffix[Listing/Rename/CancelRename]get[text]]}}}>{{$:/core/images/close-button}}<$action-deletetiddler $tiddler=<<newImportTitleTiddler>>/></$button> <$button class="tc-btn-invisible" setTitle=<<renameFieldState>> setTo="no" tooltip={{{[<lingo-base>addsuffix[Listing/Rename/ConfirmRename]get[text]]}}}>{{$:/core/images/done-button}}<$action-setfield $field=<<renameField>> $value={{{[<newImportTitleTiddler>get[text]minlength[1]else<payloadTiddler>]}}} /><$action-deletetiddler $tiddler=<<newImportTitleTiddler>>/></$button>
|
||||
<$reveal type="match" state=<<renameFieldState>> text="yes" tag="div">
|
||||
<$text text={{{[<lingo-base>addsuffix[Listing/Rename/Prompt]get[text]]}}}/>
|
||||
</$reveal>
|
||||
</td>
|
||||
<td>
|
||||
<$view field=<<messageField>>/>
|
||||
</td>
|
||||
</tr>
|
||||
<$reveal type="match" state=<<renameFieldState>> text="yes" tag="tr">
|
||||
<td colspan="3">
|
||||
<div class="tc-flex">
|
||||
<$edit-text tiddler=<<newImportTitleTiddler>> default={{{[<currentTiddler>get<renameField>minlength[1]else<payloadTiddler>]}}} tag="input" class="tc-import-rename tc-flex-grow-1"/><span class="tc-small-gap-left"><$button class="tc-btn-invisible" set=<<renameFieldState>> setTo="no" tooltip={{{[<lingo-base>addsuffix[Listing/Rename/CancelRename]get[text]]}}}>{{$:/core/images/close-button}}<$action-deletetiddler $tiddler=<<newImportTitleTiddler>>/></$button><span class="tc-small-gap-right"/></span><$button class="tc-btn-invisible" set=<<renameFieldState>> setTo="no" tooltip={{{[<lingo-base>addsuffix[Listing/Rename/ConfirmRename]get[text]]}}}>{{$:/core/images/done-button}}<$action-setfield $field=<<renameField>> $value={{{[<newImportTitleTiddler>get[text]minlength[1]else<payloadTiddler>]}}} /><$action-deletetiddler $tiddler=<<newImportTitleTiddler>>/></$button>
|
||||
</div>
|
||||
</td>
|
||||
</$reveal>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<$reveal type="match" text="yes" state=<<previewPopupState>> tag="div">
|
||||
@ -84,3 +91,4 @@ $:/state/import-rename-$(payloadTiddler)$
|
||||
</$list>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
@ -38,7 +38,7 @@ tags: $:/tags/SideBarSegment
|
||||
|
||||
\define input-accept-actions() <$action-navigate $to={{{ [<__tiddler__>get[text]] }}}/>
|
||||
|
||||
\define input-accept-variant-actions() <$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/>
|
||||
\define input-accept-variant-actions() <$list filter="[<__tiddler__>get[text]minlength[1]]"><$action-sendmessage $message="tm-edit-tiddler" $param={{{ [<__tiddler__>get[text]] }}}/></$list>
|
||||
|
||||
\define set-next-input-tab(beforeafter:"after") <$macrocall $name="change-input-tab" stateTitle="$:/state/tab/search-results/sidebar" tag="$:/tags/SearchResults" beforeafter="$beforeafter$" defaultState={{$:/config/SearchResults/Default}} actions="""<$action-setfield $tiddler="$:/state/search/currentTab" text=<<nextTab>>/>"""/>
|
||||
|
||||
|
@ -2,7 +2,7 @@ title: $:/config/shortcuts/
|
||||
|
||||
add-field: enter
|
||||
advanced-search: ctrl-shift-A
|
||||
advanced-search-sidebar: ctrl-Enter
|
||||
advanced-search-sidebar: alt-Enter
|
||||
cancel-edit-tiddler: escape
|
||||
excise: ctrl-E
|
||||
sidebar-search: ctrl-shift-F
|
||||
@ -13,7 +13,7 @@ heading-4: ctrl-4
|
||||
heading-5: ctrl-5
|
||||
heading-6: ctrl-6
|
||||
input-accept: Enter
|
||||
input-accept-variant: Alt-Enter
|
||||
input-accept-variant: ctrl-Enter
|
||||
input-cancel: Escape
|
||||
input-down: Down
|
||||
input-tab-left: alt-Left
|
||||
|
@ -6,14 +6,19 @@ type: text/vnd.tiddlywiki
|
||||
|
||||
\define add-price() [get[price]multiply{!!quantity}add<accumulator>]
|
||||
\define num-items() [get[quantity]add<accumulator>]
|
||||
\define join-with-commas() [<index>compare:number:gt[0]then<accumulator>addsuffix[, ]addsuffix<currentTiddler>else<currentTiddler>]
|
||||
\define display-variable(name)
|
||||
''<$text text=<<__name__>>/>'': <code><$text text={{{ [<__name__>getvariable[]] }}}/></code>
|
||||
\end
|
||||
\define reduce-tip()
|
||||
Remember that <<.op reduce>> always produces output, so <<.op else>> will never trigger after <<.op reduce>>.
|
||||
\end
|
||||
|
||||
These examples use the following predefined variables:
|
||||
|
||||
* <<display-variable add-price>>
|
||||
* <<display-variable num-items>>
|
||||
* <<display-variable join-with-commas>>
|
||||
|
||||
They also use the following data tiddlers:
|
||||
|
||||
@ -32,3 +37,25 @@ Number of items:
|
||||
Total price:
|
||||
|
||||
<<.operator-example 2 "[tag[shopping]reduce<add-price>]">>
|
||||
|
||||
Using `<index>` to act differently on the first item than the rest:
|
||||
|
||||
<<.operator-example 3 "[tag[shopping]reduce<join-with-commas>]">>
|
||||
|
||||
Empty input, no suffix:
|
||||
|
||||
<<.operator-example 4 "[tag[non-existent]reduce<add-price>]">>
|
||||
|
||||
Note how the output contains a single item with no text. This is not "empty output" for the purposes of the <<.op else>> operator.
|
||||
|
||||
<$macrocall $name=".tip" _=<<reduce-tip>> />
|
||||
|
||||
Empty input, no suffix, followed by <<.op else>>:
|
||||
|
||||
<<.operator-example 5 "[tag[non-existent]reduce<add-price>else[0]]">>
|
||||
|
||||
Note how the output still contains a single item with no text: <<.op else>> did not trigger. If you want the value to be 0 when <<.op reduce>> has no items to process, you need to specify 0 as the initial value by passing it as a suffix to <<.op reduce>>.
|
||||
|
||||
Empty input, suffix provided:
|
||||
|
||||
<<.operator-example 6 "[tag[non-existent]reduce:0<add-price>]">>
|
||||
|
@ -12,6 +12,10 @@ tags: [[Filter Operators]]
|
||||
title: reduce Operator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
\define reduce-tip()
|
||||
The <<.op reduce>> operator will always produce output, even if its input was empty. If its input is empty, the output of <<.op reduce>> will be the initial value of the accumulator, i.e. the value of the suffix. One result of this fact is that the <<.op else>> operator will never be triggered if it follows a <<.op reduce>>. The "Empty input" examples show what happens when <<.op reduce>> receives no input.
|
||||
\end
|
||||
|
||||
<<.from-version "5.1.23">> The <<.op reduce>> operator runs a subfilter for each input title, passing the result of the previous subfilter run as a variable. The initial value of the accumulator can optionally be specified. It returns the result of the final subfilter run.
|
||||
|
||||
The <<.op reduce>> operator is used to flatten a list of items down to a single item by repeatedly applying a formula. A typical use is to add up the values in a given field of a list of tiddlers.
|
||||
@ -24,4 +28,6 @@ The following variables are available within the subfilter:
|
||||
* ''revIndex'' - the reverse numeric index of the current list item (with zero being the last item in the list)
|
||||
* ''length'' - the total length of the input list
|
||||
|
||||
<$macrocall $name=".tip" _=<<reduce-tip>> />
|
||||
|
||||
<<.operator-examples "reduce">>
|
||||
|
@ -13,6 +13,9 @@ Listing/Preview/TextRaw: 文本 (原始)
|
||||
Listing/Preview/Fields: 字段
|
||||
Listing/Preview/Diff: 差异
|
||||
Listing/Preview/DiffFields: 差异 (字段)
|
||||
Listing/Rename/Tooltip: 导入前重新命名条目
|
||||
Listing/Rename/ConfirmRename : 重新命名条目
|
||||
Listing/Rename/CancelRename : 取消
|
||||
Upgrader/Plugins/Suppressed/Incompatible: 封锁的不兼容或过时插件
|
||||
Upgrader/Plugins/Suppressed/Version: 封锁的插件 (由于传入的 <<incoming>> 较现有版本 <<existing>> 旧)
|
||||
Upgrader/Plugins/Upgraded: 升级插件,从 <<incoming>> 到 <<upgraded>>
|
||||
|
@ -13,6 +13,9 @@ Listing/Preview/TextRaw: 文字 (原始)
|
||||
Listing/Preview/Fields: 欄位
|
||||
Listing/Preview/Diff: 差異
|
||||
Listing/Preview/DiffFields: 差異 (欄位)
|
||||
Listing/Rename/Tooltip: 導入前重新命名條目
|
||||
Listing/Rename/ConfirmRename : 重新命名條目
|
||||
Listing/Rename/CancelRename : 取消
|
||||
Upgrader/Plugins/Suppressed/Incompatible: 封鎖的不相容或過時插件
|
||||
Upgrader/Plugins/Suppressed/Version: 封鎖的插件 (由於傳入的 <<incoming>> 較現有版本 <<existing>> 舊)
|
||||
Upgrader/Plugins/Upgraded: 升級插件,從 <<incoming>> 到 <<upgraded>>
|
||||
|
@ -2032,11 +2032,6 @@ html body.tc-body.tc-single-tiddler-window {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
input.tc-import-rename {
|
||||
width: 85%;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
/*
|
||||
** Alerts
|
||||
*/
|
||||
@ -2775,6 +2770,31 @@ select {
|
||||
fill: <<colour background>>;
|
||||
}
|
||||
|
||||
/*
|
||||
** Flexbox utility classes
|
||||
*/
|
||||
|
||||
.tc-flex {
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.tc-flex-column {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.tc-flex-row {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.tc-flex-grow-1 {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.tc-flex-grow-2 {
|
||||
flex-grow: 2;
|
||||
}
|
||||
|
||||
/*
|
||||
** Other utility classes
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user