From d776c122257325e0cc06ed0fe1abdebfb7278f4d Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Sun, 15 Feb 2026 11:03:54 +0200 Subject: [PATCH] Refactor and enhance website update script: added automated `.org` to `.html` export and detailed upload process. --- tools/Update web site | 74 +++++++++++++++++++++++++++++++++++++++++++ tools/update web site | 11 ------- 2 files changed, 74 insertions(+), 11 deletions(-) create mode 100755 tools/Update web site delete mode 100755 tools/update web site 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 -- 2.20.1