aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInqiyad Sabr <sabr@ariamath.xyz>2025-11-19 03:31:53 +0600
committerInqiyad Sabr <sabr@ariamath.xyz>2025-11-19 03:31:53 +0600
commitac77835b94c60c1ba50ba5dd1e135d8e52789d8d (patch)
tree6e84c65d78babd6a1e861171417c76fb2a8d8b4f
parent1b1888ccdf1256957e5385e46987a662292252ad (diff)
Re-implementation of the capsule 2 xhtml site without copying the entire root
-rwxr-xr-xc2x22
1 files changed, 12 insertions, 10 deletions
diff --git a/c2x b/c2x
index 4ffcaf3..d05c8de 100755
--- a/c2x
+++ b/c2x
@@ -1,17 +1,19 @@
#!/bin/sh
# creates a $1_xhtml dir and that's your root
-rsync -r "./${1}/" "./${1}_xhtml/"
-cd "./${1}_xhtml" || exit
+cd "${1}" || exit
+capsule_dir="${PWD}"
+printf "Making required dirs..."
+for subdir in $(find * -type d); do
+ mkdir -p "../${1}_xhtml/${subdir}"
+done
+printf "done\n"
printf "Converting gmi->html..."
-for file in $(find ./* | grep ".gmi" | sed 's/.gmi//'); do
- g2x < "./${file}.gmi" > "./${file}.html"
- rm "./${file}.gmi"
+for file in $(find * | grep ".gmi" | sed 's/.gmi//'); do
+ ../g2x < "./${file}.gmi" > "../${1}_xhtml/${file}.html"
done
printf "done\n"
-# this down removes duplicate files
-# symlink them to the capsule root folder files
-printf "Fixing duplicates..."
-for file in $(find ./* -type f | grep -v ".html"); do
- ln -sf ../../"${1}"/${file} "./${file}"
+printf "Linking non gmi files..."
+for file in $(find * -type f | grep -v ".gmi"); do
+ ln -sf "${PWD}/${file}" "../${1}_xhtml/${file}"
done
printf "done\n"