From 7d1d891d8fdec5f11d4f86ef7ff4bf8bf4ac0de0 Mon Sep 17 00:00:00 2001 From: dvs1 Date: Fri, 21 Feb 2025 17:53:48 +1000 Subject: Try to sort out user profiles and user content. They don't make it easy, or possible. --- SuckIt | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/SuckIt b/SuckIt index 57aa88b..0c45831 100755 --- a/SuckIt +++ b/SuckIt @@ -8,7 +8,10 @@ rm -fr Foswiki/* cp -r /opt/merged_EMPTY/Foswiki . rm -fr PmWiki/* cp -r /opt/merged_EMPTY/PmWiki . - +rm -fr unsorted +mkdir -p unsorted +rm -fr users +mkdir -p users filter=" -name _default -prune -o \ @@ -31,6 +34,23 @@ do echo "downloading ${URL}/${base}/${file}?cover=print" # 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}?cover=print -o Foswiki/${base}/${file}.HTM + # Attempt to separate user profiles from user content. Doesn't work when people turn their profiles into content. + if [[ "${base}" == "Main" ]]; then + dest="unsorted" + mkdir -p `dirname users/${file}` + sed -i -E Foswiki/${base}/${file}.HTM -e "s%UserForm%
%w users/${file}_fos.SED" + if [ -s users/${file}_fos.SED ]; then + dest="users" + else + rm users/${file}_fos.SED + rm -d `dirname users/${file}` 2>1 1>/dev/null + fi + mkdir -p `dirname ${dest}/${file}` + touch Foswiki/${base}/${file}.md + ln -sfr Foswiki/${base}/${file}.md ${dest}/${file}_fos.md + ln -sfr Foswiki/${base}/${file}.md.md ${dest}/${file}_fos.md.md + rm Foswiki/${base}/${file}.md + fi fi done @@ -56,6 +76,15 @@ do # curl --no-progress-meter ${URL}/?n=${base}.${file}?action=markdown -o PmWiki/${base}/${file}.MARKDOWN echo "downloading ${URL}/?n=${base}.${file}?action=print" curl --no-progress-meter ${URL}/?n=${base}.${file}?action=print -o PmWiki/${base}/${file}.HTM + # Seems there's no way to tell user profiles apart from user content. Unless I can find a list of users somewhere. Don't think there is one. + if [[ "${base}" == "Profiles" ]]; then + touch PmWiki/${base}/${file}.md + ln -sfr PmWiki/${base}/${file}.md unsorted/${file}_pm.md + ln -sfr PmWiki/${base}/${file}.md unsorted/${file}_pm.md.md + rm PmWiki/${base}/${file}.md + fi + +# TODO - groups are PmWiki/Onefang and PmWiki/Tiki # pandoc -f markdown -t commonmark_x --self-contained PmWiki//${base}/${file}.MD >PmWiki/${base}/${file}.md # pandoc -f html -t commonmark_x --self-contained PmWiki//${base}/${file}.HTM >PmWiki/${base}/${file}.md -- cgit v1.1