diff options
Diffstat (limited to '')
| -rwxr-xr-x | SuckItPm | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/SuckItPm b/SuckItPm deleted file mode 100755 index 246f485..0000000 --- a/SuckItPm +++ /dev/null | |||
| @@ -1,72 +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/mergedWork | ||
| 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 | time=`date --rfc-3339=seconds -ur /opt/pmwiki/wiki.d/${base}.${file} | cut -d '+' -f 1` | ||
| 21 | mkdir -p PmWiki/$base | ||
| 22 | mkdir -p combined/$base | ||
| 23 | echo "Converting ${URL}/?n=${base}.${file}?action=print -> PmWiki/${base}/${file}.md" | ||
| 24 | echo -e "ogWiki=PmWiki\nogURL=${URL}\nogBase=${base}\nogFile=${file}\ntimestamp=${time}\n" > PmWiki/${base}/${file}.md.md | ||
| 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}?action=markdown -o PmWiki/${base}/${file}.MD | ||
| 27 | curl --no-progress-meter ${URL}/?n=${base}.${file}?action=print -o PmWiki/${base}/${file}.HTM | ||
| 28 | cp PmWiki/${base}/${file}.HTM PmWiki/${base}/${file}.HTM_ORIGINAL | ||
| 29 | csplit -ks PmWiki/${base}/${file}.HTM '%<!--PageText-->%' '/<!--HTMLFooter-->/' | ||
| 30 | if [ -f xx00 ]; then | ||
| 31 | rm PmWiki/${base}/${file}.HTM | ||
| 32 | mv xx00 PmWiki/${base}/${file}.HTM | ||
| 33 | fi | ||
| 34 | if [ -f xx01 ]; then | ||
| 35 | rm xx01 | ||
| 36 | fi | ||
| 37 | sed -i -E PmWiki/${base}/${file}.HTM \ | ||
| 38 | -e "s/rel='nofollow'//g" \ | ||
| 39 | -e "s/target='_blank'//g" \ | ||
| 40 | -e "s/class='categorylink'//g" \ | ||
| 41 | -e "s/class='createlink'//g" \ | ||
| 42 | -e "s/class='createlinktext'//g" \ | ||
| 43 | -e "s/class='escaped'//g" \ | ||
| 44 | -e "s/class='diffmarkup'//g" \ | ||
| 45 | -e "s/class='selflink'//g" \ | ||
| 46 | -e "s/class='urllink'//g" \ | ||
| 47 | -e "s/class='vspace'//g" \ | ||
| 48 | -e "s/class='wikilink'//g" \ | ||
| 49 | -e "s/style='.*;'//g" | ||
| 50 | |||
| 51 | # pandoc -f markdown -t commonmark_x --self-contained PmWiki//${base}/${file}.MD >PmWiki/${base}/${file}.md | ||
| 52 | pandoc -f html -t commonmark_x --self-contained PmWiki//${base}/${file}.HTM >PmWiki/${base}/${file}.md | ||
| 53 | cp PmWiki/${base}/${file}.md PmWiki/${base}/${file}.md_ORIGINAL | ||
| 54 | |||
| 55 | # Attempt to clean things up, badly. | ||
| 56 | sed -i -E PmWiki/${base}/${file}.md \ | ||
| 57 | -e 's/\$/\$dlr\$/g' \ | ||
| 58 | -e 's/\{#.*\}//g' \ | ||
| 59 | -e '/^:::/d' \ | ||
| 60 | # -e '/\[Site$/d' \ | ||
| 61 | # -e '/^\[\]/d' \ | ||
| 62 | # -e "s/\`<a id='trailstart'>\`\{=html\}\`<\/a>\`\{=html\}//g" \ | ||
| 63 | # -e "s/^\`<img /<img /g" \ | ||
| 64 | # -e "s/^\`\`\`\{=html\}//g" \ | ||
| 65 | # -e "s/^\`\`\`//g" \ | ||
| 66 | # -e "s/\`\{=html\}//g" | ||
| 67 | |||
| 68 | ln -frs PmWiki/${base}/${file}.md combined/${base}/${file}.md | ||
| 69 | ln -frs PmWiki/${base}/${file}.md.md combined/${base}/${file}.md.md | ||
| 70 | done | ||
| 71 | |||
| 72 | popd | ||
