[Manual] Add scripts and raw wiki

This commit is contained in:
octospacc 2023-02-28 12:07:24 +01:00
parent d29725b74a
commit 5320dc75f0
1482 changed files with 27397 additions and 3932 deletions

View File

@ -1,30 +0,0 @@
name: OcttKB
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
page_build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: |
sudo apt update
sudo apt install -y git wget npm python3 python3-pip
sudo npm install -g tiddlywiki
sudo pip3 install beautifulsoup4 html5lib
bash ./Bootstrap.sh
sh ./GitHub.Main.sh
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: public

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
public/Static.html
public/Style.css

View File

@ -2,15 +2,10 @@ image: alpine:latest
before_script: |
apk update
apk add git wget npm python3 py3-pip
apk add git wget npm
npm install -g tiddlywiki
pip3 install beautifulsoup4 html5lib
pages:
stage: deploy
Sync:
stage: Sync
script: |
ash ./Bootstrap.sh
sh ./GitLab.Main.sh
artifacts:
paths:
- public

View File

@ -1,28 +0,0 @@
#!/bin/sh
# Export all tiddlers from the specific path of the HTML wiki
tiddlywiki \
--verbose \
--load ./public/index.html \
--output ./Output.tmp \
--save "[prefix[$:/OcttKB/Repo/]]"
# Move the exported folder to a better location
mv ./Output.tmp/\$_/OcttKB/Repo ./Repo.tmp
# Rename all extracted scripts to have a correct extension (remove .txt suffix)
cd ./Repo.tmp
for File in *.sh.txt
do
mv "$File" "${File/.txt}"
done
cd ..
# Move the files of this repo to overwrite the extracted ones, then move everything back
# This is so, if present, files from the repo are preferred, if needed in case of emergency
mv ./Repo/* ./Repo.tmp/
mv ./Repo.tmp/* ./Repo/
# Move everything to the working directory, ready for the next steps
mv ./Repo/* ./
chmod +x *.sh

View File

@ -1,13 +1,13 @@
#!/bin/sh
TargetRepo="OcttKB.Raw"
git clone --depth 1 https://gitlab.com/octtspacc/$TargetRepo ./$TargetRepo
cd ./$TargetRepo
rm -rf ./Wiki
TargetRepo="OcttKB"
cd ./Wiki
tiddlywiki \
--verbose \
--load ../public/index.html \
--output ./Wiki \
--savewikifolder ./Wiki
--output ./Output.tmp \
--rendertiddler "$:/core/save/all" "index.html" "text/plain"
git clone --depth 1 https://gitlab.com/octtspacc/$TargetRepo ./$TargetRepo
cd ./$TargetRepo
cp -r ../Output.tmp/index.html ./public/index.html
git add .
git commit -m "OcttKB Cross-Repo Sync (HTML to Raw)"
git commit -m "OcttKB Cross-Repo Sync (Raw to HTML)"
git push

5
GitLab.Main.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
sh ./SetupGitProfile.sh
CommitCheck="$(git log -1 --pretty=%B)"
CommitMsg0="OcttKB Cross-Repo Sync"
[ "$CommitCheck" != "$CommitMsg0 (HTML to Raw)" ] && [ "$CommitCheck" != "$CommitMsg0 (Raw to HTML)" ] && sh ./GitLab.CrossRepoSync.sh

5
SetupGitProfile.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
git config --global user.email "$GitUserEmail"
git config --global user.name "$GitUserName"
git config --global credential.helper store
echo "https://$GitUserName:$GitPassword@gitlab.com" > ~/.git-credentials

View File

@ -0,0 +1,40 @@
caption: <$list filter="[[$:/language]get[text]removeprefix[$:/languages/]else[en-GB]]" variable="lang"><$list filter="[<lang>search:title[zh]]">太微中文社区插件源(~GitHub版)</$list><$list filter="[<lang>!search:title[zh]]">TiddlyWiki CPL(~GitHub Host)</$list></$list>
tags: $:/tags/PluginLibrary $:/tags/PluginLibrary/CPL
title: $:/config/TiddlyWiki-CPL/GitHub
type: text/vnd.tiddlywiki
url: https://tiddly-gittly.github.io/TiddlyWiki-CPL/library/index.html
<!-- lang变量就是当前语言 -->
<$list filter="[[$:/language]get[text]removeprefix[$:/languages/]else[en-GB]]" variable="lang">
<$list filter="[<lang>search:title[zh]]" variable="lang">
欢迎使用''【太微中文社区插件源】''
本插件源是由[[太微(TiddlyWiki)中文社区|https://github.com/tiddly-gittly]]维护的、致力于搜集网络上所有与 ~TiddlyWiki5 有关插件的、希望为中国以及全世界的太微用户提供一键安装、更新插件体验的公开插件源。
如果还不了解该如何使用太微和本插件源,欢迎阅读[[中文社区共建的太微TiddlyWiki教程|https://tw-cn.netlify.app]]里插件相关的部分。如上提到的插件源和教程皆为开源项目,你可以在 [[GitHub|https://github.com/tiddly-gittly]] 中找到并参与贡献如果乐意可以通过QQ群等方式加入我们详情请见如上提到的中文教程。
要添加这个插件库到你的 Wiki 中,只需鼠标拖动这个链接到你的 Wiki 里即可:<$link to=<<currentTiddler>>>{{!!caption}}</$link>
注意:本插件源版本为 ~GitHub Page 的版本,更新更快,但是可能需要科学上网手段。如果你在国内,而且不清楚什么是“科学上网”,请选用另一个经过 netlify.app 加速的[[版本|$:/config/TiddlyWiki-CPL/Netlify]],虽然更新有一定的延迟,但对国内用户更加友好。
@@color:red;''安装任何插件前请记得备份你的Wiki本插件源无法为插件造成的个人损失负责''@@
</$list>
<$list filter="[<lang>!search:title[zh]]" variable="lang">
Welcome to the ''[TiddlyWiki Chinese Community Plugin Source]''!
This plugin source is maintained by the [[TiddlyWiki Chinese Community]] and is dedicated to collecting all TiddlyWiki5 related plugins on the web, hoping to provide a one-click installation and update plugin experience for TiddlyWiki users in China and around the world.
If you don't know how to use TiddlyWiki and this source, you are welcome to read the plugins related section in the [[TiddlyWiki Tutorials for Chinese Communities|https://tw-cn.netlify.app]]. As mentioned above, both the plugin source and the tutorial are open source projects, you can find them in [[GitHub|https://github.com/tiddly-gittly]] and participate in contributing! If you like, you can join us through QQ groups and other means, see the Chinese tutorials mentioned above for details.
To add this plugin library to your Wiki, just drag this link with your mouse into your Wiki: <$link to=<<currentTiddler>>>{{!!caption}}</$link>
Note: The source version of this plugin is the ~GitHub Page version, which is faster to update, but may require scientific Internet access. If you are in China and are not sure what GFW is, please use another [[version|$:/config/TiddlyWiki-CPL/Netlify]] that is accelerated by netlify.app, although there is a certain delay in updating, but it is more friendly to domestic users more friendly.
@@color:red;''Please remember to back up your Wiki before installing any plugins, this plugin source cannot be held responsible for personal losses caused by plugins!''@@
</$list>
</$list>

View File

@ -0,0 +1,40 @@
caption: <$list filter="[[$:/language]get[text]removeprefix[$:/languages/]else[en-GB]]" variable="lang"><$list filter="[<lang>search:title[zh]]">太微中文社区插件源(大陆加速版)</$list><$list filter="[<lang>!search:title[zh]]">TiddlyWiki CPL(Netlify Host)</$list></$list>
tags: $:/tags/PluginLibrary $:/tags/PluginLibrary/CPL
title: $:/config/TiddlyWiki-CPL/Netlify
type: text/vnd.tiddlywiki
url: https://tw-cpl.netlify.app/library/index.html
<!-- lang变量就是当前语言 -->
<$list filter="[[$:/language]get[text]removeprefix[$:/languages/]else[en-GB]]" variable="lang">
<$list filter="[<lang>search:title[zh]]" variable="lang">
欢迎使用''【太微中文社区插件源】''
本插件源是由[[太微(TiddlyWiki)中文社区|https://github.com/tiddly-gittly]]维护的、致力于搜集网络上所有与 ~TiddlyWiki5 有关插件的、希望为中国以及全世界的太微用户提供一键安装、更新插件体验的公开插件源。
如果还不了解该如何使用太微和本插件源,欢迎阅读[[中文社区共建的太微TiddlyWiki教程|https://tw-cn.netlify.app]]里插件相关的部分。如上提到的插件源和教程皆为开源项目,你可以在 [[GitHub|https://github.com/tiddly-gittly]] 中找到并参与贡献如果乐意可以通过QQ群等方式加入我们详情请见如上提到的中文教程。
要添加这个插件库到你的 Wiki 中,只需鼠标拖动这个链接到你的 Wiki 里即可:<$link to=<<currentTiddler>>>{{!!caption}}</$link>
注意:本插件源版本为经过 netlify.app 加速的版本,对国内用户更加友好,但是更新有一定的延迟。还提供另一版本,是直接使用 ~GitHub Page 服务器的版本,更新更快,但是可能需要科学上网手段。
@@color:red;''安装任何插件前请记得备份你的Wiki本插件源无法为插件造成的个人损失负责''@@
</$list>
<$list filter="[<lang>!search:title[zh]]" variable="lang">
Welcome to the ''[TiddlyWiki Chinese Community Plugin Source]''!
This plugin source is maintained by the [[TiddlyWiki Chinese Community]] and is dedicated to collecting all TiddlyWiki5 related plugins on the web, hoping to provide a one-click installation and update plugin experience for TiddlyWiki users in China and around the world.
If you don't know how to use TiddlyWiki and this source, you are welcome to read the plugins related section in the [[TiddlyWiki Tutorials for Chinese Communities|https://tw-cn.netlify.app]]. As mentioned above, both the plugin source and the tutorial are open source projects, you can find them in [[GitHub|https://github.com/tiddly-gittly]] and participate in contributing! If you like, you can join us through QQ groups and other means, see the Chinese tutorials mentioned above for details.
To add this plugin library to your Wiki, just drag this link with your mouse into your Wiki: <$link to=<<currentTiddler>>>{{!!caption}}</$link>
Note: The source version of this plugin is a version accelerated by netlify.app, which is more friendly to China mainland users, but there is a delay in updating. There is also another version that uses the GitHub Page server directly, which is faster to update, but may require technology to overturn the GFW.
@@color:red;''Please remember to back up your Wiki before installing any plugins, this plugin source cannot be held responsible for personal losses caused by plugins!''@@
</$list>
</$list>

View File

@ -0,0 +1,10 @@
{
"author": "Gk0Wk",
"description": "Repos for CPL",
"name": "CPL Repo",
"plugin-type": "plugin",
"title": "$:/plugins/Gk0Wk/CPL-Repo",
"version": "2022.12.28",
"revision": "0",
"bag": "default"
}

View File

@ -0,0 +1,10 @@
/*\
title: $:/plugins/tobibeer/base64/filter.js
type: application/javascript
module-type: filteroperator
A filter to encode and decode base64
@preserve
\*/
(function(){"use strict";exports.base64=function(e,r,t){var n="",o=r.suffix=="decode";try{if(r.operand){n=r.operand}else{e(function(e,r){n+=r})}n=o?atob(n):btoa(n)}catch(i){return["Error in base64 filter trying to "+(o?"de":"en")+"code'"+n+"':\n"+i]}return[n]}})();

View File

