Summary Files Commits Branches @commit @diff @stats
path: root / make-titles.sh
diff options
context:
space:
mode:
Commit1fe3d39788cfb0a167ff562fa121c90ea3b445c7 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-07-04 16:41:27 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-07-04 16:41:27 +0300
Files548480d4dbd98da7e1d06f1d9c339a871600af21 /make-titles.sh
syndamia.com-1fe3d39788cfb0a167ff562fa121c90ea3b445c7.tar
syndamia.com-1fe3d39788cfb0a167ff562fa121c90ea3b445c7.tar.gz
syndamia.com-1fe3d39788cfb0a167ff562fa121c90ea3b445c7.zip
Parent287748bcd9d17462219699d01bb0d043812a9a8e (diff)
Reworked how HTML-editing scripts are handled
1 files changed, 0 insertions, 19 deletions
-rwxr-xr-xmake-titles.sh19
diff --git a/make-titles.sh b/make-titles.sh
deleted file mode 100755
index bf739ff..0000000
--- a/make-titles.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-if [ -z "$1" ]; then
- echo First parameter must be a path
- exit
-fi
-
-# Loop through all HTML files in given directory
-for file in $(find "$1" -type f -name "*.html"); do
- # Get text that matches "h1>any amount of characters</h1" from current file
- # remove the "h1>" and "</h1" from result
- title=$(egrep -o "h1(.+)>(.+)<\/h1" $file | sed "s/h1[^>]\+>\|<\/h1//g")
-
- # Escape all non-acceptable characters (thanks https://www.unix.com/302989284-post3.html)
- title=$(echo $title | sed 's/[^a-zA-Z 0-9]/\\&/g')
-
- # Replace all "[TITLE]" text in current file with what we selected (inside title)
- sed -i "s/\[TITLE\]/$title/g" $file
-done