diff --git a/bb.sh b/bb.sh index 35d46d4..cffa105 100755 --- a/bb.sh +++ b/bb.sh @@ -310,10 +310,19 @@ 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") +# $1 where to start ("text" or "entry") +# $2 where to stop ("text" or "entry") +# $3 "cut" to remove text from to +# note that this does not remove comment itself, +# so you can see if text was cut or not get_html_file_content() { - awk '//, //{if (!// && !//) print}' + awk '//, //{ + if (!// && !//) print + if ("'$3'" == "cut" && //){ + if ("'$2'" == "text") exit # no need to read further + while (getline > 0 && !//) {} + } + }' } # Edit an existing, published .html file while keeping its original timestamp @@ -648,7 +657,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 - get_html_file_content 'entry' 'entry' <$1 >> "$contentfile" + get_html_file_content 'entry' 'entry' 'cut' <$i >> "$contentfile" echo -n "." n=$(( $n + 1 )) done @@ -747,7 +756,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 "$(get_html_file_content 'text' 'entry' <$i)" >> "$rssfile" + echo "$(get_html_file_content 'text' 'entry' 'cut' <$i)" >> "$rssfile" echo "]]>$global_url/$i" >> "$rssfile" echo "$global_url/$i" >> "$rssfile" echo "$global_author" >> "$rssfile"