aboutsummaryrefslogtreecommitdiff
path: root/v2/src/bin/collection-for
diff options
context:
space:
mode:
Diffstat (limited to 'v2/src/bin/collection-for')
-rwxr-xr-xv2/src/bin/collection-for23
1 files changed, 12 insertions, 11 deletions
diff --git a/v2/src/bin/collection-for b/v2/src/bin/collection-for
index 87f1204..e46f345 100755
--- a/v2/src/bin/collection-for
+++ b/v2/src/bin/collection-for
@@ -71,16 +71,17 @@ eval "$(assert_arg "$FILE" 'FILE')"
lang="$(lang-for "$FILE")"
DIR="$(dirname "$FILE")"
-if [ "$DIR" = "$CONTENT_PREFIX/$lang" ]; then
- echo
+PAGE="${FILE%.*}.page"
+
+if [ -e "$PAGE" ]; then
+ exit 1
else
- NAME="$(basename "$DIR")"
- NTH="$(
- collections |
- xargs -I% coll2path "$lang" % |
- awk '{ print NR, substr($0, 1, length($0) - 1) }' |
- grep " $NAME$" |
- cut -d' ' -f1
- )"
- collections | awk -vNTH="$NTH" 'NR == NTH'
+ collections | awk -v l="$lang" -v pre="$CONTENT_PREFIX" -v dir="$DIR" '{
+ "coll2path " l " " $0 | getline coll_path
+ d = pre "/" l "/" coll_path
+ sub(/\/$/, "", d)
+ if (d == dir) {
+ print $0
+ }
+ }'
fi