", "")
+
+ for (i = 1; i <= length(names); i++) {
+ if (index($0, names[i] "<") != 0)
+ substitute(i)
+ }
+
+ print
+}
diff --git a/generate-hooks/create-title.awk b/generate-hooks/create-title.awk
new file mode 100644
index 0000000..14d8ec6
--- /dev/null
+++ b/generate-hooks/create-title.awk
@@ -0,0 +1,7 @@
+/
.+/ {
+ # Takes everything between
and
in the first
+ #
occurence.
+ h = index($0, "
")
+ print substr($0, h, index($0, "
any amount of characters
" and "[^&]([^&]+)<\/p" $file | sed "s/p>\|<\/p//g;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
+awkloc="$(dirname "$0")/create-description.awk"
- # Escape all non-acceptable characters (thanks https://www.unix.com/302989284-post3.html)
- description=$(echo $description | sed 's/[^a-zA-Z 0-9]/\\&/g')
+# Loop through all HTML files in given directory
for file in $1; do
+ description=$(awk -f "$awkloc" $file)
# Replace all "[DESCRIPTION]" text in current file with what we selected (inside description)
sed -i "s/\[DESCRIPTION\]/$description/g" $file
diff --git a/generate-hooks/make-file-lists.sh b/generate-hooks/make-file-lists.sh
index e407e19..87d8e61 100755
--- a/generate-hooks/make-file-lists.sh
+++ b/generate-hooks/make-file-lists.sh
@@ -53,12 +53,8 @@ if [ -z "$1" ]; then
exit
fi
+awkloc="$(dirname "$0")/create-file-lists.awk"
+
for file in $1; do
- sed -i 's/&&nos$/
/g;
- s/^
&&fos$//g;
- s/^&&fs0$/<\/summary>
/g;
- s/^&&fs$/<\/tr>
/g;
- s/^&&nod<\/p>$/<\/tr><\/table>/g;
- s/^&&fod<\/p>$/<\/tr><\/table><\/details>/g' \
- "$file"
+ awk -f "$awkloc" $file > tmp && mv -f tmp $file
done
diff --git a/generate-hooks/make-flags.sh b/generate-hooks/make-flags.sh
index 69d8952..84adfaf 100755
--- a/generate-hooks/make-flags.sh
+++ b/generate-hooks/make-flags.sh
@@ -11,7 +11,8 @@ if [ -z "$1" ]; then
exit
fi
+awkloc="$(dirname "$0")/create-flags.awk"
+
for file in $1; do
- # Replaces "&&gb" with ""
- sed -i 's/&&gb//g' "$file"
+ awk -f "$awkloc" $file > tmp && mv -f tmp $file
done
diff --git a/generate-hooks/make-presentation.sh b/generate-hooks/make-presentation.sh
index dab3243..c27fba2 100755
--- a/generate-hooks/make-presentation.sh
+++ b/generate-hooks/make-presentation.sh
@@ -30,23 +30,8 @@ if [ -z "$1" ]; then
exit
fi
-presentation='
-
- '
-presentation=$(echo $presentation | sed 's/\//\\\//g')
+awkloc="$(dirname "$0")/create-presentation.awk"
-# Loop through all HTML files in given directory
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/
&¢ered<\/p>/
/g;s/
&&/centered<\/p>/<\/div>/g;
- s/
&&flexer<\/p>/
<\/div>/g;s/&&flexer/
<\/div>/g;
- s/
&&fow<\/p>/
/g;s/
&&/fow<\/p>/<\/div>/g;
- s/
&&fol<\/p>/
/g;s/
&&/fol<\/p>/<\/div>/g" \
- "$file"
+ awk -f "$awkloc" $file > tmp && mv -f tmp $file
done
diff --git a/generate-hooks/make-titles.sh b/generate-hooks/make-titles.sh
index 1c9ebef..4bb70b9 100755
--- a/generate-hooks/make-titles.sh
+++ b/generate-hooks/make-titles.sh
@@ -5,15 +5,12 @@ if [ -z "$1" ]; then
exit
fi
-# Loop through all HTML files in given directory
- # Get text that matches "h1>any amount of characters" and "(.+)<\/h1" $file | sed "s/h1[^>]\+>\|<\/h1//g")
+awkloc="$(dirname "$0")/create-title.awk"
- # Escape all non-acceptable characters (thanks https://www.unix.com/302989284-post3.html)
- title=$(echo $title | sed 's/[^a-zA-Z 0-9]/\\&/g')
+# Loop through all HTML files in given directory
for file in $1; do
+ title=$(awk -f "$awkloc" $file)
- # Replace all "[TITLE]" text in current file with what we selected (inside title)
+ # Replace all "[TITLE]" text in current file with title
sed -i "s/\[TITLE\]/$title/g" $file
done
--
cgit v1.3.1-26-gb76a