diff options
Diffstat (limited to 'SuckItPm')
-rwxr-xr-x | SuckItPm | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/SuckItPm b/SuckItPm deleted file mode 100755 index 6a30373..0000000 --- a/SuckItPm +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | URL="https://wiki.devuan.org" | ||
4 | |||
5 | filter=" | ||
6 | -not -name "*~" -a \ | ||
7 | -not -name ".flock" -a \ | ||
8 | -not -name ".htaccess" -a \ | ||
9 | -not -name ".lastmod" -a \ | ||
10 | -not -name ".pageindex" -a \ | ||
11 | " | ||
12 | |||
13 | pushd /opt/merged | ||
14 | |||
15 | find /opt/pmwiki/wiki.d ${filter} \ | ||
16 | -name "*.*" -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` | ||
20 | mkdir -p PmWiki/$base | ||
21 | mkdir -p combined/$base | ||
22 | echo "Converting ${URL}/?n=${base}.${file} -> PmWiki/${base}/${file}.md" | ||
23 | # pandoc -f html -t markdown --self-contained ${URL}/?n=${base}.${file} >PmWiki/${base}/${file}.md | ||
24 | # TODO - try curl, to see what is actually downloaded, and maybe not download unchanged pages. curl to .HTM | ||
25 | # 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. | ||
26 | curl --no-progress-meter ${URL}/?n=${base}.${file} -o PmWiki/${base}/${file}.HTM | ||
27 | pandoc -f html -t commonmark_x --self-contained PmWiki//${base}/${file}.HTM >PmWiki/${base}/${file}.md | ||
28 | ln -frs PmWiki/${base}/${file}.md combined/${base}/${file}.md | ||
29 | cp PmWiki/${base}/${file}.md PmWiki/${base}/${file}.md_ORIGINAL | ||
30 | |||
31 | # csplit -ks PmWiki/${base}/${file}.md '/trailstart/' '/trailend/' | ||
32 | csplit -ks PmWiki/${base}/${file}.md '%::: {#wikitext}%' | ||
33 | if [ -f xx00 ]; then | ||
34 | rm PmWiki/${base}/${file}.md | ||
35 | mv xx00 PmWiki/${base}/${file}.md | ||
36 | fi | ||
37 | |||
38 | # Attempt to clean things up, badly. | ||
39 | sed -i -E PmWiki/${base}/${file}.md \ | ||
40 | -e 's/\$/\$dlr\$/g' \ | ||
41 | -e 's/\{#.*\}//g' \ | ||
42 | -e '/\{\.wikilink\}/d' \ | ||
43 | -e '/\[Site$/d' \ | ||
44 | -e '/^:::/d' \ | ||
45 | -e '/^Page last modified on /d' \ | ||
46 | -e '/^\[\]/d' \ | ||
47 | -e 's/\{rel=".*\}//g' \ | ||
48 | -e 's/\{rel="nofollow"$//g' \ | ||
49 | -e 's/^rel="nofollow"\}//g' \ | ||
50 | -e 's/^target="_blank"\}//g' \ | ||
51 | -e 's/\{\.createlinktext.*\}//g' \ | ||
52 | -e 's/\{\.createlinktext$//g' \ | ||
53 | -e 's/\{\.createlink.*\}//g' \ | ||
54 | -e 's/\{\.createlink$//g' \ | ||
55 | -e 's/\{\.urllink.*\}//g' \ | ||
56 | -e 's/\{\.urllink$//g' | ||
57 | |||
58 | echo "<hr/><p><a href=\"${URL}/?n=${base}.${file}\">Original page</a> where you can edit it.</p>" >> PmWiki/${base}/${file}.md | ||
59 | done | ||
60 | |||
61 | notYetAnotherWiki.lua | ||
62 | |||
63 | popd | ||