From 4b9cddca7f0f75e321319c79e94b3af3ce37e5ef Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 10 Apr 2023 16:18:01 -0300 Subject: v2: to collection feed inside --- v2/src/bin/collection-for | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'v2/src/bin/collection-for') 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 -- cgit v1.2.3