=> < A little experiment | Parent | ~pink2ds

#!/bin/sh
echo "m4_include(website.m4)
m4_define([__title], [])
m4_define([__description], [])
m4_include(article-header.html)
" pandoc "$1" echo "
m4_include(footer.html)"

=> Write a reply

Replies

=> ~starbreaker wrote (thread):

Thanks. I'm actually embarrassed right now because I think I should have thought of that myself. And if I use printf instead of echo I can pass in the title and description as arguments along with the filename. Then again echo would probably work fine, too, but I'm used to printf because of my feedgen script.

I use this to generate Atom feeds from a tab-delimited file. Though the usage function needs updating.

#!/bin/sh -e

main() {
	test -n "$1" || usage
	test -n "$2" || usage

	url="$1"
	head="$2"
	entries="$3"

	feed_start "$head"
	process_entries "$url" "$entries"
	feed_end ""
}

usage() {
	echo "usage:\n\t${0##*/} 
" >&2 echo "\tHeader file is tab-delimited: title, subtitle, link, name, email." >&2 echo "\tEntries file is tab-delimited: title, link, id, updated, summary." >&2 echo "\tPlease note that entries file will be read in reverse order." >&2 exit 1 } feed_start() { title=`cut -f 1 ${1}` subtitle=`cut -f 2 ${1}` link=`cut -f 3 ${1}` updated=`date "+%Y-%m-%dT%H:%M:%S.000-05:00"` name=`cut -f 4 ${1}` email=`cut -f 5 ${1}` printf '\n' printf '\n' printf '\t%s\n' "$title" printf '\t%s\n' "$subtitle" printf '\t\n' "$link" printf '\t%s\n' "$updated" printf '\t\n' printf '\t\t%s\n' "$name" printf '\t\t%s\n' "$email" printf '\t\n' printf '\t%s\n' "$link" } process_entries() { url=$1 while IFS= read -r line do write_entry "$url" "$line" done < $2 } write_entry() { url=$1 title=`echo "$2" | cut -f 3` link=`echo "$2" | cut -f 2` updated=`echo "$2" | cut -f 1` summary=`echo "$2" | cut -f 4` printf '\t\n' printf '\t\t%s\n' "$title" printf '\t\t\n' "$url" "$link" printf '\t\t%s%s\n' "$url" "$link" printf '\t\t%sT23:58:00.000-0500\n' "$updated" printf '\t\t%s\n' "$summary" printf '\t\n' } feed_end() { printf '\n' } main "$@"
Proxy Information
Original URL
gemini://midnight.pub/replies/515
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
181.504922 milliseconds
Gemini-to-HTML Time
0.461343 milliseconds

This content has been proxied by September (3851b).