главная|main page

состояние|status

блог|blog

файлы|files

программы|software

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Shpakovsky <alexey@shpakovsky.ru>2014-06-24 07:16:57 +0200
committerAlexey Shpakovsky <alexey@shpakovsky.ru>2014-06-24 07:16:57 +0200
commit4558f43f4a4bc543c4848b3c7c1049d0cbaf9b60 (patch)
tree40ba8e0841c22312320cbbc614ec08f6b80778bd
parenta52f2e6758ce35ec1a0be5107ccf89d7897acd9c (diff)
posts_with_tags() to list all posts referenced by several tag files
-rwxr-xr-xbb.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/bb.sh b/bb.sh
index f6ccd83..5a17e4a 100755
--- a/bb.sh
+++ b/bb.sh
@@ -776,6 +776,14 @@ tags_in_post() {
sed -n "/^<p>$template_tags_line_header/{s/^<p>$template_tags_line_header//;s/<[^>]*>//g;s/[ ,]\+/ /g;p}" $1
}
+# Finds all posts referenced in a number of tags.
+# Arguments are tags
+# Prints one line with space-separated tags to stdout
+posts_with_tags() {
+ tag_files="$(echo "$@" | sed "s/\S\+/tag_&.html/g")"
+ sed -n '/^<h3><a class="ablack" href="[^"]*">/{s/.*href="\([^"]*\)">.*/\1/;p}' $tag_files
+}
+
# Rebuilds tag_*.html files
# if no arguments given, rebuilds all of them
# if arguments given, they should have this format: