mirror of
https://gitlab.com/octtspacc/OcttKB
synced 2025-06-06 00:29:12 +02:00
OcttKB Cross-Repo Sync (HTML to Raw)
This commit is contained in:
@ -6,55 +6,10 @@ set -x # Echo all commands
|
||||
TargetWiki="OcttKB"
|
||||
TargetRepo="OcttKB"
|
||||
|
||||
git clone --depth 1 "https://gitlab.com/octtspacc/$TargetRepo" "./Repo-$TargetRepo"
|
||||
cd "./Repo-$TargetRepo"
|
||||
rm -rf "./Wiki-$TargetWiki" || true
|
||||
git clone --depth 1 "https://gitlab.com/octtspacc/${TargetRepo}" "./Repo-${TargetRepo}"
|
||||
cd "./Repo-${TargetRepo}"
|
||||
rm -rf "./Wiki-${TargetWiki}" || true
|
||||
|
||||
tiddlywiki \
|
||||
--verbose \
|
||||
--load "../$TargetWiki.html" \
|
||||
--output "./Wiki-$TargetWiki" \
|
||||
--savewikifolder "./Wiki-$TargetWiki"
|
||||
sh ../WikiFileToFolder.sh "${TargetWiki}"
|
||||
|
||||
cd "./Wiki-$TargetWiki/tiddlers"
|
||||
|
||||
for Dir in Normal System
|
||||
do mkdir -vp "../${Dir}" "../${Dir}.tmp"
|
||||
done
|
||||
|
||||
mv \$__* ../System.tmp/ || true
|
||||
mv * ../Normal.tmp/ || true
|
||||
#mv .* ../Normal.tmp/ || true
|
||||
cd ..
|
||||
|
||||
# Note: if the hell happens again:
|
||||
# find -type f -name .tid -exec sh -c 'OldFile="{}"; Ext="$(echo "${OldFile}" | rev | cut -d"." -f1 | rev)"; NewFile="$(echo "${OldFile}" | sed -e "s|_|/|g" | rev | cut -d"." -f2- | rev)_.${Ext}"; mv "$OldFile" "$NewFile"; ' \;
|
||||
|
||||
for TypeDir in System Normal
|
||||
do
|
||||
cd "./${TypeDir}.tmp"
|
||||
for OldFile in *
|
||||
do
|
||||
#Ext="$(echo "${OldFile}" | rev | cut -d"." -f1 | rev)"
|
||||
#NewFile="$(echo "${OldFile}" | sed -e 's|_|/|g' | rev | cut -d"." -f2- | rev)_.${Ext}"
|
||||
NewPath="$(echo "${OldFile}" | sed -e 's|_|/|g')"
|
||||
NewName="$(basename "${NewPath}")"
|
||||
NewParent="$(echo "${NewPath}" | rev | cut -d"/" -f2- | rev)"
|
||||
{ [ "${NewPath}" = "${NewName}" ] && [ "${NewPath}" = "${NewParent}" ] ;} \
|
||||
&& NewFile="_${NewPath}" \
|
||||
|| NewFile="${NewParent}/_${NewName}"
|
||||
#[ "$(basename "${NewFile}") | cut -b1" = . ]
|
||||
mkdir -p "../${TypeDir}/${NewFile}"
|
||||
rm -rf "../${TypeDir}/${NewFile}"
|
||||
mv "./${OldFile}" "../${TypeDir}/${NewFile}"
|
||||
done
|
||||
cd ..
|
||||
done
|
||||
|
||||
mv ./System ./System.tmp/System
|
||||
mv ./System.tmp/System/\$ ./System
|
||||
mv ./System ./Normal ./tiddlers
|
||||
rm -rf ./System.tmp ./Normal.tmp
|
||||
|
||||
cd ..
|
||||
GitPush "OcttKB Cross-Repo Sync (HTML to Raw)"
|
||||
|
@ -1,6 +1,6 @@
|
||||
created: 20230611200714094
|
||||
creator: Octt
|
||||
modified: 20230611213201141
|
||||
modified: 20231220190816419
|
||||
modifier: Octt
|
||||
title: $:/OcttKB/Repo/GitLab.CrossRepoSync.sh
|
||||
type: text/plain
|
@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
set -e # Exit on any error
|
||||
set -x # Echo all commands
|
||||
TargetWiki="$1"
|
||||
|
||||
tiddlywiki \
|
||||
--verbose \
|
||||
--load "../${TargetWiki}.html" \
|
||||
--output "./Wiki-${TargetWiki}" \
|
||||
--savewikifolder "./Wiki-${TargetWiki}"
|
||||
|
||||
cd "./Wiki-${TargetWiki}/tiddlers"
|
||||
|
||||
for Dir in Normal System
|
||||
do mkdir -vp "../${Dir}" "../${Dir}.tmp"
|
||||
done
|
||||
|
||||
mv \$__* ../System.tmp/ || true
|
||||
mv * ../Normal.tmp/ || true
|
||||
cd ..
|
||||
|
||||
# Note: if the hell happens again, run:
|
||||
# find -type f -name .tid -exec sh -c 'OldFile="{}"; Ext="$(echo "${OldFile}" | rev | cut -d"." -f1 | rev)"; NewFile="$(echo "${OldFile}" | sed -e "s|_|/|g" | rev | cut -d"." -f2- | rev)_.${Ext}"; mv "${OldFile}" "${NewFile}"; ' \;
|
||||
|
||||
for TypeDir in System Normal
|
||||
do
|
||||
cd "./${TypeDir}.tmp"
|
||||
for OldFile in *
|
||||
do
|
||||
NewPath="$(echo "${OldFile}" | sed -e 's|_|/|g')"
|
||||
NewName="$(basename "${NewPath}")"
|
||||
NewParent="$(echo "${NewPath}" | rev | cut -d"/" -f2- | rev)"
|
||||
{ [ "${NewPath}" = "${NewName}" ] && [ "${NewPath}" = "${NewParent}" ] ;} \
|
||||
&& NewFile="_${NewPath}" \
|
||||
|| NewFile="${NewParent}/_${NewName}"
|
||||
mkdir -p "../${TypeDir}/${NewFile}"
|
||||
rm -rf "../${TypeDir}/${NewFile}"
|
||||
mv "./${OldFile}" "../${TypeDir}/${NewFile}"
|
||||
done
|
||||
cd ..
|
||||
done
|
||||
|
||||
mv ./System ./System.tmp/System
|
||||
mv ./System.tmp/System/\$ ./System
|
||||
mv ./System ./Normal ./tiddlers
|
||||
rm -rf ./System.tmp ./Normal.tmp
|
||||
|
||||
cd ..
|
@ -0,0 +1,6 @@
|
||||
created: 20231220185529849
|
||||
creator: Octt
|
||||
modified: 20231220191122279
|
||||
modifier: Octt
|
||||
title: $:/OcttKB/Repo/WikiFileToFolder.sh
|
||||
type: text/plain
|
@ -1,5 +1,5 @@
|
||||
created: 20231220005258685
|
||||
created: 20231220200755642
|
||||
current-tiddler: GettingStarted
|
||||
modified: 20231220005258685
|
||||
modified: 20231220200755642
|
||||
title: $:/HistoryList
|
||||
type: application/json
|
@ -1,6 +1,6 @@
|
||||
created: 20231219155706359
|
||||
created: 20231220200703107
|
||||
creator: Octt
|
||||
list:
|
||||
modified: 20231220004850449
|
||||
modified: 20231220200720061
|
||||
modifier: Octt
|
||||
title: $:/StoryList
|
@ -1,7 +1,7 @@
|
||||
created: 20220920140732083
|
||||
creator: Octt
|
||||
modified: 20231203235213426
|
||||
modified: 20231220184116843
|
||||
modifier: Octt
|
||||
title: $:/state/showeditpreview
|
||||
|
||||
yes
|
||||
no
|
@ -1,6 +1,6 @@
|
||||
created: 20220920092307479
|
||||
creator: Octt
|
||||
modified: 20231220004843615
|
||||
modified: 20231220200726244
|
||||
modifier: Octt
|
||||
title: $:/state/tab/sidebar--595412856
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
created: 20221108155618185
|
||||
creator: Octt
|
||||
modified: 20231107213421541
|
||||
modified: 20231220183958793
|
||||
modifier: Octt
|
||||
title: $:/state/tree/$:/Macros/
|
||||
|
||||
show
|
||||
hide
|
@ -1,6 +1,6 @@
|
||||
created: 20230219190716748
|
||||
creator: Octt
|
||||
modified: 20231103222548896
|
||||
modified: 20231220200723587
|
||||
modifier: Octt
|
||||
title: $:/state/tree/$:/OcttKB/Repo/
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
created: 20230111084703963
|
||||
creator: Octt
|
||||
modified: 20231105151708695
|
||||
modified: 20231220200724835
|
||||
modifier: Octt
|
||||
title: $:/state/tree/$:/OcttKB/
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
created: 20230108193801573
|
||||
creator: Octt
|
||||
modified: 20231107223043873
|
||||
modified: 20231220183957474
|
||||
modifier: Octt
|
||||
title: $:/state/tree/$:/Styles/
|
||||
|
||||
show
|
||||
hide
|
Reference in New Issue
Block a user