aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/SuckIt
diff options
context:
space:
mode:
authordvs12025-02-26 20:08:29 +1000
committerdvs12025-02-26 20:08:29 +1000
commitbcf74340a276aee6aaf0d0b2d6b07b29e50f0b25 (patch)
treef025a338d75694af97ac5728ee978ffc79018fb3 /SuckIt
parentWrap the edit string at the bottom in a link. At least for PmWiki. (diff)
downloadnotYetAnotherWiki-bcf74340a276aee6aaf0d0b2d6b07b29e50f0b25.zip
notYetAnotherWiki-bcf74340a276aee6aaf0d0b2d6b07b29e50f0b25.tar.gz
notYetAnotherWiki-bcf74340a276aee6aaf0d0b2d6b07b29e50f0b25.tar.bz2
notYetAnotherWiki-bcf74340a276aee6aaf0d0b2d6b07b29e50f0b25.tar.xz
YAR - mostly theming and link conversion.
Includes the new "hide all but content" icon.
Diffstat (limited to 'SuckIt')
-rwxr-xr-xSuckIt67
1 files changed, 41 insertions, 26 deletions
diff --git a/SuckIt b/SuckIt
index d67844b..8950850 100755
--- a/SuckIt
+++ b/SuckIt
@@ -13,6 +13,10 @@ mkdir -p unsorted
13rm -fr users 13rm -fr users
14mkdir -p users 14mkdir -p users
15 15
16# Copy across things like images that where uploaded.
17mkdir -p /opt/nyaw/Foswiki/pub/
18# TODO - Should rsync this instead.
19cp -r /opt/Foswiki/pub/Main /opt/nyaw/Foswiki/pub/
16filter=" 20filter="
17 -name _default -prune -o \ 21 -name _default -prune -o \
18 -name _empty -prune -o \ 22 -name _empty -prune -o \
@@ -20,40 +24,46 @@ filter="
20 -name Trash -prune -o \ 24 -name Trash -prune -o \
21 -name TWiki -prune -o \ 25 -name TWiki -prune -o \
22" 26"
23URL="https://fos.wiki.devuan.org" 27ogURL="https://fos.wiki.devuan.org"
28ogWiki="Foswiki"
24time find /opt/Foswiki/data ${filter} \ 29time find /opt/Foswiki/data ${filter} \
25-name "*.txt" -type f,l -printf "%P\n" | while read line 30-name "*.txt" -type f,l -printf "%P\n" | while read line
26do 31do
27 base=`echo "${line}" | cut -d '/' -f 1` 32 base=`echo "${line}" | cut -d '/' -f 1`
28 file=`echo "${line}" | cut -d '/' -f 2- | rev | cut -b 5- | rev` 33 file=`echo "${line}" | cut -d '/' -f 2- | rev | cut -b 5- | rev`
29 if [[ ! $file =~ (AdminGroup|AdminUser|AdminUserLeftBar|EditorGroup|GroupTemplate|GroupViewTemplate|NobodyGroup|PatternSkinUserViewTemplate|ProjectContributor|RegistrationAgent|SitePreferences|UnprocessedRegistrations|UnprocessedRegistrationsLog|UserHomepageHeader|UserList|UserListByDateJoined|UserListByLocation|UserList|UserListHeader|WebAtom|WebChanges|WebCreateNewTopic|WebHome|WebIndex|WebLeftBar|WebLeftBarExample|WebNotify|WebPreferences|WebRss|WebSearch|WebSearchAdvanced|WebTopicList|WikiGroups|WikiUsers)$ ]]; then 34 if [[ ! ${file} =~ (AdminGroup|AdminUser|AdminUserLeftBar|CommentPluginExamples|EditorGroup|GroupTemplate|GroupViewTemplate|NobodyGroup|PatternSkinUserViewTemplate|ProjectContributor|RegistrationAgent|SitePreferences|UnprocessedRegistrations|UnprocessedRegistrationsLog|UserHomepageHeader|UserList|UserListByDateJoined|UserListByLocation|UserList|UserListHeader|WebAtom|WebChanges|WebCreateNewTopic|WebHome|WebIndex|WebLeftBar|WebLeftBarExample|WebNotify|WebPreferences|WebRss|WebSearch|WebSearchAdvanced|WebTopicList|WikiGroups|WikiUsers)$ ]]; then
35 realURL=${ogWiki}/${base}/${file}
30 time=`date --rfc-3339=seconds -ur /opt/Foswiki/data/${base}/${file}.txt | cut -d '+' -f 1` 36 time=`date --rfc-3339=seconds -ur /opt/Foswiki/data/${base}/${file}.txt | cut -d '+' -f 1`
31 mkdir -p Foswiki/$base 37 mkdir -p ${ogWiki}/${base}
32 mkdir -p Foswiki/${base}/`dirname ${file}` 38 mkdir -p ${ogWiki}/${base}/`dirname ${file}`
33 echo -e "ogWiki=Foswiki\nogURL=${URL}\nogBase=${base}\nogFile=${file}\ntimestamp=${time}\n" > Foswiki/${base}/${file}.md.md 39 echo -e "ogWiki=${ogWiki}\nogURL=${ogURL}\nrealURL=${realURL}\nogBase=${base}\nogFile=${file}\ntimestamp=${time}\n" > ${ogWiki}/${base}/${file}.md.md
34 echo "downloading ${URL}/${base}/${file}?cover=print" 40 echo "downloading ${ogURL}/${base}/${file}?cover=print"
35 # Doesn't help with redownloads, coz natch a dynamic site isn't cached. But I can at least comment out the curl command during testing to save time. 41 # Doesn't help with redownloads, coz natch a dynamic site isn't cached. But I can at least comment out the curl command during testing to save time.
36 curl --silent --no-progress-meter ${URL}/${base}/${file}?cover=print -o Foswiki/${base}/${file}.HTM 42 curl --silent --no-progress-meter ${ogURL}/${base}/${file}?cover=print -o ${ogWiki}/${base}/${file}.HTM
37 # Attempt to separate user profiles from user content. Doesn't work when people turn their profiles into content. 43 # Attempt to separate user profiles from user content. Doesn't work when people turn their profiles into content.
38 if [[ "${base}" == "Main" ]]; then 44 if [[ "${base}" == "Main" ]]; then
39 dest="unsorted" 45 dest="unsorted"
40 mkdir -p `dirname users/${file}` 46 mkdir -p `dirname users/${file}`
41 sed -i -E Foswiki/${base}/${file}.HTM -e "s%<a href=\"/System/UserForm\">UserForm</a>%%w users/${file}_fos.SED" 47 sed -i -E ${ogWiki}/${base}/${file}.HTM -e "s%<a href=\"/System/UserForm\">UserForm</a>%%w users/${file}_fos.SED"
42 if [ -s users/${file}_fos.SED ]; then 48 if [ -s users/${file}_fos.SED ]; then
43 dest="users" 49 dest="users"
44 fi 50 fi
45 rm users/${file}_fos.SED 51 rm users/${file}_fos.SED
46 rm -d `dirname users/${file}` >/dev/null 2>&1 52 rm -d `dirname users/${file}` >/dev/null 2>&1
47 mkdir -p `dirname ${dest}/${file}` 53 mkdir -p `dirname ${dest}/${file}`
48 touch Foswiki/${base}/${file}.md 54 realURL=${dest}/${file}
49 ln -sfr Foswiki/${base}/${file}.md ${dest}/${file}_fos.md 55 echo -e "ogWiki=${ogWiki}\nogURL=${ogURL}\nrealURL=${realURL}_fos\nogBase=${base}\nogFile=${file}\ntimestamp=${time}\n" > ${ogWiki}/${base}/${file}.md.md
50 ln -sfr Foswiki/${base}/${file}.md.md ${dest}/${file}_fos.md.md 56 touch ${ogWiki}/${base}/${file}.md
51 rm Foswiki/${base}/${file}.md 57 ln -sfr ${ogWiki}/${base}/${file}.md ${dest}/${file}_fos.md
58 ln -sfr ${ogWiki}/${base}/${file}.md.md ${dest}/${file}_fos.md.md
59 rm ${ogWiki}/${base}/${file}.md
52 fi 60 fi
53 fi 61 fi
54done 62done
55 63
56 64
65# Copy across things like images that where uploaded.
66cp -r /opt/pmwiki/uploads /opt/nyaw/PmWiki/
57filter=" 67filter="
58 -not -name "*~" -a \ 68 -not -name "*~" -a \
59 -not -name ".flock" -a \ 69 -not -name ".flock" -a \
@@ -61,32 +71,37 @@ filter="
61 -not -name ".lastmod" -a \ 71 -not -name ".lastmod" -a \
62 -not -name ".pageindex" -a \ 72 -not -name ".pageindex" -a \
63" 73"
64URL="https://wiki.devuan.org" 74ogURL="https://wiki.devuan.org"
75ogWiki="PmWiki"
65time find /opt/pmwiki/wiki.d ${filter} \ 76time find /opt/pmwiki/wiki.d ${filter} \
66-name "*.*" -type f,l -printf "%P\n" | while read line 77-name "*.*" -type f,l -printf "%P\n" | while read line
67do 78do
68 base=`echo "${line}" | cut -d '.' -f 1` 79 base=`echo "${line}" | cut -d '.' -f 1`
80 file=`echo "${line}" | cut -d '.' -f 2`
69 if [[ "${base}" != "Site" ]]; then 81 if [[ "${base}" != "Site" ]]; then
70 file=`echo "${line}" | cut -d '.' -f 2` 82 realURL=${ogWiki}/${base}/${file}
71 time=`date --rfc-3339=seconds -ur /opt/pmwiki/wiki.d/${base}.${file} | cut -d '+' -f 1` 83 time=`date --rfc-3339=seconds -ur /opt/pmwiki/wiki.d/${base}.${file} | cut -d '+' -f 1`
72 mkdir -p PmWiki/$base 84 mkdir -p ${ogWiki}/${base}
73 echo -e "ogWiki=PmWiki\nogURL=${URL}\nogBase=${base}\nogFile=${file}\ntimestamp=${time}\n" > PmWiki/${base}/${file}.md.md 85 echo -e "ogWiki=${ogWiki}\nogURL=${ogURL}\nrealURL=${realURL}\nogBase=${base}\nogFile=${file}\ntimestamp=${time}\n" > ${ogWiki}/${base}/${file}.md.md
74# echo "downloading ${URL}/?n=${base}.${file}?action=markdown" 86# echo "downloading ${ogURL}/?n=${base}.${file}?action=markdown"
75# curl --no-progress-meter ${URL}/?n=${base}.${file}?action=markdown -o PmWiki/${base}/${file}.MARKDOWN 87# curl --no-progress-meter ${ogURL}/?n=${base}.${file}?action=markdown -o ${ogWiki}/${base}/${file}.MARKDOWN
76 echo "downloading ${URL}/?n=${base}.${file}?action=print" 88 echo "downloading ${ogURL}/?n=${base}.${file}?action=print"
77 curl --no-progress-meter ${URL}/?n=${base}.${file}?action=print -o PmWiki/${base}/${file}.HTM 89 curl --no-progress-meter ${ogURL}/?n=${base}.${file}?action=print -o ${ogWiki}/${base}/${file}.HTM
78 # Seems there's no way to tell user profiles apart from user content. Unless I can find a list of users somewhere. Don't think there is one. 90 # Seems there's no way to tell user profiles apart from user content. Unless I can find a list of users somewhere. Don't think there is one.
79 if [[ "${base}" == "Profiles" ]]; then 91 if [[ "${base}" == "Profiles" ]]; then
80 touch PmWiki/${base}/${file}.md 92 dest="unsorted"
81 ln -sfr PmWiki/${base}/${file}.md unsorted/${file}_pm.md 93 realURL=${dest}/${file}
82 ln -sfr PmWiki/${base}/${file}.md.md unsorted/${file}_pm.md.md 94 echo -e "ogWiki=${ogWiki}\nogURL=${ogURL}\nrealURL=${realURL}_pm\nogBase=${base}\nogFile=${file}\ntimestamp=${time}\n" > ${ogWiki}/${base}/${file}.md.md
83 rm PmWiki/${base}/${file}.md 95 touch ${ogWiki}/${base}/${file}.md
96 ln -sfr ${ogWiki}/${base}/${file}.md ${dest}/${file}_pm.md
97 ln -sfr ${ogWiki}/${base}/${file}.md.md ${dest}/${file}_pm.md.md
98 rm ${ogWiki}/${base}/${file}.md
84 fi 99 fi
85 100
86# TODO - groups are PmWiki/Onefang and PmWiki/Tiki 101# TODO - groups are PmWiki/Onefang and PmWiki/Tiki
87 102
88# pandoc -f markdown -t commonmark_x --self-contained PmWiki//${base}/${file}.MD >PmWiki/${base}/${file}.md 103# pandoc -f markdown -t commonmark_x --self-contained ${ogWiki}//${base}/${file}.MD >${ogWiki}/${base}/${file}.md
89# pandoc -f html -t commonmark_x --self-contained PmWiki//${base}/${file}.HTM >PmWiki/${base}/${file}.md 104# pandoc -f html -t commonmark_x --self-contained ${ogWiki}//${base}/${file}.HTM >${ogWiki}/${base}/${file}.md
90 fi 105 fi
91done 106done
92 107