#!/bin/sh
count=0
# html header
header()
{
printf '%s' "
drawn
drawn
"
}
#html footer
footer()
{
printf '\t\t%s' "
"
}
# for every line of input
# check if it contains "line"
# if it does, output it
exclude()
{
while read -r line
do
case "$line" in
*"Image/"*"202"*"--"* )
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\": \"}"
name="${nameandtail%%\",}"
printf '%s\n' "$name"
done
}
# for every line of input
# append root to the start
# format path and name as href
pad()
{
while read -r line
do
date=${line%%--*}
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
if [ "$olddate" != "$date" ] || [ $count -eq 0 ]
then
printf '\n\n\t\t\t%s\n\t\t\t\t%s\n\t\t\t%s' "" "$year $humonth $huday" "
"
fi
path="https://kaa.neocities.org/$line"
image=""
echo $heading
printf '\t\t\t%s\n' ""
printf '\t\t\t\t%s\n' "$image"
printf '\t\t\t%s\n' ""
printf '\t\t\t%s\n' "
"
# printf '\t\t\t%s\n\n' "
"
count=$(( count+1 ))
olddate=$date
done
}
header
exclude | strip | pad
footer