From: Svjatoslav Agejenko Date: Sun, 15 Feb 2026 09:03:54 +0000 (+0200) Subject: Refactor and enhance website update script: added automated `.org` to `.html` export... X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;ds=sidebyside;p=fifth.git Refactor and enhance website update script: added automated `.org` to `.html` export and detailed upload process. --- diff --git a/tools/Update web site b/tools/Update web site new file mode 100755 index 0000000..d7d5fd7 --- /dev/null +++ b/tools/Update web site @@ -0,0 +1,74 @@ +#!/bin/bash +cd "${0%/*}"; if [ "$1" != "T" ]; then gnome-terminal -- "$0" T; exit; fi; +cd .. + +# Function to export org to html using emacs in batch mode +export_org_to_html() { + local org_file=$1 + local dir=$(dirname "$org_file") + local base=$(basename "$org_file" .org) + ( + cd "$dir" || return 1 + local html_file="${base}.html" + if [ -f "$html_file" ]; then + rm -f "$html_file" + fi + echo "Exporting: $org_file → $dir/$html_file" + emacs --batch -l ~/.emacs --visit="${base}.org" --funcall=org-html-export-to-html --kill + if [ $? -eq 0 ]; then + echo "✓ Successfully exported $org_file" + else + echo "✗ Failed to export $org_file" + return 1 + fi + ) +} + +echo "🔍 Searching for .org files in doc/ ..." +echo "=======================================" + +mapfile -t ORG_FILES < <(find doc -type f -name "*.org" | sort) + +if [ ${#ORG_FILES[@]} -eq 0 ]; then + echo "❌ No .org files found!" + echo "" + echo "Press ENTER to close this window." + read + exit 1 +fi + +echo "Found ${#ORG_FILES[@]} .org file(s):" +printf '%s\n' "${ORG_FILES[@]}" +echo "=======================================" + +SUCCESS_COUNT=0 +FAILED_COUNT=0 + +for org_file in "${ORG_FILES[@]}"; do + export_org_to_html "$org_file" + if [ $? -eq 0 ]; then + ((SUCCESS_COUNT++)) + else + ((FAILED_COUNT++)) + fi +done + +echo "=======================================" +echo "📊 SUMMARY:" +echo " ✓ Successful: $SUCCESS_COUNT" +echo " ✗ Failed: $FAILED_COUNT" +echo " Total: $((SUCCESS_COUNT + FAILED_COUNT))" +echo "" + +echo "📤 Uploading to server..." +rsync -avz --delete -e 'ssh -p 10006' doc/ n0@www3.svjatoslav.eu:/mnt/big/projects/fifth/ + +if [ $? -eq 0 ]; then + echo "✓ Upload completed successfully!" +else + echo "✗ Upload failed!" +fi + +echo "" +echo "Press ENTER to close this window." +read diff --git a/tools/update web site b/tools/update web site deleted file mode 100755 index a4d0fd0..0000000 --- a/tools/update web site +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -cd "${0%/*}"; if [ "$1" != "T" ]; then gnome-terminal -- "$0" T; exit; fi; - -cd .. - -rsync -avz --delete -e 'ssh -p 10006' doc/ n0@www3.svjatoslav.eu:/mnt/big/projects/fifth/ - - -echo "" -echo "Press ENTER to close this window." -read