diff options
author | Wojtek Kosior <koszko@koszko.org> | 2021-08-14 10:07:28 +0200 |
---|---|---|
committer | Wojtek Kosior <koszko@koszko.org> | 2021-08-14 10:07:28 +0200 |
commit | 443bc095a72949adb4a007c9a19a43da7dd8843d (patch) | |
tree | 4b3e392057d8939961a3e707ae596cd85e6fa623 /process_html_file.sh | |
parent | ae1844f9ac935eb3c89314cd402b4ec2c3d0f537 (diff) | |
parent | 2fbab2f07d3cebde1fba0e801df4f3e9129e463b (diff) | |
download | browser-extension-443bc095a72949adb4a007c9a19a43da7dd8843d.tar.gz browser-extension-443bc095a72949adb4a007c9a19a43da7dd8843d.zip |
merge facility to install from Hydrilla
Diffstat (limited to 'process_html_file.sh')
-rwxr-xr-x | process_html_file.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/process_html_file.sh b/process_html_file.sh new file mode 100755 index 0000000..1ed0295 --- /dev/null +++ b/process_html_file.sh @@ -0,0 +1,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 + errcho "import loop on $FILE" + 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" |