Add single feed generation script

This commit is contained in:
Lucidiot 2021-09-23 20:18:25 +02:00
parent f0570c11f8
commit 7d54e8e8dc
Signed by: lucidiot
GPG Key ID: 3358C1CA6906FB8D
1 changed files with 21 additions and 0 deletions

21
singlegen.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
[ -z "$DIR" ] && DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
id="$1"
shift
"$DIR/bin/xml2json" "$DIR/itsb.xml" \
| jq '
.itsb.section[].source |= [
arrays[]
| if .["@id"] == $id then . else
.feed |= [
(if type == "object" then [.] else . end)[]
| select(.["@id"] == $id)
]
| select(.feed | length > 0)
end
]' --arg id "$id" \
| "$DIR/bin/json2xml" \
| xsltproc "$DIR/xslt/feedgen.xsl" - \
| DIR="$DIR" bash -s -- "$@"