blob: 99aab550c5c6158c76668287ba26ad2046226324 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/sh -ex
srcdir="./en/visual"
categories="drawings photos logos renders"
index="index.md"
list_images() {
# $1 -- directory
find "$1" -type f \
| grep -E "(\.jpe?g)|(\.png)|(\.gif)"
}
append_image() {
# $1 -- directory
c_index="$1/$index"
while read -r i; do
i=$(basename "$i")
if ! (grep "$i" "$c_index"); then
printf "\n" >> "$c_index"
echo "" >> "$c_index"
fi
done
}
cd "$srcdir" || exit 1
for c in $categories;
do
list_images "$c" | append_image "$c"
done
|