diff options
Diffstat (limited to 'SuckItFos')
-rwxr-xr-x | SuckItFos | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/SuckItFos b/SuckItFos deleted file mode 100755 index dc65505..0000000 --- a/SuckItFos +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | URL="https://fos.wiki.devuan.org" | ||
4 | |||
5 | filter=" | ||
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 | |||
13 | pushd /opt/mergedWork | ||
14 | |||
15 | find /opt/Foswiki/data ${filter} \ | ||
16 | -name "*.txt" -type f,l -printf "%P\n" | while read line | ||
17 | do | ||
18 | base=`echo "${line}" | cut -d '/' -f 1` | ||
19 | file=`echo "${line}" | cut -d '/' -f 2- | rev | cut -b 5- | rev` | ||
20 | time=`date --rfc-3339=seconds -ur /opt/Foswiki/data/${base}/${file}.txt | cut -d '+' -f 1` | ||
21 | mkdir -p Foswiki/$base | ||
22 | mkdir -p Foswiki/${base}/`dirname ${file}` | ||
23 | mkdir -p combined/$base | ||
24 | mkdir -p combined/${base}/`dirname ${file}` | ||
25 | echo "Converting ${URL}/${base}/${file}?cover=print -> Foswiki/${base}/${file}.md" | ||
26 | echo -e "ogWiki=Foswiki\nogURL=${URL}\nogBase=${base}\nogFile=${file}\ntimestamp=${time}\n" > Foswiki/${base}/${file}.md.md | ||
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}?cover=print -o Foswiki/${base}/${file}.HTM | ||
29 | cp Foswiki/${base}/${file}.HTM Foswiki/${base}/${file}.HTM_ORIGINAL | ||
30 | csplit -ks Foswiki/${base}/${file}.HTM '%<div id="patternMainContents">%' '/<div class="foswikiAttachments foswikiFormStep" style="overflow:auto">/' | ||
31 | if [ -f xx00 ]; then | ||
32 | rm Foswiki/${base}/${file}.HTM | ||
33 | mv xx00 Foswiki/${base}/${file}.HTM | ||
34 | fi | ||
35 | sed -i -E Foswiki/${base}/${file}.HTM \ | ||
36 | -e "s/rel='nofollow'//g" \ | ||
37 | -e 's/rel="nofollow"//g' \ | ||
38 | -e "s/target='_blank'//g" \ | ||
39 | -e "s/class='foswiki[[:alpha:]]*'//g" \ | ||
40 | -e 's/class="foswikiTopic"/class="FoswikiTopic"/g' \ | ||
41 | -e 's/class="foswiki[[:alpha:]]*"//g' \ | ||
42 | -e "s/style='.*;'//g" | ||
43 | |||
44 | pandoc -f html -t commonmark_x --self-contained Foswiki//${base}/${file}.HTM >Foswiki/${base}/${file}.md | ||
45 | cp Foswiki/${base}/${file}.md Foswiki/${base}/${file}.md_ORIGINAL | ||
46 | |||
47 | csplit -ks Foswiki/${base}/${file}.md '%::: {.FoswikiTopic}%' '/::: {.patternInfo}/' | ||
48 | if [ -f xx00 ]; then | ||
49 | rm Foswiki/${base}/${file}.md | ||
50 | mv xx00 Foswiki/${base}/${file}.md | ||
51 | fi | ||
52 | if [ -f xx01 ]; then | ||
53 | rm xx01 | ||
54 | fi | ||
55 | |||
56 | # Attempt to clean things up, badly. | ||
57 | sed -i -E Foswiki/${base}/${file}.md \ | ||
58 | -e 's/\$/\$dlr\$/g' \ | ||
59 | -e 's/\{#.*\}//g' \ | ||
60 | -e '/^:::/d' \ | ||
61 | -e '/^<!-- -->/d' \ | ||
62 | # -e 's/\{\.pattern.*\}//g' \ | ||
63 | # -e 's/\{\.pattern.*//g' \ | ||
64 | |||
65 | ln -frs Foswiki/${base}/${file}.md combined/${base}/${file}.md | ||
66 | done | ||
67 | |||
68 | popd | ||