aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/SuckItFos
diff options
context:
space:
mode:
Diffstat (limited to 'SuckItFos')
-rwxr-xr-xSuckItFos60
1 files changed, 0 insertions, 60 deletions
diff --git a/SuckItFos b/SuckItFos
deleted file mode 100755
index f21decc..0000000
--- a/SuckItFos
+++ /dev/null
@@ -1,60 +0,0 @@
1#!/bin/bash
2
3URL="https://fos.wiki.devuan.org"
4
5filter="
6 -name _default -prune -o \
7 -name _empty -prune -o \
8 -name System -prune -o \
9 -name Trash -prune -o \
10 -name TWiki -prune -o \
11"
12
13pushd /opt/merged
14
15find /opt/Foswiki/data ${filter} \
16-name "*.txt" -type f,l -printf "%P\n" | while read line
17do
18 base=`echo "${line}" | cut -d '/' -f 1`
19 file=`echo "${line}" | cut -d '/' -f 2- | rev | cut -b 5- | rev`
20 mkdir -p Foswiki/$base
21 mkdir -p Foswiki/${base}/`dirname ${file}`
22 mkdir -p combined/$base
23 mkdir -p combined/${base}/`dirname ${file}`
24 echo "Converting ${URL}/${base}/${file} -> Foswiki/${base}/${file}.md"
25# pandoc -f html -t markdown --self-contained ${URL}/${base}/${file} >Foswiki/${base}/${file}.md
26 # TODO - try curl, to see what is actually downloaded, and maybe not download unchanged pages. curl to .HTM
27 # 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.
28 curl --silent --no-progress-meter ${URL}/${base}/${file} -o Foswiki/${base}/${file}.HTM
29 pandoc -f html -t commonmark_x --self-contained Foswiki//${base}/${file}.HTM >Foswiki/${base}/${file}.md
30 ln -frs Foswiki/${base}/${file}.md combined/${base}/${file}.md
31 cp Foswiki/${base}/${file}.md Foswiki/${base}/${file}.md_ORIGINAL
32
33# csplit -ks Foswiki/${base}/${file}.md '%::: foswikiTopic%' '/::: foswikiContentFooter/'
34# if [ -f xx00 ]; then
35# rm Foswiki/${base}/${file}.md
36# mv xx00 Foswiki/${base}/${file}.md
37# fi
38
39 # Attempt to clean things up, badly.
40 sed -i -E Foswiki/${base}/${file}.md \
41 -e 's/\$/\$dlr\$/g' \
42 -e 's/\{#.*\}//g' \
43 -e 's/\{\.foswiki.*\}//g' \
44 -e 's/\{\.foswiki.*//g' \
45 -e 's/\{\.foswikiNewLink rel=“nofollow”\}//g' \
46 -e 's/\{\.foswikiNewLink$//g' \
47 -e 's/^\.foswiki.*\}//g' \
48 -e 's/\{\.pattern.*\}//g' \
49 -e 's/\{\.pattern.*//g' \
50 -e 's/\{rel="nofollow"\}//g' \
51 -e 's/^rel="nofollow"\}//g' \
52 -e 's/rel=“nofollow”\}$//g' \
53 -e '/^:::/d'
54
55 echo "<hr/><p><a href=\"${URL}/${base}/${file}\">Original page</a> where you can edit it.</p>" >> Foswiki/${base}/${file}.md
56done
57
58notYetAnotherWiki.lua
59
60popd