diff options
Diffstat (limited to 'SuckItPm')
-rwxr-xr-x | SuckItPm | 58 |
1 files changed, 31 insertions, 27 deletions
@@ -19,30 +19,44 @@ do | |||
19 | file=`echo "${line}" | cut -d '.' -f 2` | 19 | file=`echo "${line}" | cut -d '.' -f 2` |
20 | mkdir -p PmWiki/$base | 20 | mkdir -p PmWiki/$base |
21 | mkdir -p combined/$base | 21 | mkdir -p combined/$base |
22 | echo "Converting ${URL}/?n=${base}.${file} -> PmWiki/${base}/${file}.md" | 22 | echo "Converting ${URL}/?n=${base}.${file}?action=print -> PmWiki/${base}/${file}.md" |
23 | # pandoc -f html -t markdown --self-contained ${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 | 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. | 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 | 26 | # curl --no-progress-meter ${URL}/?n=${base}.${file} -o PmWiki/${base}/${file}.HTM |
27 | 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=markdown -o PmWiki/${base}/${file}.MD |
28 | # pandoc -f html -t commonmark_x --self-contained PmWiki//${base}/${file}.HTM >PmWiki/${base}/${file}.md | 28 | curl --no-progress-meter ${URL}/?n=${base}.${file}?action=print -o PmWiki/${base}/${file}.HTM |
29 | pandoc -f markdown -t commonmark_x --self-contained PmWiki//${base}/${file}.MD >PmWiki/${base}/${file}.md | 29 | cp PmWiki/${base}/${file}.HTM PmWiki/${base}/${file}.HTM_ORIGINAL |
30 | ln -frs PmWiki/${base}/${file}.md combined/${base}/${file}.md | 30 | csplit -ks PmWiki/${base}/${file}.HTM '%<!--PageText-->%' '/<!--HTMLFooter-->/' |
31 | cp PmWiki/${base}/${file}.md PmWiki/${base}/${file}.md_ORIGINAL | ||
32 | |||
33 | csplit -ks PmWiki/${base}/${file}.md '%trailstart%' '/trailend/' | ||
34 | # csplit -ks PmWiki/${base}/${file}.md '%::: {#wikitext}%' '/::: {#wikifoot-links .footnav}/' | ||
35 | if [ -f xx00 ]; then | 31 | if [ -f xx00 ]; then |
36 | rm PmWiki/${base}/${file}.md | 32 | rm PmWiki/${base}/${file}.HTM |
37 | mv xx00 PmWiki/${base}/${file}.md | 33 | mv xx00 PmWiki/${base}/${file}.HTM |
38 | fi | 34 | fi |
35 | sed -i -E PmWiki/${base}/${file}.HTM \ | ||
36 | -e "s/rel='nofollow'//g" \ | ||
37 | -e "s/target='_blank'//g" \ | ||
38 | -e "s/class='createlink'//g" \ | ||
39 | -e "s/class='createlinktext'//g" \ | ||
40 | -e "s/class='escaped'//g" \ | ||
41 | -e "s/class='diffmarkup'//g" \ | ||
42 | -e "s/class='selflink'//g" \ | ||
43 | -e "s/class='urllink'//g" \ | ||
44 | -e "s/class='vspace'//g" \ | ||
45 | -e "s/class='wikilink'//g" \ | ||
46 | -e "s/style='.*;'//g" | ||
47 | # -e "s/class='.*'//g" \ | ||
48 | # -e "s/style='background-color: #.*;'//g" \ | ||
49 | # -e "s/style='font-size: .*;'//g" | ||
50 | |||
51 | pandoc -f html -t commonmark_x --self-contained PmWiki//${base}/${file}.HTM >PmWiki/${base}/${file}.md | ||
52 | # pandoc -f markdown -t commonmark_x --self-contained PmWiki//${base}/${file}.MD >PmWiki/${base}/${file}.md | ||
53 | cp PmWiki/${base}/${file}.md PmWiki/${base}/${file}.md_ORIGINAL | ||
39 | 54 | ||
40 | # Attempt to clean things up, badly. | 55 | # Attempt to clean things up, badly. |
41 | sed -i -E PmWiki/${base}/${file}.md \ | 56 | sed -i -E PmWiki/${base}/${file}.md \ |
42 | -e 's/\$/\$dlr\$/g' \ | 57 | -e 's/\$/\$dlr\$/g' \ |
43 | -e 's/\{#.*\}//g' \ | 58 | -e 's/\{#.*\}//g' \ |
44 | -e '/^:::/d' \ | 59 | -e '/^:::/d' \ |
45 | -e '/\{\.wikilink\}/d' \ | ||
46 | -e '/\[Site$/d' \ | 60 | -e '/\[Site$/d' \ |
47 | -e '/^Page last modified on /d' \ | 61 | -e '/^Page last modified on /d' \ |
48 | -e '/^\[\]/d' \ | 62 | -e '/^\[\]/d' \ |
@@ -52,22 +66,12 @@ do | |||
52 | -e "s/^\`\`\`//g" \ | 66 | -e "s/^\`\`\`//g" \ |
53 | -e "s/\`\{=html\}//g" | 67 | -e "s/\`\{=html\}//g" |
54 | 68 | ||
55 | # -e 's/\{rel=".*\}//g' \ | 69 | echo -e "****\n[Original page](${URL}/${base}/${file}) where maybe you can edit it." >> PmWiki/${base}/${file}.md |
56 | # -e 's/\{rel="nofollow"$//g' \ | ||
57 | # -e 's/^rel="nofollow"\}//g' \ | ||
58 | # -e 's/^target="_blank"\}//g' \ | ||
59 | # -e 's/\{\.createlinktext.*\}//g' \ | ||
60 | # -e 's/\{\.createlinktext$//g' \ | ||
61 | # -e 's/\{\.createlink.*\}//g' \ | ||
62 | # -e 's/\{\.createlink$//g' \ | ||
63 | # -e 's/\{\.urllink.*\}//g' \ | ||
64 | # -e 's/\{\.urllink$//g' | ||
65 | |||
66 | #echo "<hr/><p><a href=\"${URL}/?n=${base}.${file}\">Original page</a> where you can edit it.</p>" >> PmWiki/${base}/${file}.md | ||
67 | echo -e "****\n[Original page](${URL}/${base}/${file}) where you can edit it." >> PmWiki/${base}/${file}.md | ||
68 | 70 | ||
69 | # pandoc -t html -f commonmark_x --self-contained PmWiki/${base}/${file}.md > PmWiki//${base}/${file}.htm | 71 | # pandoc -t html -f commonmark_x --self-contained PmWiki/${base}/${file}.md > PmWiki/${base}/${file}.htm |
70 | cmark-gfm -t html -e footnotes -e table -e strikethrough PmWiki/${base}/${file}.md > PmWiki//${base}/${file}.body | 72 | # cmark-gfm -t html -e footnotes -e table -e strikethrough PmWiki/${base}/${file}.md > PmWiki/${base}/${file}.body |
73 | # ln -frs PmWiki/${base}/${file}.body combined/${base}/${file}.body | ||
74 | ln -frs PmWiki/${base}/${file}.md combined/${base}/${file}.md | ||
71 | done | 75 | done |
72 | 76 | ||
73 | notYetAnotherWiki.lua | 77 | notYetAnotherWiki.lua |