Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit23277fab3374caa00926be42ebaabacbb9e67fea (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-09-28 09:39:05 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-09-28 09:39:05 +0300
Files9e011f4a5fdcc0b92f41f7cd6dd33f3c0e1de14a
syndamia.com-23277fab3374caa00926be42ebaabacbb9e67fea.tar
syndamia.com-23277fab3374caa00926be42ebaabacbb9e67fea.tar.gz
syndamia.com-23277fab3374caa00926be42ebaabacbb9e67fea.zip
Parent64715a1132aab0bb8e2964db110da7c3b1336078 (diff)
[hooks] Slightly optimized sed patterns
2 files changed, 8 insertions, 13 deletions
-rwxr-xr-xgenerate-hooks/make-descriptions.sh2
-rwxr-xr-xgenerate-hooks/make-file-lists.sh19
diff --git a/generate-hooks/make-descriptions.sh b/generate-hooks/make-descriptions.sh
index 1a4ace4..8268019 100755
--- a/generate-hooks/make-descriptions.sh
+++ b/generate-hooks/make-descriptions.sh
@@ -11,7 +11,7 @@ for file in $(find "$1" -type f -name "*.html"); do
# 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 .)
+ description=$(egrep -o "p>[^&]([^&]+)<\/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
diff --git a/generate-hooks/make-file-lists.sh b/generate-hooks/make-file-lists.sh
index 33b5e48..a930e9d 100755
--- a/generate-hooks/make-file-lists.sh
+++ b/generate-hooks/make-file-lists.sh
@@ -54,16 +54,11 @@ if [ -z "$1" ]; then
fi
for file in $(find "$1" -type f -name "*.html"); do
- # Replaces "&&nos" with "<table class="file-list"><tr>"
- sed -i 's/&#38;&#38;nos$/<table class="file-list"><tr>/g' "$file"
- # Replaces "&&fos" with "<details class="file-wrapper"><summary>"
- sed -i 's/^<p>&#38;&#38;fos$/<details class="file-wrapper"><summary>/g' "$file"
- # Replaces "&&fs0" with "</summary><table class="file-list"><tr>"
- sed -i 's/^&#38;&#38;fs0$/<\/summary><table class="file-list"><tr>/g' "$file"
- # Replaces "&&fs" with "</tr><tr>"
- sed -i 's/^&#38;&#38;fs$/<\/tr><tr>/g' "$file"
- # Replaces "&&nod" with "</tr></table>"
- sed -i 's/^&#38;&#38;nod<\/p>$/<\/tr><\/table>/g' "$file"
- # Replaces "&&fod" with "</tr></table></details>"
- sed -i 's/^&#38;&#38;fod<\/p>$/<\/tr><\/table><\/details>/g' "$file"
+ sed -i 's/&#38;&#38;nos$/<table class="file-list"><tr>/g;
+ s/^<p>&#38;&#38;fos$/<details class="file-wrapper"><summary>/g;
+ s/^&#38;&#38;fs0$/<\/summary><table class="file-list"><tr>/g;
+ s/^&#38;&#38;fs$/<\/tr><tr>/g;
+ s/^&#38;&#38;nod<\/p>$/<\/tr><\/table>/g;
+ s/^&#38;&#38;fod<\/p>$/<\/tr><\/table><\/details>/g' \
+ "$file"
done