cut on tag pages, too

This commit is contained in:
Alexey Shpakovsky 2014-03-01 23:01:47 +01:00 committed by Aleksei Shpakovskii
parent 52f974c606
commit eef08c1984

12
bb.sh
View File

@ -666,7 +666,7 @@ all_tags() {
echo "<ul>" >> "$contentfile" echo "<ul>" >> "$contentfile"
for i in $(ls $prefix_tags*.html); do for i in $(ls $prefix_tags*.html); do
echo -n "." echo -n "."
nposts="$(grep -c "^<\!-- entry begin -->$" $i)" nposts="$(grep -c "<\!-- text begin -->" $i)"
tagname="$(echo $i | cut -c $((${#prefix_tags}+1))- | sed 's/\.html//g')" tagname="$(echo $i | cut -c $((${#prefix_tags}+1))- | sed 's/\.html//g')"
echo "<li><a href="$i">$tagname</a> &mdash; $nposts $template_tags_posts</li>" >> "$contentfile" echo "<li><a href="$i">$tagname</a> &mdash; $nposts $template_tags_posts</li>" >> "$contentfile"
done done
@ -720,14 +720,18 @@ rebuild_index() {
rebuild_tags() { rebuild_tags() {
echo -n "Rebuilding tag pages " echo -n "Rebuilding tag pages "
n=0 n=0
rm $prefix_tags*.tmp.html &> /dev/null rm $prefix_tags*.html &> /dev/null
# First we will process all files and create temporal tag files # First we will process all files and create temporal tag files
# with just the content of the posts # with just the content of the posts
for i in $(ls -t *.html); do for i in $(ls -t *.html); do
is_boilerplate_file "$i" && continue; is_boilerplate_file "$i" && continue;
echo -n "." echo -n "."
tmpfile="$(mktemp tmp.XXX)" tmpfile="$(mktemp tmp.XXX)"
awk '/<!-- entry begin -->/, /<!-- entry end -->/' "$i" >> "$tmpfile" if [ "$cut_do" ]; then
get_html_file_content 'entry' 'entry' 'cut' <$i | awk '/'"$cut_line"'/ { print "<p class=\"readmore\"><a href=\"'$i'\">'"$template_read_more"'</a></p>" ; next } 1' >> "$tmpfile"
else
get_html_file_content 'entry' 'entry' <$i >> "$tmpfile"
fi
while read line; do while read line; do
if [[ "$line" = "<p>$template_tags_line_header"* ]]; then if [[ "$line" = "<p>$template_tags_line_header"* ]]; then
# 'split' tags by commas # 'split' tags by commas
@ -739,7 +743,7 @@ rebuild_tags() {
done done
done done
fi fi
done < "$tmpfile" done < "$i"
rm "$tmpfile" rm "$tmpfile"
done done
# Now generate the tag files with headers, footers, etc # Now generate the tag files with headers, footers, etc