@ -0,0 +1,3 @@
module-type: filteroperator
title: $:/plugins/tobibeer/base64/filter.js
type: application/javascript

View File

@ -0,0 +1,14 @@
title: $:/plugins/tobibeer/base64/readme
The plugin $:/plugins/tobibeer/base64 provides:
; base64[]
: a filter to encode text to base64
; base64:decode[]
: and dencode base64 to text
<br>
; documentation / examples / demos...
: http://tobibeer.github.io/tw5-plugins#base64

View File

@ -0,0 +1,13 @@
{
"title": "$:/plugins/tobibeer/base64",
"description": "base64 encoding and decoding for ~TiddlyWiki",
"author": "Tobias Beer",
"version": "0.5.0",
"core-version": ">=5.1.9",
"source": "https://github.com/tobibeer/tw5-base64",
"documentation": "https://tobibeer.github.io/tw5-base64",
"plugin-type": "plugin",
"requires": "",
"list": "readme",
"dependents": ""
}

View File

@ -0,0 +1,26 @@
icon: $:/plugins/kookma/commander/images/commander.svg
title: $:/Commander
type: text/vnd.tiddlywiki
\import [all[shadows+tiddlers]tag[$:/tags/Commander/Macro]]
{{$:/plugins/kookma/commander/search/ui}}
<!-- Create the search filter based on searchbox and selective operation (if active) -->
<$vars searchTerms={{{ [<searchboxTid>get[text]minlength{$:/plugins/kookma/commander/config/minlength}]~[[$:/errorCode:-23500]] }}} pattern="^\["><!-- this part checks the combo search and selective ops-->
<$set name="filtertext" filter="[<searchTerms>regexp<pattern>]" value="[subfilter<searchTerms>]" emptyValue="[!is[system]search<searchTerms>]">
<$set name="searchfilter" filter="[<selectiveOpsTid>get[text]match[yes]]"
value="[subfilter<filtertext>!prefix[$:/temp/commander]]+[tag<workingTag>]" emptyValue="[subfilter<filtertext>!prefix[$:/temp/commander]]" >
<small style="margin-left:17ch;"><i><$count filter="[subfilter<filtertext>!prefix[$:/temp/commander]!is[missing]]" /> matches </i></small>
<!-- Display search results and let selective operation -->
<<commander-slider title:"$:/plugins/kookma/commander/search/selection" default:"open">>
<!-- Display operation UIs-->
<<tabs "[all[shadows+tiddlers]tag[$:/tags/Commander]!has[draft.of]]" default:"$:/plugins/kookma/commander/tiddler/ui">>
</$set>
</$set>
<$vars>
---
<<commander-slider title:"$:/plugins/kookma/commander/log/ui">>

View File

@ -0,0 +1,5 @@
tags:
title: $:/language/Buttons/Commander/Caption
type: text/vnd.tiddlywiki
commander

View File

@ -0,0 +1,5 @@
tags:
title: $:/language/Buttons/Commander/Hint
type: text/vnd.tiddlywiki
Tiddler Commander

View File

@ -0,0 +1,22 @@
caption: {{$:/plugins/kookma/commander/images/file-alt}} {{$:/language/Buttons/Commander/Caption}}
description: Open tiddler commander
list-after: $:/core/ui/Buttons/advanced-search
tags: $:/tags/PageControls
title: $:/plugins/kookma/commander/buttons/pagecontrol
type: text/vnd.tiddlywiki
\whitespace trim
\define commander-button(class)
<$button to="$:/Commander" tooltip={{$:/language/Buttons/Commander/Hint}} aria-label={{$:/language/Buttons/Commander/Caption}} class="""$(tv-config-toolbar-class)$ $class$""">
<$list filter="[<tv-config-toolbar-icons>match[yes]]">
{{$:/plugins/kookma/commander/images/commander.svg}}
</$list>
<$list filter="[<tv-config-toolbar-text>match[yes]]">
<span class="tc-btn-text"><$text text={{$:/language/Buttons/Commander/Caption}}/></span>
</$list>
</$button>
\end
<$list filter="[list[$:/StoryList]] +[field:title[$:/Commander]]" emptyMessage=<<commander-button>>>
<<commander-button "tc-selected">>
</$list>

View File

@ -0,0 +1,5 @@
tags:
title: $:/plugins/kookma/commander/config/AutoFocus
type: text/vnd.tiddlywiki
yes

View File

@ -0,0 +1,5 @@
tags:
title: $:/plugins/kookma/commander/config/commonfields
type: text/vnd.tiddlywiki
created creator modified modifier revision bag

View File

@ -0,0 +1,5 @@
tags:
title: $:/plugins/kookma/commander/config/minlength
type: text/vnd.tiddlywiki
3

View File

@ -0,0 +1,10 @@
tags:
title: $:/plugins/kookma/commander/config/relink
type: text/vnd.tiddlywiki
\define relink-plugin-notExisted() Update title in //tags// and //list// fields of other tiddlers
<$checkbox tiddler="$:/config/RelinkOnRename" field="text" checked="yes" unchecked="no" default="no">
<$list filter="[[$:/plugins/flibbles/relink]] +[has[title]]" emptyMessage=<<relink-plugin-notExisted>> >
Use //Relink// to update title across all other tiddlers
</$list>
</$checkbox>

View File

@ -0,0 +1,8 @@
tags:
title: $:/plugins/kookma/commander/config/systemfields
type: text/vnd.tiddlywiki
title text tags
created modified craetor modifier
type bag revision
list caption

View File

@ -0,0 +1,23 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/field/macros/add
type: text/vnd.tiddlywiki
\define add-new-field-bulk(datafieldsTid:"")
<$list filter="[subfilter<searchfilter>!is[missing]limit[1]]" variable=ignore><!--check if filter is empty -->
<<create-log-tiddler "add-new-field-bulk">>
<$vars datafieldsTid=<<__datafieldsTid__>> >
<$list filter="[subfilter<searchfilter>]" variable="newTitle">
<<add-bulk-fields>>
<$wikify name=newFields text=<<getFieldsname>> >
<$macrocall $name="log-add-single-operation" msg={{{[<newFields>addprefix[new fields:]addsuffix[added]]}}} tidItem=<<newTitle>> />
</$wikify>
</$list>
</$vars>
</$list>
\end
<!-- from TiddlyWiki 5.2.0, field name with mixed case is allowed -->
\define getFieldsname()
<$list filter="[<__datafieldsTid__>indexes[]prefix[fldn]]" variable=item>
{{{ [<__datafieldsTid__>getindex<item>trim[]] }}}
</$list>
\end

View File

@ -0,0 +1,69 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/field/macros/bulkfields
type: text/vnd.tiddlywiki
\define numfilter() [range[1,$(flt)$]]
\define id_fldName() fldn$(cnt)$
\define id_fldValue() fldv$(cnt)$
<!-- from TiddlyWiki 5.2.0, field name with mixed case is allowed -->
\define add-bulk-fields()
<$set name="flt" tiddler=<<datafieldsTid>> field="counter" emptyValue="1"><!-- when the datafieldsTid is not exist, there is at least one field row -->
<$list filter=<<numfilter>> variable="cnt">
<$list filter="[<datafieldsTid>getindex<id_fldName>]" variable="newField">
<$action-setfield $tiddler=<<newTitle>>
$field={{{ [<newField>trim[]] }}}
$value={{{ [<datafieldsTid>getindex<id_fldValue>] }}} />
</$list>
</$list>
</$set>
\end
\define getInputs()
<$edit-text tiddler=<<datafieldsTid>> index=<<id_fldName>> tag=input default="" placeholder="field name" />
<$edit-text tiddler=<<datafieldsTid>> index=<<id_fldValue>> tag=input default="" placeholder="field value"/>
\end
\define add-reset()
<$button>insert
<$action-setfield $tiddler=<<datafieldsTid>> counter={{{[<datafieldsTid>get[counter]add[1]]~[[2]]}}}/>
</$button>
<$button>reset
<$action-setfield $tiddler=<<datafieldsTid>> counter="1"/>
<$action-setfield $tiddler=<<datafieldsTid>> text=""/>
</$button>
\end
\define create-field-inputbox()
<$wikify name=flt text={{{ [<datafieldsTid>get[counter]]~[[1]] }}} >
<$list filter=<<numfilter>> variable=cnt>
<<getInputs>>
</$list>
</$wikify>
\end
\define add-more-fields-ui(datafieldsTid:"")
<$vars datafieldsTid=<<__datafieldsTid__>> >
<<add-reset>>
<<create-field-inputbox>>
</$vars>
\end
\define add-more-fields-selective-ui(datafieldsTid:"", stateTiddler:"$:/state/commander/tiddler-addfields-status")
<$checkbox
tiddler=<<__stateTiddler__>>
field="text"
checked="addfields" unchecked="nofields"
default="nofields" >
Add fields
</$checkbox>
<$reveal type="match" state=<<__stateTiddler__>> text="addfields" default="nofields" >
<$vars datafieldsTid=<<__datafieldsTid__>> >
<<add-reset>>
<div style="padding-left:88px;">
<<create-field-inputbox>>
</div>
</$vars>
</$reveal>
\end

View File

@ -0,0 +1,35 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/field/macros/remove
type: text/vnd.tiddlywiki
\define remove-old-field-bulk(oldField:"")
<$list filter="[subfilter<searchfilter>!is[missing]limit[1]]" variable=ignore><!--check if filter is empty -->
<$list filter="[<__oldField__>!is[blank]]">
<<create-log-tiddler "remove-old-field-bulk">>
<$list filter="[subfilter<searchfilter>]+[!is[missing]]+[has:field[$oldField$]]">
<$fieldmangler>
<$action-sendmessage $message="tm-remove-field" $param=<<__oldField__>> />
</$fieldmangler>
<$macrocall $name="log-add-single-operation" msg="""old field `$oldField$` removed""" tidItem=<<currentTiddler>> />
</$list>
</$list>
</$list>
\end
\define set-field-value-bulk(fieldName:"Empty", fieldValue:"Empty")
<$list filter="[subfilter<searchfilter>!is[missing]limit[1]]" variable=ignore><!--check if filter is empty -->
<$list filter="[<__fieldName__>!is[blank]]" variable=null>
<$list filter="[<__fieldValue__>!is[blank]]" variable=null>
<<create-log-tiddler "set-field-value-create-bulk">>
<$list filter="[subfilter<searchfilter>]-[$fieldName$[$fieldValue$]]">
<$list filter="[<currentTiddler>has:field[$fieldName$]]" variable=ignore
emptyMessage="""<$macrocall $name="log-add-single-operation" msg="//has not `$fieldName$` field. Operation ignored//" tidItem=<<currentTiddler>> />""" >
<$action-setfield $field=<<__fieldName__>> $value=<<__fieldValue__>> />
<$macrocall $name="log-add-single-operation" msg="""field `$fieldName$` got a value""" tidItem=<<currentTiddler>> />
</$list>
</$list>
</$list>
</$list>
</$list>
\end

View File

@ -0,0 +1,23 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/field/macros/rename
type: text/vnd.tiddlywiki
\define rename-field-bulk(oldField:"", newField:"")
<$list filter="[subfilter<searchfilter>!is[missing]limit[1]]" variable=ignore>
<$list filter="[<__oldField__>!is[blank]]" variable=null>
<$list filter="[<__newField__>!is[blank]]" variable=null>
<<create-log-tiddler "rename-field-bulk">>
<$list filter="[subfilter<searchfilter>]">
<$list filter="[<currentTiddler>has:field[$oldField$]]" variable=ignore
emptyMessage="""<$macrocall $name="log-add-single-operation" msg="//has not field `$oldField$`. Operation ignored.//" tidItem=<<currentTiddler>> /> """>
<$set name=oldValue tiddler=<<currentTiddler>> field=<<__oldField__>> >
<$action-setfield $tiddler=<<currentTiddler>> $field=<<__newField__>> $value=<<oldValue>>/>
</$set>
<$action-deletefield $tiddler=<<currentTiddler>> $field=<<__oldField__>> />
<$macrocall $name="log-add-single-operation" msg="""fied `$oldField$` renamed to `$newField$`""" tidItem=<<currentTiddler>> />
</$list>
</$list>
</$list>
</$list>
</$list>
\end

