use get_html_file_content while building index and RSS
This commit is contained in:
parent
b6f4e1e892
commit
c581392bd4
1 changed files with 6 additions and 5 deletions
11
bb.sh
11
bb.sh
|
@ -310,8 +310,10 @@ disqus_footer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Reads HTML file from stdin, prints its content to stdout
|
# 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() {
|
get_html_file_content() {
|
||||||
awk '/<!-- text begin -->/, /<!-- text end -->/{if (!/<!-- text begin -->/ && !/<!-- text end -->/) print}'
|
awk '/<!-- '$1' begin -->/, /<!-- '$2' end -->/{if (!/<!-- '$1' begin -->/ && !/<!-- '$2' end -->/) print}'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Edit an existing, published .html file while keeping its original timestamp
|
# 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
|
for i in $(ls -t *.html); do # sort by date, newest first
|
||||||
is_boilerplate_file "$i" && continue;
|
is_boilerplate_file "$i" && continue;
|
||||||
if [[ "$n" -ge "$number_of_index_articles" ]]; then break; fi
|
if [[ "$n" -ge "$number_of_index_articles" ]]; then break; fi
|
||||||
awk '/<!-- entry begin -->/, /<!-- entry end -->/' "$i" >> "$contentfile"
|
get_html_file_content 'entry' 'entry' <$1 >> "$contentfile"
|
||||||
echo -n "."
|
echo -n "."
|
||||||
n=$(( $n + 1 ))
|
n=$(( $n + 1 ))
|
||||||
done
|
done
|
||||||
|
@ -745,8 +747,7 @@ make_rss() {
|
||||||
echo '<item><title>' >> "$rssfile"
|
echo '<item><title>' >> "$rssfile"
|
||||||
echo "$(awk '/<h3><a class="ablack" href=".+">/, /<\/a><\/h3>/{if (!/<h3><a class="ablack" href=".+">/ && !/<\/a><\/h3>/) print}' $i)" >> "$rssfile"
|
echo "$(awk '/<h3><a class="ablack" href=".+">/, /<\/a><\/h3>/{if (!/<h3><a class="ablack" href=".+">/ && !/<\/a><\/h3>/) print}' $i)" >> "$rssfile"
|
||||||
echo '</title><description><![CDATA[' >> "$rssfile"
|
echo '</title><description><![CDATA[' >> "$rssfile"
|
||||||
echo "$(awk '/<!-- text begin -->/, /<!-- entry end -->/{if (!/<!-- text begin -->/ && !/<!-- entry end -->/) print}' $i)" >> "$rssfile"
|
echo "$(get_html_file_content 'text' 'entry' <$i)" >> "$rssfile"
|
||||||
|
|
||||||
echo "]]></description><link>$global_url/$i</link>" >> "$rssfile"
|
echo "]]></description><link>$global_url/$i</link>" >> "$rssfile"
|
||||||
echo "<guid>$global_url/$i</guid>" >> "$rssfile"
|
echo "<guid>$global_url/$i</guid>" >> "$rssfile"
|
||||||
echo "<dc:creator>$global_author</dc:creator>" >> "$rssfile"
|
echo "<dc:creator>$global_author</dc:creator>" >> "$rssfile"
|
||||||
|
@ -852,7 +853,7 @@ rebuild_all_entries() {
|
||||||
echo -n "."
|
echo -n "."
|
||||||
# Get the title and entry, and rebuild the html structure from scratch (divs, title, description...)
|
# Get the title and entry, and rebuild the html structure from scratch (divs, title, description...)
|
||||||
title="$(get_post_title "$i")"
|
title="$(get_post_title "$i")"
|
||||||
get_html_file_content <$i >> "$contentfile"
|
get_html_file_content 'text' 'text' <$i >> "$contentfile"
|
||||||
|
|
||||||
# Original post timestamp
|
# Original post timestamp
|
||||||
timestamp="$(LC_ALL=$date_locale date -r $i +"%a, %d %b %Y %H:%M:%S %z" )"
|
timestamp="$(LC_ALL=$date_locale date -r $i +"%a, %d %b %Y %H:%M:%S %z" )"
|
||||||
|
|
Loading…
Add table
Reference in a new issue