23 lines
524 B
Bash
Executable File
23 lines
524 B
Bash
Executable File
#!/bin/bash
|
|
[ -z "$DIR" ] && DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
|
|
id="$1"
|
|
shift
|
|
|
|
xsltproc "$DIR/xslt/itsb.xsl" "$DIR/itsb.xml" \
|
|
| "$DIR/bin/xml2json" \
|
|
| 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 -- "$@"
|