#! /usr/bin/env nix-shell #! nix-shell -i bash -p eva pandoc esh INDEX_BLOG_LIMIT=2 INDEX_BLOG_COUNT=0 INDEX_ART_LIMIT=1 INDEX_ART_COUNT=0 source ./scripts.sh link_wrapper() { # 1 - id # 2 - title # 3 - date # 4 - read time echo -ne "
$3
$2 $4 min " } more_links() { # 1 - sub page cat << EOF More ⟶ EOF } recent_link() { # 1 - sub page cat << EOF Recent $1 EOF } art_block() { # 1 - filename # 2 - title # 3 - date echo -ne "
$3
$2 " } intro() { echo -ne "
Hi.
Subscribe Donate

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 nerdypepper@irc.rizon.net.

" } breadcrumbs() { # 1 - path cat << EOF Home / $1 EOF } n_logo() { cat << EOF

n

nerdypepper's μsings

EOF } # setup dirs posts=$(ls -t ./posts) rm -rf "./docs/posts/" mkdir -p docs/posts art=$(ls -t ./art) rm -rf "./docs/art/" mkdir -p docs/art cp -r ./art/* docs/art/ cat << EOF | tee ./docs/posts/index.html ./docs/index.html > /dev/null peppe.rs EOF # index echo echo "[+] INDEX" echo "$(n_logo)" >> ./docs/index.html for p in Posts Art; do cat << EOF | tee -a ./docs/${p,,}/index.html > /dev/null
$(breadcrumbs $p) EOF done cat << EOF >> ./docs/index.html
$(intro) $(recent_link "Posts") EOF # posts echo -ne "

Posts

" >> ./docs/posts/index.html echo echo "[+] 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/posts/index.html if [[ $INDEX_BLOG_COUNT -lt $INDEX_BLOG_LIMIT ]]; then echo -ne "$post_link" >> ./docs/index.html fi ((INDEX_BLOG_COUNT+=1)) id="${id%.*}" mkdir -p "docs/posts/$id" esh \ -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 echo "$(more_links posts)" >> ./docs/index.html echo "$(recent_link Art)" >> ./docs/index.html # art echo echo "[+] ART" esh \ -o "docs/art/index.html" \ art.esh for f in $art; do if [[ $INDEX_ART_COUNT -lt $INDEX_ART_LIMIT ]]; then file="./art/"$f id="${file##*/}" art_title=$(title_wrapper "$id") art_date=$(date -r "$file" "+%d/%m — %Y") art_post=$(art_block "$f" "$art_title" "$art_date") echo "[~] $art_title" echo -ne "$art_post" >> ./docs/index.html ((INDEX_ART_COUNT+=1)) fi done echo "$(more_links art)" >> ./docs/index.html # generate rss feeds echo echo "[+] Generating RSS feeds ..." esh \ -o "./docs/index.xml" \ "rss.esh" cat << EOF | tee -a ./docs/posts/index.html ./docs/index.html > /dev/null
EOF