@@ 2,6 2,18 @@ function bliz_word_count
sed -n '/^%%%/,/^%%%/d;/^% /d;p' $blizfile | wc -w
end
+function bliz_paragraph_count
+ perl -00e '
+ $count = 0;
+ while (<>) {
+ if ($_ =~ /^[^%#=]/) {
+ $count++;
+ }
+ }
+ print $count;
+ ' $blizfile
+end
+
function bliz_hits
set -l database_path personal/hits.db
set -l safe_path (string escape --style=var -- $req_path)
@@ 13,12 25,18 @@ function bliz_hits
end
function gemlog_intro_meta
+ set -l paragraphs (bliz_paragraph_count)
set -l words (bliz_word_count)
set -l minutes (expr \( $words + 150 \) / 300)
set -l hits (bliz_hits)
set -l base (basename $blizfile)
set -l published (string match -r -- '^(?:[0-9]+-){2}[0-9]+' $base)
- echo "> $words words, about $minutes minutes to read at a reasonable 300 wpm."
+ echo -n "> $words words, $paragraphs paragraphs, about "
+ if test $minutes -gt 1
+ echo "$minutes minutes to read (300 wpm)."
+ else
+ echo "a minute to read."
+ end
echo "> First published on $published."
echo "> This article has been loaded $hits times."
end