diff options
Diffstat (limited to '')
| -rwxr-xr-x | SuckItFos | 43 |
1 files changed, 28 insertions, 15 deletions
| @@ -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 | ||
| 58 | done | 71 | done |
| 59 | 72 | ||
| 60 | notYetAnotherWiki.lua | 73 | notYetAnotherWiki.lua |
