aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/SuckIt
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xSuckItFos43
-rwxr-xr-xSuckItPm58
2 files changed, 59 insertions, 42 deletions
diff --git a/SuckItFos b/SuckItFos
index 54fc376..b59f6b0 100755
--- a/SuckItFos
+++ b/SuckItFos
@@ -21,16 +21,34 @@ do
21 mkdir -p Foswiki/${base}/`dirname ${file}` 21 mkdir -p Foswiki/${base}/`dirname ${file}`
22 mkdir -p combined/$base 22 mkdir -p combined/$base
23 mkdir -p combined/${base}/`dirname ${file}` 23 mkdir -p combined/${base}/`dirname ${file}`
24 echo "Converting ${URL}/${base}/${file} -> Foswiki/${base}/${file}.md" 24 echo "Converting ${URL}/${base}/${file}?cover=print -> Foswiki/${base}/${file}.md"
25# pandoc -f html -t markdown --self-contained ${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 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. 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 28 curl --silent --no-progress-meter ${URL}/${base}/${file}?cover=print -o Foswiki/${base}/${file}.HTM
29
30 cp Foswiki/${base}/${file}.HTM Foswiki/${base}/${file}.HTM_ORIGINAL
31 csplit -ks Foswiki/${base}/${file}.HTM '%<div id="patternMainContents">%' '/<div class="foswikiAttachments foswikiFormStep" style="overflow:auto">/'
32 if [ -f xx00 ]; then
33 rm Foswiki/${base}/${file}.HTM
34 mv xx00 Foswiki/${base}/${file}.HTM
35 fi
36 sed -i -E Foswiki/${base}/${file}.HTM \
37 -e "s/rel='nofollow'//g" \
38 -e 's/rel="nofollow"//g' \
39 -e "s/target='_blank'//g" \
40 -e "s/class='foswiki[[:alpha:]]*'//g" \
41 -e 's/class="foswikiTopic"/class="FoswikiTopic"/g' \
42 -e 's/class="foswiki[[:alpha:]]*"//g' \
43 -e "s/style='.*;'//g"
44# -e "s/style='background-color: #.*;'//g" \
45# -e "s/style='font-size: .*;'//g"
46
29 pandoc -f html -t commonmark_x --self-contained Foswiki//${base}/${file}.HTM >Foswiki/${base}/${file}.md 47 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 48 cp Foswiki/${base}/${file}.md Foswiki/${base}/${file}.md_ORIGINAL
32 49
33 csplit -ks Foswiki/${base}/${file}.md '%::: {.foswikiTopic}%' '/::: {.foswikiContentFooter}/' 50# csplit -ks Foswiki/${base}/${file}.md '%::: {.foswikiTopic}%' '/::: {.foswikiContentFooter}/'
51 csplit -ks Foswiki/${base}/${file}.md '%::: {.FoswikiTopic}%' '/::: {.patternInfo}/'
34 if [ -f xx00 ]; then 52 if [ -f xx00 ]; then
35 rm Foswiki/${base}/${file}.md 53 rm Foswiki/${base}/${file}.md
36 mv xx00 Foswiki/${base}/${file}.md 54 mv xx00 Foswiki/${base}/${file}.md
@@ -40,21 +58,16 @@ do
40 sed -i -E Foswiki/${base}/${file}.md \ 58 sed -i -E Foswiki/${base}/${file}.md \
41 -e 's/\$/\$dlr\$/g' \ 59 -e 's/\$/\$dlr\$/g' \
42 -e 's/\{#.*\}//g' \ 60 -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' \ 61 -e 's/\{\.pattern.*\}//g' \
49 -e 's/\{\.pattern.*//g' \ 62 -e 's/\{\.pattern.*//g' \
50 -e 's/\{rel="nofollow"\}//g' \ 63 -e '/^<!-- -->/d' \
51 -e 's/^rel="nofollow"\}//g' \
52 -e 's/rel=“nofollow”\}$//g' \
53 -e '/^:::/d' 64 -e '/^:::/d'
54 echo -e "****\n[Original page](${URL}/${base}/${file}) where you can edit it." >> Foswiki/${base}/${file}.md 65 echo -e "****\n[Original page](${URL}/${base}/${file}) where maybe you can edit it." >> Foswiki/${base}/${file}.md
55 66
56# pandoc -t html -f commonmark_x --self-contained Foswiki/${base}/${file}.md > Foswiki//${base}/${file}.htm 67# pandoc -t html -f commonmark_x --self-contained Foswiki/${base}/${file}.md > Foswiki/${base}/${file}.htm
57 cmark-gfm -t html -e footnotes -e table -e strikethrough Foswiki/${base}/${file}.md > Foswiki//${base}/${file}.body 68# cmark-gfm -t html -e footnotes -e table -e strikethrough Foswiki/${base}/${file}.md > Foswiki/${base}/${file}.body
69# ln -frs Foswiki/${base}/${file}.body combined/${base}/${file}.body
70 ln -frs Foswiki/${base}/${file}.md combined/${base}/${file}.md
58done 71done
59 72
60notYetAnotherWiki.lua 73notYetAnotherWiki.lua
diff --git a/SuckItPm b/SuckItPm
index 64591c3..156ee9f 100755
--- a/SuckItPm
+++ b/SuckItPm
@@ -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
71done 75done
72 76
73notYetAnotherWiki.lua 77notYetAnotherWiki.lua