From c58fcbfaa87274b7add52450816dfb478a354be9 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 28 Sep 2022 15:39:57 +0300 Subject: [hooks] Reworked generate hooks to use a string of all files to work on, rather than having to find it --- generate-hooks/make-descriptions.sh | 4 ++-- generate-hooks/make-file-lists.sh | 4 ++-- generate-hooks/make-flags.sh | 4 ++-- generate-hooks/make-presentation.sh | 4 ++-- generate-hooks/make-titles.sh | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'generate-hooks') diff --git a/generate-hooks/make-descriptions.sh b/generate-hooks/make-descriptions.sh index 8268019..1ea7a9f 100755 --- a/generate-hooks/make-descriptions.sh +++ b/generate-hooks/make-descriptions.sh @@ -1,12 +1,11 @@ #!/bin/bash if [ -z "$1" ]; then - echo First parameter must be a path + echo First parameter must be string with file paths 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" and "/g; s/^

&&fos$/

/g; s/^&&fs0$/<\/summary>/g; diff --git a/generate-hooks/make-flags.sh b/generate-hooks/make-flags.sh index 786671d..69d8952 100755 --- a/generate-hooks/make-flags.sh +++ b/generate-hooks/make-flags.sh @@ -7,11 +7,11 @@ # Great Britain - &&gb if [ -z "$1" ]; then - echo First parameter must be a path + echo First parameter must be string with file paths exit fi -for file in $(find "$1" -type f -name "*.html"); do +for file in $1; do # Replaces "&&gb" with "ENG" sed -i 's/&&gb/ENG/g' "$file" done diff --git a/generate-hooks/make-presentation.sh b/generate-hooks/make-presentation.sh index e219453..dab3243 100755 --- a/generate-hooks/make-presentation.sh +++ b/generate-hooks/make-presentation.sh @@ -26,7 +26,7 @@ # &&/fol Ends (the last started) fol. if [ -z "$1" ]; then - echo First parameter must be a path + echo First parameter must be string with file paths exit fi @@ -41,7 +41,7 @@ presentation=' presentation=$(echo $presentation | sed 's/\//\\\//g') # Loop through all HTML files in given directory -for file in $(find "$1" -type f -wholename "*talks/*.html"); do +for file in $(echo $1 | grep 'talks'); do sed -i "s/

&&presentation<\/p>/$presentation/g; s/

&&slide<\/p>/

/g;s/

&&/slide<\/p>/<\/div>/g; s/

&&centered<\/p>/

/g;s/

&&/centered<\/p>/<\/div>/g; diff --git a/generate-hooks/make-titles.sh b/generate-hooks/make-titles.sh index bf739ff..1c9ebef 100755 --- a/generate-hooks/make-titles.sh +++ b/generate-hooks/make-titles.sh @@ -1,18 +1,18 @@ #!/bin/bash if [ -z "$1" ]; then - echo First parameter must be a path + echo First parameter must be string with file paths 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" and "(.+)<\/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') +for file in $1; do # Replace all "[TITLE]" text in current file with what we selected (inside title) sed -i "s/\[TITLE\]/$title/g" $file -- cgit v1.3.1-26-gb76a