~sungo/nanoblogger

ref: d47e3d89ce00bf7fcae9c867a36cd0453e2643a5 nanoblogger/plugins/entry/category_links.sh -rw-r--r-- 884 bytes
d47e3d89 — sungo reformat the feed links 1 year, 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# NanoBlogger Category Links Plugin
# Entry Plugin to find related categories and generate links for them

if [ "$SHOW_CATLINKS" = 1 ]; then
	# Command to help filter order of categories
	: ${CATLINKS_FILTERCMD:=sort}
	>"$SCRATCH_FILE".cat_links
	entry_wcatids=`grep "$entry" "$NB_DATA_DIR/master.$NB_DBTYPE"`
	entry_catids="${entry_wcatids##*\>}"
	[ "$entry_wcatids" = "$entry_catids" ] &&
		entry_catids=
	for entry_catnum in ${entry_catids//\,/ }; do
		cat_title=`nb_print "$NB_DATA_DIR"/cat_"$entry_catnum.$NB_DBTYPE" 1`
		set_catlink cat_"$entry_catnum.$NB_DBTYPE"
		cat_index="$category_link"
		# following must fit on single line
		$CATLINKS_FILTERCMD  >> "$SCRATCH_FILE".cat_links <<-EOF
			<!-- $cat_title --><a href="${ARCHIVES_PATH}$cat_index">$cat_title</a>,
		EOF
	done
	NB_EntryCategories=$(< "$SCRATCH_FILE.cat_links")
	NB_EntryCategories="${NB_EntryCategories%%,}"
fi