blob: 2f58cbf413e35748c8693821798e0a2c3ef694e4 (
about) (
plain)
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
30
31
32
33
|
#!/bin/sh
# Copyright (C) 2021 Wojtek Kosior
# Redistribution terms are gathered in the `copyright' file.
# Call like:
# ./process_html_file.sh html/options.html
. ./shell_utils.sh
FILE="$1"
FILEKEY=$(sanitize "$FILE")
if [ "x$(map_get HTML_FILENAMES $FILEKEY)" = "xyes" ]; then
printf 'import loop on %s\n' "$FILE" >&2
exit 1
fi
map_set_export HTML_FILENAMES $FILEKEY yes
awk '\
!/^[\t\r ]*<IMPORT[\t\r ]+([^\t\r ]+)[\t\r ]+\/>[\t\r ]*$/{
print $0;
}
/^[\t\r ]*<IMPORT[\t\r ]+([^\t\r ]+)[\t\r ]+\/>[\t\r ]*$/{
indent = substr($0, 1, index($0, "<") - 1);
command = "./process_html_file.sh " $2;
while (command | getline) {
print indent $0;
}
if (close(command) != 0)
exit 1;
}' < "$FILE"
|