View File

@ -0,0 +1,21 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/field/macros/set
type: text/vnd.tiddlywiki
\define set-field-value-bulk(fieldName:"", fieldValue:"")
<$list filter="[subfilter<searchfilter>!is[missing]limit[1]]" variable=ignore><!--check if filter is empty -->
<$list filter="[<__fieldName__>!is[blank]]" variable=null>
<$list filter="[<__fieldValue__>!is[blank]]" variable=null>
<<create-log-tiddler "set-field-value-create-bulk">>
<$list filter="[subfilter<searchfilter>]-[$fieldName$[$fieldValue$]]">
<$list filter="[<currentTiddler>has:field[$fieldName$]]" variable=ignore
emptyMessage="""<$macrocall $name="log-add-single-operation" msg="//has not `$fieldName$` field. Operation ignored//" tidItem=<<currentTiddler>> />""" >
<$action-setfield $field=<<__fieldName__>> $value=<<__fieldValue__>> />
<$macrocall $name="log-add-single-operation" msg="""field `$fieldName$` got a value""" tidItem=<<currentTiddler>> />
</$list>
</$list>
</$list>
</$list>
</$list>
\end

View File

@ -0,0 +1,12 @@
caption: Field
list-after: $:/plugins/kookma/commander/tag/ui
tags: $:/tags/Commander
title: $:/plugins/kookma/commander/field/ui
type: text/vnd.tiddlywiki
<<tabs
tabsList:"[all[shadows+tiddlers]tag[$:/tags/Commander/FieldOps]!has[draft.of]]"
default:"$:/plugins/kookma/commander/field/uicomp/add-fields"
class:"tc-vertical cmd-tab-colorful cmd-tab-wd"
>>

View File

@ -0,0 +1,15 @@
caption: Add fields
tags: $:/tags/Commander/FieldOps
title: $:/plugins/kookma/commander/field/uicomp/add-fields
type: text/vnd.tiddlywiki
<!-- create the interface-->
<$macrocall $name="add-more-fields-ui" datafieldsTid="$:/temp/commander/tiddler/datafields/addfield" />
<!-- call action macro -->
<$button class="cmd-btn cmd-btn-wd"> Add new fields
<$macrocall $name="add-new-field-bulk"
datafieldsTid="$:/temp/commander/tiddler/datafields/addfield" />
</$button><br>
,,Note: This will overwrite the existing fileds!,,

View File

@ -0,0 +1,14 @@
caption: Remove fields
list-after: $:/plugins/kookma/commander/field/uicomp/add-fields
tags: $:/tags/Commander/FieldOps
title: $:/plugins/kookma/commander/field/uicomp/remove-fields
type: text/vnd.tiddlywiki
<label class="kk-cmd-label">Old field</label><$select class="cmd-select-wd" tiddler="$:/temp/commander/field-remove" default="">
<$list filter="[subfilter<searchfilter>fields[]sort[]] -title -tags" >
<option><$view field="title"/></option>
</$list>
</$select>
<$button class="cmd-btn cmd-btn-wd"> Remove old field
<$macrocall $name="remove-old-field-bulk" oldField={{$:/temp/commander/field-remove}} />
</$button>

View File

@ -0,0 +1,28 @@
caption: Rename fields
list-after: $:/plugins/kookma/commander/field/uicomp/remove-fields
tags: $:/tags/Commander/FieldOps
title: $:/plugins/kookma/commander/field/uicomp/rename-fields
type: text/vnd.tiddlywiki
<label class="kk-cmd-label">Old field</label><$select class="cmd-select-wd"
tiddler="$:/temp/commander/rename-field/old" default="" >
<$list filter="[subfilter<searchfilter>fields[]sort[]] -[<systemFieldsTid>get[text]split[ ]]" >
<option><$view field="title"/></option>
</$list>
</$select>
<label class="kk-cmd-label">New field</label><$edit-text
tiddler="$:/temp/commander/rename-field/new"
tag="input"
default=""
class="cmd-txt-area"
placeholder=" new field name"
/>
<$button class="cmd-btn cmd-btn-wd"> Rename field
<$macrocall $name="rename-field-bulk"
oldField={{$:/temp/commander/rename-field/old}}
newField={{{ [[$:/temp/commander/rename-field/new]get[text]lowercase[]trim[]split[ ]join[_]] }}} />
</$button>
<!-- new field name is checked to be lowecase and leading and trailing spaces are removed and space between words replaced by underscore (_).
-->

View File

@ -0,0 +1,24 @@
caption: Set field value
list-after: $:/plugins/kookma/commander/field/uicomp/rename-fields
tags: $:/tags/Commander/FieldOps
title: $:/plugins/kookma/commander/field/uicomp/set-field-value
type: text/vnd.tiddlywiki
<label class="kk-cmd-label">Field name</label><$select class="cmd-select-wd"
tiddler="$:/temp/commander/field-name" default="" >
<$list filter="[subfilter<searchfilter>fields[]sort[]] -[<systemFieldsTid>get[text]split[ ]]" >
<option><$view field="title"/></option>
</$list>
</$select>
<label class="kk-cmd-label">Field value</label><$edit-text
tiddler="$:/temp/commander/field-value"
tag="input" default=""
class="cmd-txt-area" placeholder=" field value"/>
<$button class="cmd-btn cmd-btn-wd"> Set field value
<$macrocall
$name="set-field-value-bulk"
fieldName={{$:/temp/commander/field-name}}
fieldValue={{$:/temp/commander/field-value}}
/>
</$button>

View File

@ -0,0 +1,5 @@
description: {{$:/language/Filters/Drafts}}
filter: [has[draft.of]sort[title]]
tags: $:/tags/Commander/Filter
title: $:/plugins/kookma/commander/filters/Drafts
type: text/vnd.tiddlywiki

View File

@ -0,0 +1,5 @@
description: {{$:/language/Filters/Missing}}
filter: [all[missing]sort[title]]
tags: $:/tags/Commander/Filter
title: $:/plugins/kookma/commander/filters/Missing
type: text/vnd.tiddlywiki

View File

@ -0,0 +1,5 @@
description: {{$:/language/Filters/Orphans}}
filter: [all[orphans]sort[title]]
tags: $:/tags/Commander/Filter
title: $:/plugins/kookma/commander/filters/Orphans
type: text/vnd.tiddlywiki

View File

@ -0,0 +1,5 @@
description: {{$:/language/Filters/RecentSystemTiddlers}}
filter: [has[modified]!sort[modified]limit[50]]
tags: $:/tags/Commander/Filter
title: $:/plugins/kookma/commander/filters/RecentSystemTiddlers
type: text/vnd.tiddlywiki

View File

@ -0,0 +1,5 @@
description: {{$:/language/Filters/RecentTiddlers}}
filter: [!is[system]has[modified]!sort[modified]limit[50]]
tags: $:/tags/Commander/Filter
title: $:/plugins/kookma/commander/filters/RecentTiddlers
type: text/vnd.tiddlywiki

View File

@ -0,0 +1,5 @@
description: Tiddlers modified since the wiki was loaded
filter: [haschanged[]]
tags: $:/tags/Commander/Filter
title: $:/plugins/kookma/commander/filters/SessionTiddlers
type: text/vnd.tiddlywiki

View File

@ -0,0 +1,5 @@
description: {{$:/language/Filters/StoryList}}
filter: [list[$:/StoryList]] -$:/AdvancedSearch
tags: $:/tags/Commander/Filter
title: $:/plugins/kookma/commander/filters/StoryList
type: text/vnd.tiddlywiki

View File

@ -0,0 +1,5 @@
description: General filter
filter: [all[shadows+tiddlers]search[your keywrods]]
tags: $:/tags/Commander/Filter
title: $:/plugins/kookma/commander/filters/geneal
type: text/vnd.tiddlywiki

View File

@ -0,0 +1,5 @@
description: Temporary and state tiddlers
filter: [prefix[$:/temp]] [prefix[$:/state]]
tags: $:/tags/Commander/Filter
title: $:/plugins/kookma/commander/filters/temp-and-state
type: text/vnd.tiddlywiki

View File

@ -0,0 +1,13 @@
caption: Help
icon: $:/core/images/help
list-after: $:/plugins/kookma/commander/setting/ui
tags: $:/tags/Commander
title: $:/plugins/kookma/commander/help/ui
type: text/vnd.tiddlywiki
<<tabs
tabsList:"[all[shadows+tiddlers]tag[$:/tags/Commander/Help]!has[draft.of]]"
default:"$:/plugins/kookma/commander/help/uicomp/quick-tutorial"
class:"tc-vertical cmd-tab-colorful cmd-tab-wd">>

View File

