From 58d81d1a6d4dd09a8f19d4c42ab45caae7db030d Mon Sep 17 00:00:00 2001
From: dvs1
Date: Sun, 19 Jan 2025 21:41:47 +1000
Subject: Use the wiki print button, filter the wiki HTML early, and use
cmark-gfm.
---
SuckItFos | 43 ++++++++++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 15 deletions(-)
(limited to 'SuckItFos')
diff --git a/SuckItFos b/SuckItFos
index 54fc376..b59f6b0 100755
--- a/SuckItFos
+++ b/SuckItFos
@@ -21,16 +21,34 @@ do
mkdir -p Foswiki/${base}/`dirname ${file}`
mkdir -p combined/$base
mkdir -p combined/${base}/`dirname ${file}`
- echo "Converting ${URL}/${base}/${file} -> Foswiki/${base}/${file}.md"
+ echo "Converting ${URL}/${base}/${file}?cover=print -> Foswiki/${base}/${file}.md"
# pandoc -f html -t markdown --self-contained ${URL}/${base}/${file} >Foswiki/${base}/${file}.md
# TODO - try curl, to see what is actually downloaded, and maybe not download unchanged pages. curl to .HTM
# 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.
- curl --silent --no-progress-meter ${URL}/${base}/${file} -o Foswiki/${base}/${file}.HTM
+ curl --silent --no-progress-meter ${URL}/${base}/${file}?cover=print -o Foswiki/${base}/${file}.HTM
+
+ cp Foswiki/${base}/${file}.HTM Foswiki/${base}/${file}.HTM_ORIGINAL
+ csplit -ks Foswiki/${base}/${file}.HTM '%
%' '/
/'
+ if [ -f xx00 ]; then
+ rm Foswiki/${base}/${file}.HTM
+ mv xx00 Foswiki/${base}/${file}.HTM
+ fi
+ sed -i -E Foswiki/${base}/${file}.HTM \
+ -e "s/rel='nofollow'//g" \
+ -e 's/rel="nofollow"//g' \
+ -e "s/target='_blank'//g" \
+ -e "s/class='foswiki[[:alpha:]]*'//g" \
+ -e 's/class="foswikiTopic"/class="FoswikiTopic"/g' \
+ -e 's/class="foswiki[[:alpha:]]*"//g' \
+ -e "s/style='.*;'//g"
+# -e "s/style='background-color: #.*;'//g" \
+# -e "s/style='font-size: .*;'//g"
+
pandoc -f html -t commonmark_x --self-contained Foswiki//${base}/${file}.HTM >Foswiki/${base}/${file}.md
- ln -frs Foswiki/${base}/${file}.md combined/${base}/${file}.md
cp Foswiki/${base}/${file}.md Foswiki/${base}/${file}.md_ORIGINAL
- csplit -ks Foswiki/${base}/${file}.md '%::: {.foswikiTopic}%' '/::: {.foswikiContentFooter}/'
+# csplit -ks Foswiki/${base}/${file}.md '%::: {.foswikiTopic}%' '/::: {.foswikiContentFooter}/'
+ csplit -ks Foswiki/${base}/${file}.md '%::: {.FoswikiTopic}%' '/::: {.patternInfo}/'
if [ -f xx00 ]; then
rm Foswiki/${base}/${file}.md
mv xx00 Foswiki/${base}/${file}.md
@@ -40,21 +58,16 @@ do
sed -i -E Foswiki/${base}/${file}.md \
-e 's/\$/\$dlr\$/g' \
-e 's/\{#.*\}//g' \
- -e 's/\{\.foswiki.*\}//g' \
- -e 's/\{\.foswiki.*//g' \
- -e 's/\{\.foswikiNewLink rel=“nofollow”\}//g' \
- -e 's/\{\.foswikiNewLink$//g' \
- -e 's/^\.foswiki.*\}//g' \
-e 's/\{\.pattern.*\}//g' \
-e 's/\{\.pattern.*//g' \
- -e 's/\{rel="nofollow"\}//g' \
- -e 's/^rel="nofollow"\}//g' \
- -e 's/rel=“nofollow”\}$//g' \
+ -e '/^/d' \
-e '/^:::/d'
- echo -e "****\n[Original page](${URL}/${base}/${file}) where you can edit it." >> Foswiki/${base}/${file}.md
+ echo -e "****\n[Original page](${URL}/${base}/${file}) where maybe you can edit it." >> Foswiki/${base}/${file}.md
-# pandoc -t html -f commonmark_x --self-contained Foswiki/${base}/${file}.md > Foswiki//${base}/${file}.htm
- cmark-gfm -t html -e footnotes -e table -e strikethrough Foswiki/${base}/${file}.md > Foswiki//${base}/${file}.body
+# pandoc -t html -f commonmark_x --self-contained Foswiki/${base}/${file}.md > Foswiki/${base}/${file}.htm
+# cmark-gfm -t html -e footnotes -e table -e strikethrough Foswiki/${base}/${file}.md > Foswiki/${base}/${file}.body
+# ln -frs Foswiki/${base}/${file}.body combined/${base}/${file}.body
+ ln -frs Foswiki/${base}/${file}.md combined/${base}/${file}.md
done
notYetAnotherWiki.lua
--
cgit v1.1