diff options
| Commit | 1fe3d39788cfb0a167ff562fa121c90ea3b445c7 (patch) | |
|---|---|---|
| Author | 2022-07-04 16:41:27 +0300 | |
| Committer | 2022-07-04 16:41:27 +0300 | |
| Files | 548480d4dbd98da7e1d06f1d9c339a871600af21 /make-descriptions.sh | |
| syndamia.com-1fe3d39788cfb0a167ff562fa121c90ea3b445c7.tar syndamia.com-1fe3d39788cfb0a167ff562fa121c90ea3b445c7.tar.gz syndamia.com-1fe3d39788cfb0a167ff562fa121c90ea3b445c7.zip | ||
| Parent | 287748bcd9d17462219699d01bb0d043812a9a8e (diff) | |
Reworked how HTML-editing scripts are handled
1 files changed, 0 insertions, 26 deletions
| -rwxr-xr-x | make-descriptions.sh | 26 |
diff --git a/make-descriptions.sh b/make-descriptions.sh deleted file mode 100755 index 49417f5..0000000 --- a/make-descriptions.sh +++ /dev/null @@ -1,26 +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 "p>any amount of characters</p" from current file - # remove the "p>" and "</p" from result - # make everything that starts with "<" blank - # take all lines that aren't blank - description=$(egrep -o "p>(.+)<\/p" $file | sed "s/p>\|<\/p//g" | sed "s/<.*//g" | grep .) - - # Get the first 200 characters only when it's longer than 200 characters - if [ ${#description} -gt 200 ]; then - description="${description::200}..." - fi - - # Escape all non-acceptable characters (thanks https://www.unix.com/302989284-post3.html) - description=$(echo $description | sed 's/[^a-zA-Z 0-9]/\\&/g') - - # Replace all "[DESCRIPTION]" text in current file with what we selected (inside description) - sed -i "s/\[DESCRIPTION\]/$description/g" $file -done |