#! /usr/bin/env bash title_wrapper() { # remove extension # snake to title case 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 - read time echo -ne "
$3
$2 $4 min " } intro() { echo -ne "
Hi. Subscribe

I'm Akshay, I go by nerd or nerdypepper on the internet.

I am a compsci undergrad, Rust programmer and an enthusiastic Vimmer. I write open-source stuff to pass time. I also design fonts: scientifica, curie.

Send me a mail at nerdy@peppe.rs or a message at nerd@irc.rizon.net.

" } cat > ./docs/index.html << EOF peppe.rs

n

nerdypepper's μblog

EOF echo -ne "$(intro)" >> ./docs/index.html # posts posts=$(ls -t ./posts) mkdir -p docs/posts rm -rf "./docs/posts/" for f in $posts; do file="./posts/"$f id="${file##*/}" # ill name my posts just fine # generate posts 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") echo "[~] $post_title" post_date=$(date -r "$file" "+%d/%m — %Y") post_link=$(link_wrapper "${id%.*}" "$post_title" "$post_date" "$r_time" "$height") echo -ne "$post_link" >> docs/index.html id="${id%.*}" mkdir -p "docs/posts/$id" esh -s /bin/bash \ -o "docs/posts/$id/index.html" \ "./post.esh" \ file="$file" \ date="$post_date" \ title="$post_title" \ read_time="$r_time" \ height="$height" \ intro="$(intro)" done # generate rss feeds echo "generating RSS feeds ..." esh -s /bin/bash \ -o "./docs/index.xml" \ "rss.esh" cat >> ./docs/index.html << EOF
EOF