Revision 90896bcf
Added by koszko about 2 years ago
build.sh | ||
---|---|---|
3 | 3 |
# Copyright (C) 2021 Wojtek Kosior |
4 | 4 |
# Redistribution terms are gathered in the `copyright' file. |
5 | 5 |
|
6 |
ENDL=" |
|
7 |
" |
|
8 |
|
|
9 |
errcho() { |
|
10 |
echo "$@" >&2 |
|
11 |
} |
|
12 |
|
|
13 |
map_set_instr() { |
|
14 |
echo "$1__$2='$3'" |
|
15 |
} |
|
16 |
|
|
17 |
map_set() { |
|
18 |
eval "$(map_set_instr "$@")" |
|
19 |
} |
|
20 |
|
|
21 |
map_get() { |
|
22 |
eval "echo \"\$$1__$2\"" |
|
23 |
} |
|
24 |
|
|
25 |
map_del_instr() { |
|
26 |
echo "unset $1__$2" |
|
27 |
} |
|
28 |
|
|
29 |
map_del() { |
|
30 |
eval "$(map_del_instr "$@")" |
|
31 |
} |
|
32 |
|
|
33 |
sanitize() { |
|
34 |
echo "$1" | tr /.- _ |
|
35 |
} |
|
6 |
. ./shell_utils.sh |
|
36 | 7 |
|
37 | 8 |
handle_export_line() { |
38 | 9 |
if [ "x$1" = "xEXPORTS_START" ]; then |
... | ... | |
259 | 230 |
s^_CONTENTSCRIPTS_^$CONTENTSCRIPTS^" \ |
260 | 231 |
< manifest.json > $BUILDDIR/manifest.json |
261 | 232 |
|
262 |
sed "s^_POPUPSCRIPTS_^$POPUPSCRIPTS^" \ |
|
263 |
< html/display-panel.html > $BUILDDIR/html/display-panel.html |
|
233 |
./process_html_file.sh html/display-panel.html | |
|
234 |
sed "s^_POPUPSCRIPTS_^$POPUPSCRIPTS^" \ |
|
235 |
> $BUILDDIR/html/display-panel.html |
|
264 | 236 |
|
265 |
sed "s^_OPTIONSSCRIPTS_^$OPTIONSSCRIPTS^" \ |
|
266 |
< html/options.html > $BUILDDIR/html/options.html |
|
237 |
./process_html_file.sh html/options.html | |
|
238 |
sed "s^_OPTIONSSCRIPTS_^$OPTIONSSCRIPTS^" \ |
|
239 |
> $BUILDDIR/html/options.html |
|
267 | 240 |
|
268 | 241 |
for FILE in $SCRIPTS; do |
269 | 242 |
FILEKEY=$(sanitize "$FILE") |
copyright | ||
---|---|---|
6 | 6 |
Copyright: 2021 Wojtek Kosior <koszko@koszko.org> |
7 | 7 |
License: GPL-3+-javascript or Alicense-1.0 |
8 | 8 |
|
9 |
Files: re-generate_icons.sh build.sh
|
|
9 |
Files: *.sh
|
|
10 | 10 |
Copyright: 2021 Wojtek Kosior <koszko@koszko.org> |
11 | 11 |
2021 jahoti <jahoti@tilde.team> |
12 | 12 |
License: CC0 |
process_html_file.sh | ||
---|---|---|
1 |
#!/bin/sh |
|
2 |
|
|
3 |
# Copyright (C) 2021 Wojtek Kosior |
|
4 |
# Redistribution terms are gathered in the `copyright' file. |
|
5 |
|
|
6 |
# Call like: |
|
7 |
# ./process_html_file.sh html/options.html |
|
8 |
|
|
9 |
. ./shell_utils.sh |
|
10 |
|
|
11 |
FILE="$1" |
|
12 |
FILEKEY=$(sanitize "$FILE") |
|
13 |
|
|
14 |
if [ "x$(map_get HTML_FILENAMES $FILEKEY)" = "xyes" ]; then |
|
15 |
errcho "import loop on $FILE" |
|
16 |
exit 1 |
|
17 |
fi |
|
18 |
|
|
19 |
map_set_export HTML_FILENAMES $FILEKEY yes |
|
20 |
|
|
21 |
awk '\ |
|
22 |
!/^[\t\r ]*<IMPORT[\t\r ]+([^\t\r ]+)[\t\r ]+\/>[\t\r ]*$/{ |
|
23 |
print $0; |
|
24 |
} |
|
25 |
/^[\t\r ]*<IMPORT[\t\r ]+([^\t\r ]+)[\t\r ]+\/>[\t\r ]*$/{ |
|
26 |
indent = substr($0, 1, index($0, "<") - 1); |
|
27 |
command = "./process_html_file.sh " $2; |
|
28 |
while (command | getline) { |
|
29 |
print indent $0; |
|
30 |
} |
|
31 |
if (close(command) != 0) |
|
32 |
exit 1; |
|
33 |
}' < "$FILE" |
shell_utils.sh | ||
---|---|---|
1 |
# Copyright (C) 2021 Wojtek Kosior |
|
2 |
# Redistribution terms are gathered in the `copyright' file. |
|
3 |
|
|
4 |
# This file is meant to be sourced in sh. |
|
5 |
|
|
6 |
ENDL=" |
|
7 |
" |
|
8 |
|
|
9 |
errcho() { |
|
10 |
echo "$@" >&2 |
|
11 |
} |
|
12 |
|
|
13 |
map_set_instr() { |
|
14 |
echo "$1__$2='$3'" |
|
15 |
} |
|
16 |
|
|
17 |
map_set() { |
|
18 |
eval "$(map_set_instr "$@")" |
|
19 |
} |
|
20 |
|
|
21 |
map_set_export() { |
|
22 |
eval "export $(map_set_instr "$@")" |
|
23 |
} |
|
24 |
|
|
25 |
map_get() { |
|
26 |
eval "echo \"\$$1__$2\"" |
|
27 |
} |
|
28 |
|
|
29 |
map_del_instr() { |
|
30 |
echo "unset $1__$2" |
|
31 |
} |
|
32 |
|
|
33 |
map_del() { |
|
34 |
eval "$(map_del_instr "$@")" |
|
35 |
} |
|
36 |
|
|
37 |
sanitize() { |
|
38 |
echo "$1" | tr /.- _ |
|
39 |
} |
Also available in: Unified diff
enable modularization of html files