author | František Kučera <franta-hg@frantovo.cz> |
Sat, 27 Nov 2021 23:15:17 +0100 | |
branch | v_0 |
changeset 33 | a1024068410c |
parent 29 | 509cac0cf411 |
permissions | -rwxr-xr-x |
25
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
1 |
#!/bin/bash |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
2 |
|
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
3 |
# Relational pipes |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
4 |
# Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info) |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
5 |
# |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
6 |
# This program is free software: you can redistribute it and/or modify |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
7 |
# it under the terms of the GNU General Public License as published by |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
8 |
# the Free Software Foundation, version 3 of the License. |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
9 |
# |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
10 |
# This program is distributed in the hope that it will be useful, |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
13 |
# GNU General Public License for more details. |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
14 |
# |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
15 |
# You should have received a copy of the GNU General Public License |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
17 |
|
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
18 |
DIR="$(dirname $0)" |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
19 |
BASE="$(basename $0)" |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
20 |
XSL="$DIR/$BASE.xsl" |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
21 |
|
29
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
22 |
xsltParams=(); |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
23 |
|
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
24 |
while [[ $# -gt 0 ]]; do |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
25 |
argument="$1"; |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
26 |
case "$argument" in |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
27 |
"--title") xsltParams+=("--stringparam" "title" "$2"); shift; shift; ;; |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
28 |
"--css-appendix") xsltParams+=("--stringparam" "cssAppendix" "$2"); shift; shift; ;; |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
29 |
"--description") xsltParams+=("--stringparam" "description" "$2"); shift; shift; ;; |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
30 |
"--record-count-prefix") xsltParams+=("--stringparam" "recordCountPrefix" "$2"); shift; shift; ;; |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
31 |
"--record-count-suffix") xsltParams+=("--stringparam" "recordCountSuffix" "$2"); shift; shift; ;; |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
32 |
"--relation-name-prefix") xsltParams+=("--stringparam" "relationNamePrefix" "$2"); shift; shift; ;; |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
33 |
"--relation-name-suffix") xsltParams+=("--stringparam" "relationNameSuffix" "$2"); shift; shift; ;; |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
34 |
*) echo "Unknown option: $argument" >&2; exit 1; |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
35 |
esac |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
36 |
done |
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
37 |
|
25
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
38 |
if [[ -f "$XSL" ]]; then |
29
509cac0cf411
xslt: relpipe-out-xhtml: customizable strings and CSS
František Kučera <franta-hg@frantovo.cz>
parents:
25
diff
changeset
|
39 |
relpipe-out-xml | xsltproc "${xsltParams[@]}" "$XSL" - |
25
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
40 |
else |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
41 |
echo "unable to find XSLT template: $XSL" 1>&2 |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
42 |
exit 1; |
8e2d9b67b51c
xslt: a basic XSLT template for XHTML output + helper scripts
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
43 |
fi |