diff --git a/bin/cosmic-web b/bin/cosmic-web index b0c2176..e877d06 100755 --- a/bin/cosmic-web +++ b/bin/cosmic-web @@ -1,11 +1,41 @@ #!/bin/sh +entry_index () { + line="$1" + index=$2 + log=$(printf "%s" "$line" | awk -F'\t' '{print $2}') + loghtml=$(printf "%s" "$log" | sed 's/\.[^.]*$//') + logdir=$(dirname "$log") + title=$(printf "%s" "$line" | awk -F'\t' '{print $1}' | sed 's|^.||') + + # print link in listings + if [ $index -lt 20 ]; then + printf ">> %s\\n" "$loghtml" "$title" >> "${file_html}" + fi + printf ">> %s\\n" "$loghtml" "$title" >> "${log_html}" + + # create entry + entry_html="${html_dir}${loghtml}.html" + mkdir -p "${html_dir}${logdir}" + cat "$web_header_html" > "${entry_html}" + { + printf "
\\n" + printf "<< BACK TO RELAY ONE LOG\\n\\n\\n" + sed 's/&/\&/g; s/\</g; s/>/\>/g; s/"/\"/g; s/'"'"'/\'/g' "${gopher_dir}${log}" + # close up the entry footer + printf "