@ -0,0 +1,30 @@
caption: Quick tutorial
tags: $:/tags/Commander/Help
title: $:/plugins/kookma/commander/help/uicomp/quick-tutorial
type: text/vnd.tiddlywiki
# Use ''Combo search'' to list possible tiddlers
#* example: `concept` performs a standard search and find all matches in title, text, and tags
#* example: `[tag[xx]]` finds all tiddlers tagged with //xx//
#* example: `[prefix[tt]` finds all tiddlers have title started with //tt//
#* example: `[has[draft.of]sort[title]]` finds all draft tiddlers
# Use ''Select tiddlers'' for the resulting list to identify which specific tiddlers to do a batch operation on
#* this step lets you to do a batch operation on selected tiddlers NOT all items by ''Combo search''!
#* it is possible to select/deselect all tiddlers from ''Combo search'' result at once! Note that, by default all tiddlers are considered for bulk operation until selective operation is activated!
# From ''Batch operations tabs'' select the batch operation you wish to perform on selected tiddlers
#* example: title, tag, and field operations
#* example: Snr operation
#* Inspect tab can be used to inspect tiddlers before or after performing operations
* Notes:
** Multiple batch operations can be done on the same set (unless you change something in the search criteria)
** Sometimes it is useful to use an intermediate batch to help, like tag tiddlers with a "working" tag, using multiple searches, then then use the "working" tag to apply a batch operation to
<div class="commander-alert">''Note'': For good operation a tiddler width of 800px is recommended. You can also use //Sidebar layout// as `Fluid story`.</div>
For detailed docummention go to [[Demo page|https://kookma.github.io/TW-Commander/]]
!!! Footenote
# [[Use filter expression|https://tiddlywiki.com/prerelease/#Filters:Filters%20%5B%5BFilter%20Expression%5D%5D%20%5B%5BFilter%20Syntax%5D%5D%20%5B%5BFilter%20Operators%5D%5D%20%5B%5BFilter%20Parameter%5D%5D%20%5B%5BFilter%20Run%5D%5D%20%5B%5BFilter%20Step%5D%5D%20%5B%5BFilter%20Whitespace%5D%5D]]

View File

@ -0,0 +1,53 @@
caption: Regular expressions
list-after: $:/plugins/kookma/commander/help/uicomp/snr
tags: $:/tags/Commander/Help
title: $:/plugins/kookma/commander/help/uicomp/regular-expression
type: text/vnd.tiddlywiki
!! Regular Expressions Quick Reference
|''FLAGS'' |<|<|h
| i |ignore case|case insensitive matching|
| |whole words|match strings of a-z, 0-9 and _|
| g |global|field start=^, field end=$, all matches|
| m |multi-line|line start=^, line end=$, first match|
| |first match|field start=^, field end=$, first match|
|''MATCH'' |<|<|h
|''Anchors''|<|<|
| ^ |start of scope|see Flags, match is zero length|
| $ |end of scope|see Flags, match is zero length|
| \b |word boundary|anchor to edge of word, zero length|
| \B |not word boundary|anchor inside word, zero length|
|''Character Classes''|<|<|
| [c] |class of characters|any one matches, e.g. [abc123]|
| [^c] |negated class of characters|any one doesn't match, e.g. [^abc123]|
|''Shorthand Character Classes''|<|<|
| . |any character except newline|same as [^\n]|
| \d |decimal|same as [0-9]|
| \D |not decimal|same as [^0-9]|
| \s |white-space|same as [\ \t\n]|
| \S |not white-space|same as [^\ \t\n]|
| \t |tab|same as [\t]|
| \n |newline|same as [\n]|
| \w |word character|same as [a-zA-Z0-9_]|
| \W |not word character|same as [^a-zA-Z0-9_]|
|''Capturing Groups''|<|<|
| (match) |match placed in variable $x|can be used in Replace|
| (\x) |repeats match pattern of $x|can be used in Replace|
|''Quantifiers''|<|<|
| ? |single match|match 0 or 1 time|
| * |greedy match 0+|match 0 or as many times as possible|
| *? |lazy match 0+|match 0 or as few times as possible|
| + |greedy match 1+|match 1 or as many times as possible|
| +? |lazy match 1+|match 1 or as few times as possible|
| {x} |match x times|match x times|
| {x,y} |match x to y times|match x times to exactly y times|
| {x,} |match x or more times|match x times or as many as possible|
|''Escapes''|<|<|
| \ |escape special characters|add to \ [ ] ( ) { } ^ $ . ? * + for literals|
|''REPLACE'' |<|<|h
| $& |return the full match|<|
| $x |return $x where x is the numeric index of a Capturing Group|<|
|''NOTE'' |<|<|h
|This Reference supports most ordinary uses of regular expressions.<br> For advanced options: [[MDN Reference|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Using_simple_patterns]]; examples: [[regular-expressions.info|https://www.regular-expressions.info/tutorial.html]].|<|<|

View File

@ -0,0 +1,24 @@
caption: Relink on rename
list-after: $:/plugins/kookma/commander/help/uicomp/regular-expression
tags: $:/tags/Commander/Help
title: $:/plugins/kookma/commander/help/uicomp/relink
type: text/vnd.tiddlywiki
!! Relink on rename
When Tiddler Commander is used to rename bulk tiddlers in operation like
* Title operation
** add/remove prefix
** add/remove suffix
** remove chars from the begining or end of title
* ~SnR
** Search and replace in tiddlers title
It is possible to update all links to title. This includes //tags// and //list//. If [[Relink|https://flibbles.github.io/tw5-relink/]] plugin is installed, then not only title will be updated in //tags// and //list// field, but also in all filters, transclusions, text field and evrywhere.
<div class="commander-alert"> ''Note'': Relink does not update all forms of title e.g those created from different segments, but it will update any occurances</div>
!! How to integrate with ''Relink''?
Simply install the [[Relink|https://flibbles.github.io/tw5-relink/]] plugin and it will be appeared as an option when Tiddler Commander title operations including ~SnR are performed!

View File

@ -0,0 +1,40 @@
caption: Search-n-Replace
list-after: $:/plugins/kookma/commander/help/uicomp/quick-tutorial
tags: $:/tags/Commander/Help
title: $:/plugins/kookma/commander/help/uicomp/snr
type: text/vnd.tiddlywiki
!! Search and replace using Snr
Snr stands for search and replace, is a powerful tool uses regular expression for searching all fields and lets replace chars, words, phrases with new values.
!! How to use
* Enter a search filter or keywords in ''Combo search'' box like `[tag[myTag]]` or `concept`
* Use ''Select tiddlers'' for the resulting list to identify which specific tiddlers to do a Snr operation on
** If selective operation is unchecked, all tiddlers from step one will be included in Snr operation.
* From ''Tiddler title'' drop down menu select a tiddler
* From ''Field name'' drop down menu select a tiddler field like `text`
** all fileds even `title` can be selected
* In the ''Search text'' type the search term for example `this`
* In the ''Replace with'' type the term you want to replace with like `that`
* Check the ''Differences'' and if you are satisfied with the result, press the `Replace?` button
* You can press `Replace all?` if you want to search and replace in all selected tiddlers
;Remarks
: The `Replace all?` lets you to search and replace in all selected tiddlers at once! It is possible to search and replace even in `title` field!
<$list filter="[[snr.png]is[tiddler]]"><<image-pretty img:"snr.png" width:"60%" align:"center" caption:"Fig 1. Search and replace using regular expression">></$list>
!! Special characters
<<<
As `SNR` uses ''regexp'' pattern to make search and replace, when special characters are used in the ''Search text'' box, they shall be escaped among them are `*`, `+`, `[]`, `?` ...
To use these characters do like below
```
\[ \] \( \) \{ \} \. \* \+ \? \^ \$ \\ \|
```
<<<
!! Warning
<<<
* SNR replace the contents of tiddlers.<br> ''//The action can not be undone//''. So always make a backup before performing any replace action
<<<

View File

@ -0,0 +1,20 @@
caption: Warning
list-after: $:/plugins/kookma/commander/help/uicomp/relink
tags: $:/tags/Commander/Help
title: $:/plugins/kookma/commander/help/uicomp/warning
type: text/vnd.tiddlywiki
;Note i
:Tiddler Commander is a very powerful tool, it can change any field in any tiddler.// Make sure what you are doing//!
;Note ii
:Tiddler Commander uses two steps tiddler selection. It uses a combo search box to screen (using standard or filter search) possible tiddlers and then uses a selective list of tiddlers from first step for batch operation!
:# If selective operation is unchecked, then all tiddlers from step one are used for batch operation
:# If selective operation is checked, then user has to manually select among tiddlers, and the selected ones are used for batch operation
;Note iii
://Commander do not perform operation on shadow tiddlers//, unless they are overriden. Because shadow tiddlers arent stored as ''real'' tiddlers. They are intentionally excluded from most operations by default so that they dont clutter filters made by users unless explicitly required.
<div class="commander-alert">''Warning''
Before using Tiddler commander for bulk operation on your own valuable, irreplaceable data, ''backup them''.
</div>

View File

@ -0,0 +1,10 @@
tags:
title: $:/plugins/kookma/commander/history
type: text/vnd.tiddlywiki
Full change log https://kookma.github.io/TW-Commander/#ChangeLog
* ''2.1.3'' -- 2021.10.24 -- commander icon fixed
* ''2.1.2'' -- 2021.01.02 -- Saq Imtiaz release
* ''2.1.0'' -- 2020.03.25 -- stable release
* ''0.1.0'' -- 2019.02.12 -- mature public release

View File

@ -0,0 +1,5 @@
caption: file-alt (Regular)
title: $:/plugins/kookma/commander/images/commander.svg
type: text/vnd.tiddlywiki
<svg class="tc-image-file-alt tc-image-button" width="22pt" height="22pt" viewBox="0 0 384 512"><path d="M288 248v28c0 6.6-5.4 12-12 12H108c-6.6 0-12-5.4-12-12v-28c0-6.6 5.4-12 12-12h168c6.6 0 12 5.4 12 12zm-12 72H108c-6.6 0-12 5.4-12 12v28c0 6.6 5.4 12 12 12h168c6.6 0 12-5.4 12-12v-28c0-6.6-5.4-12-12-12zm108-188.1V464c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V48C0 21.5 21.5 0 48 0h204.1C264.8 0 277 5.1 286 14.1L369.9 98c9 8.9 14.1 21.2 14.1 33.9zm-128-80V128h76.1L256 51.9zM336 464V176H232c-13.3 0-24-10.7-24-24V48H48v416h288z"/></svg>

View File

@ -0,0 +1,120 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/inspect/comp/edit-fileds
type: text/vnd.tiddlywiki
\define lingo-base() $:/language/EditTemplate/
\define config-title()
$:/config/EditTemplateFields/Visibility/$(currentField)$
\end
\define config-filter()
[[hide]] -[title{$(config-title)$}]
\end
\define new-field()
<$vars name={{$:/temp/newfieldname}}>
<$reveal type="nomatch" text="" default=<<name>>>
<$button class="cmd-btn">
<$action-sendmessage $message="tm-add-field"
$name=<<name>>
$value={{$:/temp/newfieldvalue}}/>
<$action-deletetiddler $tiddler="$:/temp/newfieldname"/>
<$action-deletetiddler $tiddler="$:/temp/newfieldvalue"/>
<<lingo Fields/Add/Button>>
</$button>
</$reveal>
<$reveal type="match" text="" default=<<name>>>
<$button class="cmd-btn">
<<lingo Fields/Add/Button>>
</$button>
</$reveal>
</$vars>
\end
\define compInspect-edit-fileds(commonFields:"")
<div class="tc-edit-fields">
<table class="tc-edit-fields">
<tbody>
<$list filter="[all[current]fields[]] +[sort[title]]" variable="currentField">
<$list filter=<<config-filter>> variable="temp">
<tr class="tc-edit-field">
<td class="tc-edit-field-name">
<$text text=<<currentField>>/>:</td>
<td class="tc-edit-field-value">
<$edit-text tiddler=<<currentTiddler>> field=<<currentField>> placeholder={{$:/language/EditTemplate/Fields/Add/Value/Placeholder}}/>
</td>
<td class="tc-edit-field-remove">
<$button class="tc-btn-invisible" tooltip={{$:/language/EditTemplate/Field/Remove/Hint}} aria-label={{$:/language/EditTemplate/Field/Remove/Caption}}>
<$action-deletefield $field=<<currentField>>/>
{{$:/core/images/delete-button}}
</$button>
</td>
</tr>
</$list>
</$list>
<$list filter="created creator modified modifier -[enlist<__commonFields__>]" variable="currentField">
<tr class="tc-edit-field">
<td class="tc-edit-field-name">
<$text text=<<currentField>>/>:</td>
<td class="tc-edit-field-value">
<$edit-text tiddler=<<currentTiddler>> field=<<currentField>> placeholder={{$:/language/EditTemplate/Fields/Add/Value/Placeholder}}/>
</td>
<td class="tc-edit-field-remove">
<$button class="tc-btn-invisible" tooltip={{$:/language/EditTemplate/Field/Remove/Hint}} aria-label={{$:/language/EditTemplate/Field/Remove/Caption}}>
<$action-deletefield $field=<<currentField>>/>
{{$:/core/images/delete-button}}
</$button>
</td>
</tr>
</$list>
</tbody>
</table>
</div>
<$fieldmangler>
<div class="tc-edit-field-add">
<em class="tc-edit">
<<lingo Fields/Add/Prompt>>
</em>
<span class="tc-edit-field-add-name">
<$edit-text tiddler="$:/temp/newfieldname" tag="input" default="" placeholder={{$:/language/EditTemplate/Fields/Add/Name/Placeholder}} focusPopup=<<qualify "$:/state/popup/field-dropdown">> class="tc-edit-texteditor tc-popup-handle"/>
</span>
<$button popup=<<qualify "$:/state/popup/field-dropdown">> class="tc-btn-invisible tc-btn-dropdown" tooltip={{$:/language/EditTemplate/Field/Dropdown/Hint}} aria-label={{$:/language/EditTemplate/Field/Dropdown/Caption}}>{{$:/core/images/down-arrow}}</$button>
<$reveal state=<<qualify "$:/state/popup/field-dropdown">> type="nomatch" text="" default="">
<div class="tc-block-dropdown tc-edit-type-dropdown">
<$linkcatcher to="$:/temp/newfieldname">
<div class="tc-dropdown-item">
<<lingo Fields/Add/Dropdown/User>>
</div>
<$list filter="[!is[shadow]!is[system]fields[]search:title{$:/temp/newfieldname}sort[]] -created -creator -draft.of -draft.title -modified -modifier -tags -text -title -type" variable="currentField">
<$link to=<<currentField>>>
<<currentField>>
</$link>
</$list>
<div class="tc-dropdown-item">
<<lingo Fields/Add/Dropdown/System>>
</div>
<$list filter="[fields[]search:title{$:/temp/newfieldname}sort[]] -[!is[shadow]!is[system]fields[]]" variable="currentField">
<$link to=<<currentField>>>
<<currentField>>
</$link>
</$list>
</$linkcatcher>
</div>
</$reveal>
<span class="tc-edit-field-add-value">
<$edit-text tiddler="$:/temp/newfieldvalue" tag="input" default="" placeholder={{$:/language/EditTemplate/Fields/Add/Value/Placeholder}} class="tc-edit-texteditor"/>
</span>
<span class="tc-edit-field-add-button">
<$macrocall $name="new-field"/>
</span>
</div>
</$fieldmangler>
\end

View File

@ -0,0 +1,29 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/inspect/comp/edit-preview
type: text/vnd.tiddlywiki
\define compInspect-edit-preview(tiddler, commonFields:"")
<div class="tc-edit-fields">
<table class="tc-edit-fields">
<tbody>
<tr class="tc-edit-field"><td class="tc-edit-field-name">title:</td>
<td class="tc-edit-field-value"><$link to=<<__tiddler__>> ><$text text=<<__tiddler__>> /></$link></td>
</tr>
<tr class="tc-edit-field"><td class="tc-edit-field-name">tags:</td>
<td class="tc-edit-field-value">{{$tiddler$||$:/core/ui/EditTemplate/tags}}</td>
</tr>
<tr class="tc-edit-field"><td class="tc-edit-field-name">text:</td>
<td class="tc-edit-field-value"><$macrocall $name=compInspect-get-field tiddler=<<__tiddler__>> field="text" tag="textarea" /></td>
</tr>
</tbody>
</table>
</div>
<$tiddler tiddler=<<__tiddler__>> >
<$macrocall $name="compInspect-edit-fileds" commonFields=<<__commonFields__>> />
</$tiddler>
\end
\define compInspect-get-field(tiddler, field, tag:"input")
<$edit-text class="tc-edit-texteditor" tiddler=<<__tiddler__>> field=<<__field__>> tag=<<__tag__>> default="" placeholder={{$:/language/EditTemplate/Body/Placeholder}}/>
\end

View File

@ -0,0 +1,40 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/inspect/comp/main
type: text/vnd.tiddlywiki
\define compInspect(filter, stateTiddler:"thisTiddler")
<$set name="state"
value={{{ [[$:/state/compInspect/]addsuffix<__stateTiddler__>] }}} >
<$vars
slStateTid={{{ [<state>addsuffix[/]addsuffix[selectState-tiddler]] }}}
rvStateTid={{{ [<state>addsuffix[/]addsuffix[revealState-tiddler]] }}}
chStateTid={{{ [<state>addsuffix[/]addsuffix[checkboxState-tiddler]] }}} >
Select tiddler &nbsp;<$macrocall $name=compSelect filter=<<__filter__>> stateTiddler=<<slStateTid>> />
&nbsp;&nbsp;
<$macrocall $name="check-common-fields" stateTiddler=<<chStateTid>> />
&nbsp;&nbsp;
<$reveal stateTitle=<<rvStateTid>> type="nomatch" text="edit">
<$button class="tc-btn-invisible" setTitle=<<rvStateTid>> setTo="edit" tooltip="edit tiddler">{{$:/core/images/edit-button}}</$button>
<$macrocall $name=compInspect-show-preview tiddler={{{ [<slStateTid>get[text]]+[subfilter<__filter__>] }}} commonFields={{{ [<chStateTid>get[text]] }}}/>
</$reveal>
<$reveal stateTitle=<<rvStateTid>> type="match" text="edit">
<$button class="tc-btn-invisible" setTitle=<<rvStateTid>> setTo="" tooltip="confirm changes">{{$:/core/images/done-button}}</$button>
<$macrocall $name=compInspect-edit-preview tiddler={{{ [<slStateTid>get[text]]+[subfilter<__filter__>] }}} commonFields={{{ [<chStateTid>get[text]] }}}/>
</$reveal>
</$vars>
</$set>
\end
\define check-common-fields(stateTiddler)
<$vars commonFields={{{[<commonFieldsTid>get[text]]}}}>
<$checkbox
tiddler=<<__stateTiddler__>>
field="text"
checked=<<commonFields>>
unchecked=""
default=""
> Exclude common fields?</$checkbox>
</$vars>
\end

View File

@ -0,0 +1,34 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/inspect/comp/select
type: text/vnd.tiddlywiki
\define compSelect(filter:"", stateTiddler:"", default:"", class:"", showButtons:"show")
<$select tiddler=<<__stateTiddler__>> default=<<__default__>> class=<<__class__>> >
<option value="">None</option>
<$list filter=<<__filter__>> variable=item>
<option value=<<item>>><$text text=<<item>> /></option>
</$list>
</$select>
<$reveal type="match" text="show" default=<<__showButtons__>> >
<$vars myfilter=<<__filter__>> mystateTiddler=<<__stateTiddler__>> myitem={{{ [<__stateTiddler__>get[text]] }}} >
<$button actions=<<cs-prev-item>> class="cmd-btn"> prev </$button>
<$button actions=<<cs-next-item>> class="cmd-btn"> next </$button>
</$vars>
</$reveal>
\end
\define cs-prev-item()
<$list filter="[subfilter<myfilter>] +[before<myitem>]" variable="prev-item" >
<$action-setfield $tiddler=<<mystateTiddler>> text=<<prev-item>> />
</$list>
\end
\define cs-next-item()
<$list filter="[subfilter<myfilter>] +[after<myitem>]" variable="next-item" >
<$action-setfield $tiddler=<<mystateTiddler>> text=<<next-item>> />
</$list>
\end
<!-- used by
- $:/plugins/kookma/commander/compInspect/main
-->

View File

@ -0,0 +1,31 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/inspect/comp/show-preview
type: text/vnd.tiddlywiki
\define compInspect-show-preview(tiddler, commonFields:"")
<$vars mainFields="title tags text">
<table class="cmd-ci-table">
<tr><td class="leftcol">title</td>
<td class="rightcol"><$link to=<<__tiddler__>> ><$text text=<<__tiddler__>> /></$link></td>
</tr>
<tr><td class="leftcol">tags</td>
<td style="padding:3px;"><$macrocall $name=showTags tiddler=<<__tiddler__>> /></td>
</tr>
<tr><td class="leftcol">text</td>
<td><$transclude tiddler=<<__tiddler__>> field="text" mode="block"/></td>
</tr>
<$list filter="[<__tiddler__>fields[]] -[enlist<mainFields>] -[enlist<__commonFields__>]" variable="otherFld">
<tr><td class="leftcol"><<otherFld>></td>
<td class="rightcol"><$transclude tiddler=<<__tiddler__>> field=<<otherFld>> mode="inline"/></td>
</tr>
</$list>
</table>
</$vars>
\end
\define showTags(tiddler)
<$list filter="[<__tiddler__>tags[]]" variable=tagItem >
<$macrocall $name=tag tag=<<tagItem>> />
</$list>
\end

View File

@ -0,0 +1,10 @@
caption: Inspect
list-after: $:/plugins/kookma/commander/field/ui
tags: $:/tags/Commander
title: $:/plugins/kookma/commander/inspect/ui
type: text/vnd.tiddlywiki
<<tabs
tabsList:"[all[shadows+tiddlers]tag[$:/tags/Commander/InspectOps]!has[draft.of]]"
default:"$:/plugins/kookma/commander/inspect/uicomp/Inspection"
class:"tc-vertical cmd-tab-wd">>

View File

@ -0,0 +1,10 @@
caption: Inspect
tags: $:/tags/Commander/InspectOps
title: $:/plugins/kookma/commander/inspect/uicomp/Inspection
type: text/vnd.tiddlywiki
<$macrocall
$name=compInspect
filter=<<searchfilter>>
stateTiddler="commander"
/>

View File

@ -0,0 +1,15 @@
tags:
title: $:/plugins/kookma/commander/license
type: text/vnd.tiddlywiki
Distributed under an MIT license.
Copyright (c) 2018-2020 [[Mohammad Rahmani|https://github.com/kookma]]
<<<
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<<<

View File

@ -0,0 +1,30 @@
caption: Log status
tags:
title: $:/plugins/kookma/commander/log/ui
type: text/vnd.tiddlywiki
<div class="commander-alert" style="padding:5px;font-size:0.90em;">
<$button class="tc-btn-invisible tc-tiddlylink" actions=<<delete-all-log-tiddlers>>>Clear log</$button>
<$set name="resultCount" value="""<$count filter="[tag[$:/tags/Commander/LogOps]]" />""">
<div class="tc-search-results">
<span class="kk-commander-log-note">Recent number of operations: <<resultCount>></span><br>
<$list filter="[tag[$:/tags/Commander/LogOps]] +[!sort[created]]" variable="logTid">
<b><$view tiddler=<<logTid>> field="created" format="date" template="YYYY-0MM-0DD 0hh:0mm:0ss"/>
<$view tiddler=<<logTid>> field="caption">
<$view tiddler=<<logTid>> field="title"></$view>
</$view>
</b>
<ol><$list filter="[<logTid>indexes[]]" variable="item">
<li><$link to=<<item>>><<item>></$link>
<$set name="myItem" tiddler=<<logTid>> index=<<item>> >
<$list filter="[<myItem>!search[existed]]" variable="ignore"
emptyMessage="""<span style="color:red;"><<myItem>></span>""" >
<span class="kk-commander-log-item"><<myItem>></span>
</$list>
</$set>
</li>
</$list></ol>
</$list>
</div>
</$set>
</div>

View File

@ -0,0 +1,30 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/macros/compConfirmAction
type: text/vnd.tiddlywiki
\define compConfirmAction(
btnLabel:"Delete these tiddlers",
confirmMessage:"Are you sure you wish to delete",
stateTiddler:""
countFilter:"",
actionMacro:"")
<$set name=resultCount value={{{ [subfilter<__countFilter__>count[]] }}} >
<$reveal type="gt" text="0" default=<<resultCount>> >
<$button popup=<<qualify """$stateTiddler$""">> class="cmd-btn">$btnLabel$</$button>
</$reveal>
<$reveal state=<<qualify """$stateTiddler$""">> type="popup" position="belowleft" animate="yes">
<div class="tc-block-dropdown-wrapper">
<div class="tc-block-dropdown tc-edit-type-dropdown">
<div class="tc-dropdown-item-plain">
$confirmMessage$ <<resultCount>> tiddler(s)?
</div>
<div class="tc-dropdown-item-plain">
<$button class="cmd-btn"> $btnLabel$
<$macrocall $name=<<__actionMacro__>> />
</$button>
</div>
</div>
</div>
</$reveal>
</$set>
\end

View File

@ -0,0 +1,15 @@
description: some macro are not used REMOVE THEM
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/macros/definition
type: text/vnd.tiddlywiki
\define tempPath() $:/temp/commander
\define searchboxTid() $(tempPath)$/search-box
\define selectiveOpsTid() $(tempPath)$/selective-operation
\define workingTag() $:/tags/Commander/Working
\define exportTagTid() $:/temp/commander/exportTag
\define systemFieldsTid() $:/plugins/kookma/commander/config/systemfields
\define commonFieldsTid() $:/plugins/kookma/commander/config/commonfields

View File

@ -0,0 +1,27 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/macros/logging
type: text/vnd.tiddlywiki
\define set-title() $:/temp/commander/logs/tid-{{{[tag[$:/tags/Commander/LogOps]count[]add[1]]}}}
\define create-log-tiddler(msg)
<$wikify name="myTitle" text="""<<set-title>>""">
<$wikify name="myCaption" text="""<$macrocall $name="set-caption" msg=<<__msg__>> />""">
<$action-createtiddler $basetitle=<<myTitle>>
$savetitle="$:/state/commander/log-tiddler"
tags="$:/tags/Commander/LogOps"
type="application/json"
caption=<<__msg__>>
/>
</$wikify>
</$wikify>
\end
\define log-add-single-operation(msg:"commander operation", tidItem:"no item")
<$action-setfield $tiddler={{$:/state/commander/log-tiddler}} $index=<<__tidItem__>> $value=<<__msg__>> />
\end
\define delete-all-log-tiddlers()
<$action-deletetiddler $filter="[tag[$:/tags/Commander/LogOps]]" />
\end

View File

@ -0,0 +1,17 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/macros/remove-workingtag
type: text/vnd.tiddlywiki
\define remove-working-tag(oldTag)
<$list filter="[all[shadows+tiddlers]tag<workingTag>limit[1]]" variable=ignore>
<<create-log-tiddler "remove-workingTag">>
<$list filter="[all[shadows+tiddlers]tag<workingTag>]">
<$fieldmangler>
<$action-sendmessage $message="tm-remove-tag" $param=<<__oldTag__>> />
</$fieldmangler>
<$macrocall $name="log-add-single-operation" msg="""working tag `$oldTag$` removed""" tidItem=<<currentTiddler>> />
</$list>
</$list>
\end

View File

@ -0,0 +1,28 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/macros/slider
type: text/vnd.tiddlywiki
\define commander-slider(title, default:"closed")
<$set name="revealState" value=<<qualify "$:/state/commander/reveal/$title$">>>
<h2>
<$reveal type="nomatch" state=<<revealState>> text="open" default="$default$">
<$button class="tc-btn-invisible tc-tiddlylink" set=<<revealState>> setTo="open">
{{$:/core/images/right-arrow}}
</$button>
</$reveal>
<$reveal type="match" state=<<revealState>> text="open" default="$default$">
<$button class="tc-btn-invisible tc-tiddlylink" set=<<revealState>> setTo="closed">
{{$:/core/images/down-arrow}}
</$button>
</$reveal>
<$view tiddler="$title$" field="caption">
<$view tiddler="$title$" field="title"></$view>
</$view>
</h2>
<$reveal type="match" state=<<revealState>> text="open" default="$default$">
<$transclude tiddler="$title$" mode="block" />
</$reveal>
</$set>
\end

View File

@ -0,0 +1,48 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/macros/utility
type: text/vnd.tiddlywiki
\define display(label,text)
<$set name="stateTid" value="$:/temp/commander/display/popup/$label$" >
<$button popup=<<stateTid>> class="tc-btn-invisible"><span style="text-decoration: underline">$label$</span></$button>
<$reveal type="nomatch" text="" default="" state=<<stateTid>> animate="yes">
<span style="color:blue;"><$text text=<<__text__>> /></span></$reveal>
</$set>
\end
\define is-filterSeearch-newer-than-selectedTitles(TidA, TidB)
<$set name="tidAMod" value={{{ [[$TidA$]get[modified]] }}}>
<$set name="tidBMod" value={{{ [[$TidB$]get[modified]] }}}>
<$set name="tidAText" value={{{ [[$TidA$]get[text]] }}}>
<$set name="tidBText" value={{{ [[$TidB$]get[text]] }}}>
<$list filter="[<__TidB__>get[text]minlength[1]]" variable=ignore>
<$reveal type="nomatch" default=<<tidAText>> text=<<tidBText>>>
<$list filter="[<tidAMod>] [<tidBMod>] +[nsort[]last[1]removesuffix<tidBMod>]">
A new filter search has been detected, click on the search button to apply it.
</$list>
</$reveal>
</$list>
</$set>
</$set>
</$set>
</$set>
\end
!!Remarks
;is-filterSeearch-newer-than-selectedTitles
* Checks `TidA` and `TidB` for modified date and text
* If They are not empty, then
** checks if the text of two are equal, if not
** checks to see if `TidB` is newer or not
** if newer shows a message, to apply the new search filter
* Note
** `TidA="$:/temp/commander"`
** `TidB="$:/temp/commander/search-box"`
* is-filterSeearch-newer-than-selectedTitles is called from $:/plugins/kookma/commander/search/ui
;display
* gets a label and a text
* create an inline label
* on click label, the text is displayed as temporary popup
* losing focus, the text goes hidden
* this macro is used in customized compSelective to show the active filter

View File

@ -0,0 +1,34 @@
tags:
title: $:/plugins/kookma/commander/readme
type: text/vnd.tiddlywiki
; Tiddler Commander
Tiddler Commander, in short ''Commander'' is a unique tool for batch operations on tiddlers. Commander has the below features
* Bulk tiddler creation/deletion
* Combo search to filter and select tiddlers
* Title operation: add, remove prefixes and suffixes, also remove cahras form begining and end of title (on renaming tiddlers, [[relink|$:/plugins/kookma/commander/help/uicomp/relink]] can be used to update title in other tiddlers)
* Tag operation: add, remove, replace
* Field operation: add, remove, rename, and set field value
* SNR, search and replace in all fields including text, tags, //title//, and common fields
* Inspect, to review and inspect tiddlers in one place, scroll among them and edit all fields (including common fields), tags, text (title is an exception!)
* Log, create logs of all operations
* Search, //save and load// any combination of filter search
; Start Commander
* Normally Commander adds its icon: <span class="cmd-doc">{{$:/plugins/kookma/commander/images/commander.svg}}</span> to page controls.
* Open the right sidebar and click on the <span class="cmd-doc">{{$:/plugins/kookma/commander/images/commander.svg}}</span> Commander is started
* In standard Tiddlywiki, control buttons are shown on the right sidebar under site title.
; Code and demo
For learning plugin features, syntax, tutorial and examples see the plugin demo and code pages
* Demo: https://kookma.github.io/TW-Commander/
* Code: https://github.com/kookma/TW-Commander
<style>
.cmd-doc svg{
width: 1.2em;
height: 1.2em;
vertical-align: middle;}
</style>

View File

@ -0,0 +1,20 @@
list-after: $:/plugins/kookma/commander/search/filter-button/search
tags: $:/tags/Commander/Search/FilterButton
title: $:/plugins/kookma/commander/search/filter-button/clear
type: text/vnd.tiddlywiki
\import $:/plugins/kookma/commander/macros/definition
<$reveal type="nomatch" stateTitle=<<searchboxTid>> stateField="text" text="">
<$button class="tc-btn-invisible" tooltip="clear search box and selected tiddlers">
<$action-setfield $tiddler=<<searchboxTid>> $field="text" $value=""/>
<$action-setfield $tiddler="$:/temp/commander" $field="text" $value=""/>
<$action-setfield $tiddler="$:/state/commander/snr/select-tiddler" $field="text" $value=""/><!-- SNR selection -->
<$action-setfield $tiddler="$:/state/compInspect/temp/commander/selectState-tiddler" $field="text" $value=""/> <!-- Inspect selection -->
{{$:/core/images/close-button}}
</$button>
</$reveal>
<!--
there is extra action should be removed
-->

View File

@ -0,0 +1,26 @@
tags: $:/tags/Commander/Search/FilterButton
title: $:/plugins/kookma/commander/search/filter-button/dropdown
type: text/vnd.tiddlywiki
\import $:/plugins/kookma/commander/macros/definition
\whitespace trim
<span class="tc-popup-keep">
<$button popup=<<qualify "$:/state/commander/filterDropdown">> class="tc-btn-invisible" tooltip="select a search filter">
{{$:/core/images/down-arrow}}
</$button>
</span>
<$reveal state=<<qualify "$:/state/commander/filterDropdown">> type="popup" position="belowleft" animate="yes">
<$set name="tv-show-missing-links" value="yes">
<$linkcatcher to=<<searchboxTid>> >
<div class="tc-block-dropdown-wrapper">
<div class="tc-block-dropdown tc-edit-type-dropdown">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Commander/Filter]!is[draft]]">
<$link to={{!!filter}}><$let tv-wikilinks="no"><$transclude field="description"/></$let></$link>
</$list>
</div>
</div>
</$linkcatcher>
</$set>
</$reveal>

View File

@ -0,0 +1,42 @@
list-after: $:/plugins/kookma/commander/search/filter-button/clear
tags: $:/tags/Commander/Search/FilterButton
title: $:/plugins/kookma/commander/search/filter-button/save
type: text/vnd.tiddlywiki
\import $:/plugins/kookma/commander/macros/definition
<$reveal type="nomatch" stateTitle=<<searchboxTid>> stateField="text" text="">
<$button class="tc-btn-invisible" tooltip="save current search" popup=<<qualify "$:/state/commander/SaveDropdown">> >
{{$:/core/images/file}}
</$button>
</$reveal>
<$reveal state=<<qualify "$:/state/commander/SaveDropdown">> type="popup" class="tc-popup-keep" position="belowleft" animate="yes">
<div class="tc-block-dropdown-wrapper">
<div class="tc-block-dropdown tc-edit-type-dropdown">
<div class="tc-dropdown-item-plain">
Save new search filter<br><br>
<$edit-text
tiddler="$:/temp/commander/save-new-filter"
tag="input"
default=""
class="cmd-txt-area"
placeholder="description for new filter"
/> <br><br>
<$button class="tc-btn"> Save new filter
<$macrocall $name="create-new-filter"
description={{$:/temp/commander/save-new-filter}}
basetitle="$:/plugins/kookma/commander/filters/yourFilter"
filter={{{[<searchboxTid>get[text]]}}} />
<$action-deletetiddler $tiddler="$:/temp/commander/save-new-filter"/>
<$action-deletetiddler $tiddler=<<qualify "$:/state/commander/SaveDropdown">> />
</$button>
</div>
</div>
</div>
</$reveal>
<!-- ToDO
correct classes for textbox
-->

View File

@ -0,0 +1,14 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/search/macros/create-new-filter
type: text/vnd.tiddlywiki
\define create-new-filter(description:"", basetitle:"", filter:"")
<$list filter="[<__description__>!is[blank]]" variable="ignore">
<$action-createtiddler
$basetitle="""$basetitle$"""
tags="$:/tags/Commander/Filter"
description=<<__description__>>
filter="""$filter$"""
/>
</$list>
\end

View File

@ -0,0 +1,17 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/search/macros/select-deselect
type: text/vnd.tiddlywiki
\define select-all()
<$list filter="[subfilter<filtertext>!is[missing]!tag<workingTag>]">
<$fieldmangler>
<$action-sendmessage $message="tm-add-tag" $param=<<workingTag>> />
</$fieldmangler>
\end
\define deselect-all()
<$list filter="[tag<workingTag>]">
<$fieldmangler>
<$action-sendmessage $message="tm-remove-tag" $param=<<workingTag>> />
</$fieldmangler>
\end

View File

@ -0,0 +1,9 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/search/macros/warning
type: text/vnd.tiddlywiki
\define warn-for-selectedTids-from-previous-operation()
<$list filter="[tag<workingTag>]-[subfilter<filtertext>]+[count[]!match[0]] ">
<span style="color:red;font-size:0.85em">There are remained selected tiddlers from previous search! Remove them by pressing ''deselect all''!</span>
</$list>
\end

View File

@ -0,0 +1,27 @@
caption: Select tiddlers
title: $:/plugins/kookma/commander/search/selection
type: text/vnd.tiddlywiki
\import $:/plugins/kookma/commander/macros/definition
<$checkbox tiddler=<<selectiveOpsTid>> field="text" checked="yes" unchecked="no" default="no" uncheckactions=<<deselect-all>> > Selective operation?</$checkbox>
<$reveal type="nomatch" stateTitle=<<selectiveOpsTid>> stateField="text" text="yes" tag="div" class="kk-commander-tiddler-list kk-commander-columns3">
<$list filter="[subfilter<filtertext>!prefix[$:/temp/commander]!is[missing]]"><$link/><br></$list>
</$reveal>
<$reveal type="match" stateTitle=<<selectiveOpsTid>> stateField="text" text="yes" tag="div">
<$button actions=<<select-all>> > Select all</$button> <$button actions=<<deselect-all>> > Deselect all</$button>
<small style="margin-left:10px;">Number of tiddlers selected: <$count filter="[tag<workingTag>]" /></small><br>
<<warn-for-selectedTids-from-previous-operation>>
</$reveal>
<$reveal type="match" stateTitle=<<selectiveOpsTid>> stateField="text" text="yes" tag="div" class="kk-commander-tiddler-list kk-commander-columns3">
<$list filter="[subfilter<filtertext>!prefix[$:/temp/commander]!is[missing]]">
<$checkbox tag=<<workingTag>>> <$link/></$checkbox><br>
</$list>
</$reveal>
<!-- Description
This tiddler implement interface to selectivly add tiddlers for commander operations.
Each selected tiddler gets a working tag
-->

View File

@ -0,0 +1,9 @@
caption: Commander filter search
code-body: yes
title: $:/plugins/kookma/commander/search/ui
type: text/vnd.tiddlywiki
<div class="tc-search tc-advanced-search" style="margin-bottom:-12px;"><!-- negative margin for displaying matches -->
Combo search &nbsp;<$edit-text tiddler=<<searchboxTid>> type="search" tag="input" default="" placeholder="enter keywords or make a filter search e.g. [tag[myTag]]" focus={{$:/plugins/kookma/commander/config/AutoFocus}}/>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/Commander/Search/FilterButton]!has[draft.of]]"><$transclude/></$list>
</div>

View File

@ -0,0 +1,11 @@
caption: Setting
icon: $:/core/images/options-button
list-after: $:/plugins/kookma/commander/inspect/ui
tags: $:/tags/Commander
title: $:/plugins/kookma/commander/setting/ui
type: text/vnd.tiddlywiki
<<tabs
tabsList:"[all[shadows+tiddlers]tag[$:/tags/Commander/Setting]!has[draft.of]]"
default:"$:/plugins/kookma/commander/setting/uicomp/snr"
class:"tc-vertical cmd-tab-colorful cmd-tab-wd">>

View File

@ -0,0 +1,25 @@
caption: Temporary tiddlers
list-after: $:/plugins/kookma/commander/setting/uicomp/relink
tags: $:/tags/Commander/Setting
title: $:/plugins/kookma/commander/setting/uicomp/delete-all-temp-tiddlers
type: text/vnd.tiddlywiki
\define delete-all-temps()
<$action-deletetiddler $filter="[search:title[$:/temp/commander/]]" />
\end
<$set name=numTids value={{{ [search:title[$:/temp/commander/]count[]] }}}>
<$reveal type="match" text="0" default=<<numTids>> >
No temporary tiddlers is existed to delete!
</$reveal>
<$reveal type="gt" text="0" default=<<numTids>> >
Number of temporary tiddlers (including log tiddlers): <<numTids>><br>
</$reveal>
</$set>
<$macrocall $name="compConfirmAction"
btnLabel="Delete temp tiddlers"
confirmMessage="Are you sure you wish to delete"
stateTiddler="$:/state/commander/setting/delete-temps"
countFilter="[search:title[$:/temp/commander/]]"
actionMacro="delete-all-temps"/>

View File

@ -0,0 +1,8 @@
caption: Search minimum length
tags: $:/tags/Commander/Setting
title: $:/plugins/kookma/commander/setting/uicomp/minlength
type: text/vnd.tiddlywiki
Controls the minimum length of a search string before results are displayed.
<label class="kk-cmd-label">Minlength</label><$edit-text tiddler="$:/plugins/kookma/commander/config/minlength" field=text default=3 placeholder="enter a number" tag=input/>

View File

@ -0,0 +1,17 @@
caption: Search filter
tags: $:/tags/Commander/Setting
title: $:/plugins/kookma/commander/setting/uicomp/search-filters
type: text/vnd.tiddlywiki
The below list shows the Commander search filter. To edit click on the link and edit tiddler for filter syntax or description
<details>
<summary>Commander saved filter search</summary>
<dl>
<$list filter="[all[tiddlers+shadows]tag[$:/tags/Commander/Filter]]" >
<dt><$link/></dt>
<dd><span style="display:inline-block;font-weight:700;width:100px">Description:</span><$view field="description"/></dd>
<dd><span style="display:inline-block;font-weight:700;width:100px">Filter:</span><$view field="filter"/></dd>
</$list>
</dl>
</details>

View File

@ -0,0 +1,14 @@
caption: Snr setting
tags: $:/tags/Commander/Setting
title: $:/plugins/kookma/commander/setting/uicomp/snr
type: text/vnd.tiddlywiki
<<snr-difftext-cleanup>>
<div style="padding-left:25px;font-size:0.9em">
The cleanup attribute determines which optional post-processing should be applied to the diffs:
* none: no cleanup is performed
* semantic (default): rewrites the diffs for human readability
* efficient: rewrites the diffs to minimise the number of operations for subsequent processing
</div>

View File

@ -0,0 +1,118 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/snr/macros/actions
type: text/vnd.tiddlywiki
\define regexp-flags()
{{$:/state/commander/snr/gm}}{{$:/state/commander/snr/case-sensitive}}{{$:/state/commander/snr/unicode}}
\end
\define snr-ui-show-diffs()
<form class="cmd-snr-form" style="width:100%;">
<fieldset>
<legend style="color:#FF0000;">Differences</legend>
Tiddler: <$link to={{$:/state/commander/snr/select-tiddler}}><$text text={{$:/state/commander/snr/select-tiddler}}/></$link>
<$wikify name=flags text=<<regexp-flags>> >
<$macrocall $name="replace-text-diff"
tiddler={{$:/state/commander/snr/select-tiddler}}
field={{$:/state/commander/snr/select-tiddler/field}}
replace={{$:/state/commander/snr/replace-text}}
replaceWith={{$:/state/commander/snr/replace-text-with}}
flags=<<flags>>
wholeWords={{$:/state/commander/snr/whole-words}}
/>
</$wikify>
</fieldset>
</form>
\end
\define snr-check-diffs(tiddler:"", field:"")
\whitespace trim
<$wikify name=flags text=<<regexp-flags>> >
<$wikify name="result" text="""
<$macrocall $name="replace-text"
tiddler=<<__tiddler__>>
field=<<__field__>>
replace={{$:/state/commander/snr/replace-text}}
replaceWith={{$:/state/commander/snr/replace-text-with}}
flags=<<flags>>
wholeWords={{$:/state/commander/snr/whole-words}}
/>""">
<$reveal type="match" text={{{ [<__tiddler__>get<__field__>] }}} default=<<result>> >
same
</$reveal>
<$reveal type="nomatch" text={{{ [<__tiddler__>get<__field__>] }}} default=<<result>> >
different
</$reveal>
</$wikify>
</$wikify>
\end
\define search-replace-in-tiddler-field(tiddler:"",field:"",replace:"",replaceWith:"")
<$wikify name=ss text=<<snr-check-diffs """$tiddler$""" """$field$""">> >
<$list filter="[<ss>] -same" variable=ignore>
<$list filter="[<__tiddler__>has[title]]" variable="ignore">
<$wikify name=flags text=<<regexp-flags>> >
<$macrocall $name="replace-text-button"
tiddler=<<__tiddler__>>
field=<<__field__>>
replace=<<__replace__>>
replaceWith=<<__replaceWith__>>
flags=<<flags>>
wholeWords={{$:/state/commander/snr/whole-words}}
/>
<$macrocall $name="log-add-single-operation" msg="""`$field$` field has been changed""" tidItem=<<__tiddler__>> />
<$macrocall $name="clear-select-tiddler-if-field-is-title" tiddler=<<__tiddler__>> field=<<__field__>> />
</$wikify>
</$list>
</$list>
</$wikify>
\end
\define clear-select-tiddler-if-field-is-title(tiddler, field)
<$list filter="[<__field__>] +[search[title]]" variable="ignore">
<$action-setfield $tiddler="$:/state/commander/snr/select-tiddler" text=""/>
<$action-setfield $tiddler="$:/temp/commander/selected-titles" $index=<<__tiddler__>> />
</$list>
\end
\define search-replace-in-field-bulk()
<$list filter="[subfilter<searchfilter>!is[missing]limit[1]]" variable=ignore><!--check if filter is empty -->
<<create-log-tiddler "SNR operation">>
<$list filter="[subfilter<searchfilter>!is[missing]]" >
<$macrocall
$name="search-replace-in-tiddler-field"
tiddler=<<currentTiddler>>
field={{$:/state/commander/snr/select-tiddler/field}}
replace={{$:/state/commander/snr/replace-text}}
replaceWith={{$:/state/commander/snr/replace-text-with}}
/>
</$list>
</$list>
\end
\define search-replace-in-field-single-tiddler()
<<create-log-tiddler "SNR operation">>
<$macrocall
$name="search-replace-in-tiddler-field"
tiddler={{$:/state/commander/snr/select-tiddler}}
field={{$:/state/commander/snr/select-tiddler/field}}
replace={{$:/state/commander/snr/replace-text}}
replaceWith={{$:/state/commander/snr/replace-text-with}}
/>
\end
\define snr-actions()
<$button actions=<<search-replace-in-field-single-tiddler>> tooltip="search and replace in a single tiddler" class="cmd-btn">
Replace?
</$button>&nbsp;
<!-- replace in bulk tiddler with confirmation -->
<$macrocall $name="compConfirmAction"
countFilter=<<searchfilter>>
actionMacro="search-replace-in-field-bulk"
stateTiddler="$:/state/commander/SelectiveReplaceAllDropdown"
confirmMessage="Are you sure you wish to replace text in"
btnLabel="Replace all?"/>
\end

View File

@ -0,0 +1,56 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/snr/macros/inputs
type: text/vnd.tiddlywiki
\define snr-ui-inputs()
<form class="cmd-snr-form">
<fieldset>
<legend>Search and Replace</legend>
<div class="item">
<label>Tiddler title</label>
<$select tiddler="$:/state/commander/snr/select-tiddler" default="" class="cmd-snr-textbox">
<option value="">None</option>
<$list filter="[subfilter<searchfilter>]" >
<option value=<<currentTiddler>>><$text text=<<currentTiddler>>/></option>
</$list>
</$select>
</div>
<div class="item">
<label>Field name</label>
<$select tiddler="$:/state/commander/snr/select-tiddler/field" default="text">
<$list filter="[subfilter<searchfilter>fields[]]">
<option value=<<currentTiddler>>><$text text=<<currentTiddler>>/></option>
</$list>
</$select>
</div>
<div class="item">
<label>Search text</label>
<$edit-text
tiddler="$:/state/commander/snr/replace-text"
tag="input"
default=""
placeholder=" text to replace"
class="cmd-snr-textbox"/>
</div>
<div class="item">
<label>Replace with </label>
<$edit-text
tiddler="$:/state/commander/snr/replace-text-with"
tag="input"
default=""
placeholder=" new text"
class="cmd-snr-textbox"/>
</div>
<!-- Use relink to update titles -->
<$list filter="[[$:/state/commander/snr/select-tiddler/field]get[text]match[title]]" variable=ignore>
<div class="item-relink">{{$:/plugins/kookma/commander/config/relink}}</div>
</$list>
</fieldset>
</form>
\end

View File

@ -0,0 +1,60 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/snr/macros/regexp-flags
type: text/vnd.tiddlywiki
\define snr-regexp-flags()
<form class="cmd-snr-form">
<fieldset>
<legend>Search flags</legend>
<$checkbox
tiddler="$:/state/commander/snr/case-sensitive"
field="text"
checked="i"
unchecked=""
/>&nbsp; ignore case<br>
<$checkbox
tiddler="$:/state/commander/snr/whole-words"
field="text"
checked="words"
unchecked="characters"
/>&nbsp; whole words<br>
<$checkbox
tiddler="$:/state/commander/snr/unicode"
field="text"
checked="u"
unchecked=""
/>&nbsp; unicode<br>
<br>
<$radio
tiddler="$:/state/commander/snr/gm"
field="text"
value="">&nbsp; first match
</$radio><br>
<$radio
tiddler="$:/state/commander/snr/gm"
field="text"
value="g">&nbsp; global match
</$radio><br>
<$radio
tiddler="$:/state/commander/snr/gm"
field="text"
value="m">&nbsp; multiline mode
</$radio><br>
<$radio
tiddler="$:/state/commander/snr/gm"
field="text"
value="mg">&nbsp; global multiline mode
</$radio>
</fieldset>
</form>
\end

View File

@ -0,0 +1,50 @@
/*\
created: 20190214160253135
type: application/javascript
title: $:/plugins/kookma/commander/snr/macros/regexpsub.js
modified: 20200307092210323
module-type: macro
Make regular expression substitutions
Developed by Mark S
\*/
(function(){
/*jslint node: true, browser: true */
"use strict";
exports.name = "regexpsub";
exports.params = [
{name: "searchValue"},
{name: "replaceValue"},
{name: "sourceText"},
{name: "flags"},
{name: "wholeWords"}
];
/*
Run the macro
*/
exports.run = function(searchValue, replaceValue, sourceText, flags = "gi", wholeWords = "characters") {
try {
var searchText;
if(wholeWords.toLowerCase() === 'words'){
searchText = "\\b" + searchValue + "\\b";
} else{
searchText = searchValue;
}
searchText = new RegExp(searchText, flags);
return sourceText.replace(searchText,replaceValue);
}
catch(err) {
return "ERROR IN REG EXPRESSION. YOU MAY NEED TO ESCAPE VALUES";
}
};
})();

View File

@ -0,0 +1,5 @@
created: 20190214160253135
modified: 20200307092210323
module-type: macro
title: $:/plugins/kookma/commander/snr/macros/regexpsub.js
type: application/javascript

View File

@ -0,0 +1,66 @@
tags: $:/tags/Commander/Macro
title: $:/plugins/kookma/commander/snr/macros/replace-text
type: text/vnd.tiddlywiki
\define nothing-to-replace(tiddler, field:"text")
<$diff-text source={{{ [<__tiddler__>get<__field__>] }}} dest={{{ [<__tiddler__>get<__field__>] }}} />
\end
\define replace-text(tiddler:"",field:"text",replace:"",replaceWith:"",flags:"", wholeWords:"")
\whitespace trim
<$wikify name="source" text="""<$view tiddler=<<__tiddler__>> field=<<__field__>> mode="block" format="text"/>""">
<$wikify name="result"
text="""<$macrocall $name="regexpsub" $type="text/plain"
sourceText=<<source>>
searchValue=<<__replace__>>
replaceValue=<<__replaceWith__>>
flags=<<__flags__>>
wholeWords=<<__wholeWords__>> />"""
>
<$text text=<<result>>/>
</$wikify>
</$wikify>
\end
\define replace-text-diff(tiddler:"", field:"text", replace, replaceWith, flags:"", wholeWords:"")
<$list filter="[<__tiddler__>get<__field__>minlength[1]]" variable=null emptyMessage="No tiddler is selected, or tiddler is empty.">
<$list filter="[<__replace__>minlength[1]]" variable=null emptyMessage=<<nothing-to-replace """$tiddler$""" """$field$""">> >
<$wikify name="result"
text="""<$macrocall $name="replace-text"
tiddler=<<__tiddler__>> field=<<__field__>>
replace=<<__replace__>>
replaceWith=<<__replaceWith__>>
flags=<<__flags__>>
wholeWords=<<__wholeWords__>> />"""
>
<$diff-text source={{{ [<__tiddler__>get<__field__>] }}} dest=<<result>> cleanup={{$:/state/commander/snr/setting/cleanup}}/>
</$wikify>
</$list>
</$list>
\end
\define replace-text-button(tiddler:"", field:"text", replace:"", replaceWith:"", flags:"", wholeWords:"")
\whitespace trim
<$list filter="[<__tiddler__>get<__field__>minlength[1]]" variable=null>
<$list filter="[<__replace__>minlength[1]]" variable=null>
<$wikify name="result"
text="""<$macrocall $name="replace-text"
tiddler=<<__tiddler__>>
field=<<__field__>>
replace=<<__replace__>>
replaceWith=<<__replaceWith__>>
flags=<<__flags__>>
wholeWords=<<__wholeWords__>> />"""
>
<$reveal type="nomatch" default="title" text=<<__field__>> >
<$action-setfield $tiddler=<<__tiddler__>> $field=<<__field__>> $value=<<result>>/>
</$reveal>
<$reveal type="match" default="title" text=<<__field__>> >
<$action-sendmessage $message="tm-rename-tiddler" from=<<__tiddler__>> to=<<result>> />
</$reveal>
</$wikify>
</$list>
</$list>
\end

View File

@ -0,0 +1,14 @@
caption: Snr
icon: $:/core/images/gitter
list-after: $:/plugins/kookma/commander/inspect/ui
tags: $:/tags/Commander
title: $:/plugins/kookma/commander/snr/ui
type: text/vnd.tiddlywiki
Search and replcae in tiddler fields!
<<tabs
tabsList:"[all[shadows+tiddlers]tag[$:/tags/Commander/SnrOps]!has[draft.of]]"
default:"$:/plugins/kookma/commander/snr/uicomp/replace-text"
class:"tc-vertical cmd-tab-colorful cmd-tab-wd">>

View File

@ -0,0 +1,16 @@
caption: Search and replace
icon: $:/core/images/gitter
tags: $:/tags/Commander/SnrOps
title: $:/plugins/kookma/commander/snr/uicomp/replace-text
type: text/vnd.tiddlywiki
<div class="cmd-snr-row">
<div class="cmd-snr-double-column">
<<snr-ui-inputs>>
</div>
<div class="cmd-snr-column">
<<snr-regexp-flags>>
</div>
</div>
<<snr-ui-show-diffs>>
<<snr-actions>>

View File

@ -0,0 +1,10 @@
.commander-alert {
padding: 0.75rem 1.25rem;
margin-bottom: 1rem;
border: 1px dotted gray;
border-radius: 0.25rem;
color: #0c5460;
background-color: #d1ecf1;
border-color: #bee5eb;
}

View File

@ -0,0 +1,3 @@
tags: $:/tags/Stylesheet
title: $:/plugins/kookma/commander/stylesheet/alert
type: text/css

View File

@ -0,0 +1,14 @@
/**
.cmd-btn{
font-size:0.85em;
font-size:300;
color: #666666;
background-color: #d8d8d8;
padding: 3px 8px 3px 8px;
border: 1px solid #a1a1a1;
}
**/
.cmd-btn-wd{
width:20ch;
}

View File

@ -0,0 +1,3 @@
tags: $:/tags/Stylesheet
title: $:/plugins/kookma/commander/stylesheet/buttons
type: text/css

View File

@ -0,0 +1,13 @@
/*compInspect table*/
.cmd-ci-table
{border-collapse: collapse;}
.cmd-ci-table .leftcol{
width:20%;
vertical-align: top;
text-align: right;
background-color:#f0f0f0;
}
.cmd-ci-table .rightcol{
width:650px;
}

View File

@ -0,0 +1,3 @@
tags: $:/tags/Stylesheet
title: $:/plugins/kookma/commander/stylesheet/compInspect/table
type: text/css

View File

@ -0,0 +1,26 @@
.kk-commander-log-note{
font-style:italic; font-size:small;
}
.kk-commander-log-item {
color:green;
}
/* This is missing and I added it */
.cmd-txt-area{
min-width:25ch;
}
.cmd-txt-area2{
min-width:50ch;
}
/* Correct this later*/
.kk-cmd-label{
display:inline-block;
width:85px;
}
.kk-cmd-label2{
display:inline-block;
width:120px;
}

View File

@ -0,0 +1,3 @@
tags: $:/tags/Stylesheet
title: $:/plugins/kookma/commander/stylesheet/new
type: text/css

View File

@ -0,0 +1,7 @@
.cmd-sl{
width:8ch;
}
.cmd-select-wd{
min-width:25ch;
}

View File

@ -0,0 +1,3 @@
tags: $:/tags/Stylesheet
title: $:/plugins/kookma/commander/stylesheet/select-width
type: text/css

View File

@ -0,0 +1,29 @@
.cmd-snr-row {
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: 100%;
}
.cmd-snr-column {
display: flex;
flex-direction: column;
flex-basis: 100%;
flex: 1
}
.cmd-snr-double-column {
display: flex;
flex-direction: column;
flex-basis: 100%;
flex: 2
}
@media screen and (min-width: 800px) {
.cmd-snr-column {
flex: 1
}
.cmd-snr-double-column {
flex: 2
}
}

View File

@ -0,0 +1,3 @@
tags: $:/tags/Stylesheet
title: $:/plugins/kookma/commander/stylesheet/snr/flexbox
type: text/css

View File

@ -0,0 +1,28 @@
.cmd-snr-form{
width:100%;
}
.cmd-snr-textbox {
width:100%;
box-sizing: border-box;
max-width:40ch;
}
.cmd-snr-form select, .cmd-snr-form input{
margin: 0.2rem;
}
.cmd-snr-form legend{
background: #f5f5f5;
padding: 3px 6px;
}
.cmd-snr-form { padding:20px; }
.cmd-snr-form .item { padding: 2px; margin:2px; }
.cmd-snr-form .item label { display:inline-block; width:100px; margin-left:5px; }
.cmd-snr-form .item input { display:inline-block; }
.cmd-snr-form .item select { display:inline-block; }
/* only for relink checkbox on renaming tiddler */
.cmd-snr-form .item-relink { padding: 2px; margin:2px; }

Some files were not shown because too many files have changed in this diff Show More