главная|main page

состояние|status

блог|blog

файлы|files

программы|software

summaryrefslogtreecommitdiff
path: root/bb.sh
diff options
context:
space:
mode:
authorAlexey Shpakovsky <alexey@shpakovsky.ru>2014-02-26 21:04:36 +0100
committerAlexey Shpakovsky <alexey@shpakovsky.ru>2014-03-01 09:59:17 +0100
commitb6f4e1e8923d1a7f6c908c05afce7915684765dc (patch)
treec79a0e2cf336c1dd93d347aee3accefbc39bb7d5 /bb.sh
parentcec0baebf8e3ff66462f9f9c6b1be527b2edb265 (diff)
Move text and title extraction to separate functions
Diffstat (limited to 'bb.sh')
-rwxr-xr-xbb.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/bb.sh b/bb.sh
index 2659346..69b1828 100755
--- a/bb.sh
+++ b/bb.sh
@@ -309,6 +309,11 @@ disqus_footer() {
</script>'
}
+# Reads HTML file from stdin, prints its content to stdout
+get_html_file_content() {
+ awk '/<!-- text begin -->/, /<!-- text end -->/{if (!/<!-- text begin -->/ && !/<!-- text end -->/) print}'
+}
+
# Edit an existing, published .html file while keeping its original timestamp
# Please note that this function does not automatically republish anything, as
# it is usually called from 'main'.
@@ -847,7 +852,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")"
- awk '/<!-- text begin -->/, /<!-- text end -->/{if (!/<!-- text begin -->/ && !/<!-- text end -->/) print}' "$i" >> "$contentfile"
+ get_html_file_content <$i >> "$contentfile"
# Original post timestamp
timestamp="$(LC_ALL=$date_locale date -r $i +"%a, %d %b %Y %H:%M:%S %z" )"