cd "$(dirname "$0")"/src/tags
if [[ $# -eq 0 ]]; then
cat <<EOF
new-tag - create new tags for WebCoso
Usage:
new-tag <tag>...
The <tag> will be created under
$(pwd)
EOF
exit 1
fi
shopt -s extglob
now="$(TZ=UTC date +'%F %T')"
langs="${LANGS:-en it}"
for tag in "$@"; do
tag="${tag%/}"
if [[ -d "$tag" ]]; then
>&2 echo "tag \"$tag\" already exists"
else
mkdir -p "$tag"
for lang in $langs; do
{
cat <<EOF
${tag//?/=}
$tag
${tag//?/=}
:CreationDate: $now
:feed:
[% PROCESS 'document-listing.tt' %]
EOF
} > "$tag/document.${lang}.rest.tt"
{
cat <<EOF
[% INCLUDE 'base-feed.tt' %]
EOF
} > "$tag/feed.${lang}.tt"
done
for f in document-listing.tt du2html.xsl fillFeed.xsl base-feed.tt; do
ln -s "${tag//+([^\/])/../..}"/../templates/"$f" "$tag/"
done
fi
done