#!/bin/sh # html header header() { printf '%s' " composed

composed

" } #html footer footer() { printf '\t\t%s' "
" } # for every line of input # check if it contains "Link/mp3" # if it does, output it exclude() { while read -r line do case "$line" in *Link/mp3* ) printf '%s\n' "$line" ;; esac done } # for every line of input # strip "path": " from the start # string ", from the end strip() { while read -r line do nameandtail="${line##\"path\": \"Link/}" name="${nameandtail%%.txt\",}" printf '%s\n' "$name" | sed "s/SLASH/\//g" done } # for every line of input # append root to the start # format path and name as href pad() { while read -r line do link=https://"${line##*--}" date=${line##mp3--} date=${date%%--*} year=${date%%-*} month=${date#*-} month=${month%%-*} day=${date##*-} if [ $month -eq 1 ] then humonth=january elif [ $month -eq 2 ] then humonth=february elif [ $month -eq 3 ] then humonth=march elif [ $month -eq 4 ] then humonth=april elif [ $month -eq 5 ] then humonth=may elif [ $month -eq 6 ] then humonth=june elif [ $month -eq 7 ] then humonth=july elif [ $month -eq 8 ] then humonth=august elif [ $month -eq 9 ] then humonth=september elif [ $month -eq 10 ] then humonth=october elif [ $month -eq 11 ] then humonth=november elif [ $month -eq 12 ] then humonth=december else humonth=secret fi if [ $day -lt 10 ] then huday=${day#0} else huday=$day fi name=${line##mp3--$date--} name=${name%%--*} cover="https://kaa.neocities.org/Image/$name.png" lyrics="https://kaa.neocities.org/Lyrics/$name.txt" printf '\t\t\t%s\n' "

" printf '\t\t\t\t%s\n' "$year $humonth $huday" printf '\t\t\t%s\n' "

" printf '\t\t\t%s\n' "
" printf '\t\t\t\t%s\n' "" printf '\t\t\t\t%s\n' "" printf '\t\t\t\t\t%s\n' "" printf '\t\t\t\t%s\n' "" printf '\t\t\t\t%s\n' "

" while read -r line do if [ "$line" = '\n' ] then printf '\t\t\t\t\t%s\n' "
" else printf '\t\t\t\t\t%s\n' "$line" printf '\t\t\t\t\t%s\n' "
" fi done < Lyrics/$name.txt printf '\t\t\t\t%s\n' "

" printf '\t\t\t%s\n' "
" done } header exclude | strip | pad footer