wowana.me

website source; use git clone git://wowana.me/wowana.me.git to clone this repository.


feed (1164B)


      1 #!/bin/sh
      2 
      3 cat <<HEADER
      4 <?xml version="1.0" encoding="utf-8"?>
      5 <feed xmlns="http://www.w3.org/2005/Atom" xml:base="https://wowana.me/">
      6 	<title>opal's weblog</title>
      7 	<link href="/blog/" rel="alternate"/>
      8 	<link href="/blog/feed.atom" rel="self"/>
      9 	<id>/blog/</id>
     10 	<updated>$(busybox date -Iseconds)</updated>
     11 HEADER
     12 
     13 for filename in "$@"; do
     14 	slug="$(basename "$filename" .part.xht)"
     15 
     16 	date="$(<"$filename" sed -n '/<!--\[time / {s/.* \(.*\)]-->/\1/; p; q}')"
     17 	iso="$(busybox date -Iseconds -d$date)"
     18 
     19 	cat <<ENTRY_HEAD
     20 	<entry>
     21 		<title>$(<"$filename" pup 'h1 text{}')</title>
     22 		<link href="/blog/$slug.xht" rel="alternate" type="application/xhtml+xml" />
     23 		<id>/blog/$slug.xht</id>
     24 		<published>$iso</published>
     25 		<updated>$(busybox date -r${filename/.part.xht/.md} -Iseconds)</updated>
     26 		<author><name>opal hart</name></author>
     27 		<content type="xhtml">
     28 			<div xmlns="http://www.w3.org/1999/xhtml">
     29 ENTRY_HEAD
     30 	# first four lines are <h1/> and time; if this changes then I'll
     31 	# change this hardcoded range to something else, no big deal
     32 	<"$filename" sed '1,4d'
     33 	cat <<ENTRY_FOOT
     34 			</div>
     35 		</content>
     36 	</entry>
     37 ENTRY_FOOT
     38 done
     39 
     40 cat <<FOOTER
     41 </feed>
     42 FOOTER