From c581392bd4d44c98cc9309560d14fdf7714aa33b Mon Sep 17 00:00:00 2001 From: Alexey Shpakovsky Date: Wed, 26 Feb 2014 22:21:51 +0100 Subject: [PATCH] use get_html_file_content while building index and RSS --- bb.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bb.sh b/bb.sh index 69b1828..35d46d4 100755 --- a/bb.sh +++ b/bb.sh @@ -310,8 +310,10 @@ disqus_footer() { } # Reads HTML file from stdin, prints its content to stdout +# $1 where to start ("text" or "entry") +# $2 where to stop ("text" or "entry") get_html_file_content() { - awk '//, //{if (!// && !//) print}' + awk '//, //{if (!// && !//) print}' } # Edit an existing, published .html file while keeping its original timestamp @@ -646,7 +648,7 @@ rebuild_index() { for i in $(ls -t *.html); do # sort by date, newest first is_boilerplate_file "$i" && continue; if [[ "$n" -ge "$number_of_index_articles" ]]; then break; fi - awk '//, //' "$i" >> "$contentfile" + get_html_file_content 'entry' 'entry' <$1 >> "$contentfile" echo -n "." n=$(( $n + 1 )) done @@ -745,8 +747,7 @@ make_rss() { echo '' >> "$rssfile" echo "$(awk '/<h3><a class="ablack" href=".+">/, /<\/a><\/h3>/{if (!/<h3><a class="ablack" href=".+">/ && !/<\/a><\/h3>/) print}' $i)" >> "$rssfile" echo '> "$rssfile" - echo "$(awk '//, //{if (!// && !//) print}' $i)" >> "$rssfile" - + echo "$(get_html_file_content 'text' 'entry' <$i)" >> "$rssfile" echo "]]>$global_url/$i" >> "$rssfile" echo "$global_url/$i" >> "$rssfile" echo "$global_author" >> "$rssfile" @@ -852,7 +853,7 @@ rebuild_all_entries() { echo -n "." # Get the title and entry, and rebuild the html structure from scratch (divs, title, description...) title="$(get_post_title "$i")" - get_html_file_content <$i >> "$contentfile" + get_html_file_content 'text' 'text' <$i >> "$contentfile" # Original post timestamp timestamp="$(LC_ALL=$date_locale date -r $i +"%a, %d %b %Y %H:%M:%S %z" )"