home · contact · privacy
1949d0bf3b31d33063db82ff64429fc188cbc270
[redo-blog] / processor / .meta / default.feed_snippet.do
1 #!/bin/sh
2
3 # Pull in dependencies. 
4 . ./helpers.sh
5 src_file=$(get_source_file "$1")
6 uuid_file="${1%.feed_snippet}.uuid"
7 redo-ifchange "$uuid_file"
8 intermediate_file="${1%.feed_snippet}.intermediate"
9 redo-ifchange "$intermediate_file"
10
11 # Get variables, write entry.
12 html_file=`escape_url "${src_file%.*}.html"`
13 html_file=${html_file#*/}
14 lastmod=`stat -c%y "$src_file"`
15 lastmod_rfc3339=`date -u "+%Y-%m-%dT%TZ" -d "$lastmod"`
16 published=`stat -c%y "$uuid_file"`
17 published_rfc3339=`date -u "+%Y-%m-%dT%TZ" -d "${published}"`
18 title=`read_and_escape_file "$intermediate_file" | head -1`
19 uuid=`read_and_escape_file "$uuid_file" | head -1`
20 body=`read_and_escape_file "$intermediate_file" | sed 1d`
21 printf "<entry>\n"
22 printf "<title type=\"html\">%s</title>\n" "$title"
23 printf "<id>urn:uuid:%s</id>\n" "$uuid"
24 printf "<updated>%s</updated>\n" "$lastmod_rfc3339"
25 printf "<published>%s</published>\n" "$published_rfc3339"
26 printf "<link href=\"%s%s\" />\n" "$(get_basepath)" "${html_file}"
27 printf "<content type=\"html\">\n%s\n</content>\n" "$body"
28 printf "</entry>\n"