From e9bd47266207dbdcae055c865ca3af80918340b5 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 26 Jan 2020 12:00:02 +0530 Subject: add read time, post length, remove commit sha --- generate.sh | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/generate.sh b/generate.sh index 34ae4cb..7bbe3c1 100755 --- a/generate.sh +++ b/generate.sh @@ -7,11 +7,21 @@ title_wrapper() { echo "$1" | sed -E -e "s/\..+$//g" -e "s/_(.)/ \u\1/g" -e "s/^(.)/\u\1/g" } +read_time() { + minu="$(eva -f 1 $1/150 | xargs)" + echo "$minu" +} + +height() { + cm="$(eva -f 2 $1*18*0.0222 | xargs)" + echo "$cm" +} + link_wrapper() { # 1 - id # 2 - title # 3 - date - # 4 - commit hash + # 4 - read time echo -ne "
@@ -20,11 +30,12 @@ link_wrapper() { $2 - - +
+ $4 - - + + min +
" } @@ -50,6 +61,7 @@ echo " echo "

n

+

nerdypepper's μblog

" >> docs/index.html @@ -70,10 +82,16 @@ for f in $posts; do # generate posts html=$(lowdown "$file") - commit="$(git log -n1 --oneline "$file" | sed -e 's/\s.*$//g')" + stats=$(wc "$file") + words="$(echo $stats | awk '{print $2}')" + lines="$(echo $stats | awk '{print $1}')" + + r_time="$(read_time $words)" + height="$(height $lines)" + post_title=$(title_wrapper "$id") post_date=$(date -r "$file" "+%d/%m %Y") - post_link=$(link_wrapper "${id%.*}" "$post_title" "$post_date" "$commit") + post_link=$(link_wrapper "${id%.*}" "$post_title" "$post_date" "$r_time" "$height") echo -ne "$post_link" >> docs/index.html @@ -84,21 +102,22 @@ for f in $posts; do "./post.esh" \ file="$file" \ date="$post_date" \ - commit="$commit" \ - title="$post_title" + title="$post_title" \ + read_time="$r_time" \ + height="$height" done echo "
-- cgit v1.2.3