3 # Handle URL from .links file.
5 url=$(escape_html "$1")
6 printf "\n<link href=\"%s\" rel=\"replies\" />" "$url"
9 # Pull in dependencies.
11 src_file=$(get_source_file "$1")
12 meta_file="${1%.feed_snippet}.automatic_metadata"
13 redo-ifchange "$meta_file"
14 intermediate_file="${1%.feed_snippet}.intermediate"
15 redo-ifchange "$intermediate_file"
16 replies_file="${src_file%.*}.links"
18 # Get variables, write entry.
19 html_file=$(escape_url "${1%.feed_snippet}.html")
20 lastmod=$(get_lastmod_date_from_meta_file "$meta_file")
21 lastmod_rfc3339=$(date -u "+%Y-%m-%dT%TZ" -d "@$lastmod")
22 title=$(read_and_escape_file "$intermediate_file" | head -1)
23 uuid=$(get_uuid_from_meta_file "$meta_file")
24 published_unix=$(get_creation_date_from_meta_file_seconds "$meta_file")
25 published_rfc3339=$(date -u "+%Y-%m-%dT%TZ" -d "@${published_unix}")
26 body=$(read_and_escape_file "$intermediate_file" | sed 1d)
27 if test -f "$replies_file"; then
28 replies=$(while read line; do prep_url "$line"; done < "$replies_file")
31 printf "<title type=\"html\">%s</title>\n" "$title"
32 printf "<id>urn:uuid:%s</id>\n" "$uuid"
33 printf "<updated>%s</updated>\n" "$lastmod_rfc3339"
34 printf "<published>%s</published>\n" "$published_rfc3339"
35 printf "<link href=\"%s%s\" rel=\"alternate\" type=\"text/html\" />" "$(get_basepath)" "${html_file}"
36 printf "%s" "$replies"
37 printf "\n<content type=\"html\">\n%s\n</content>\n" "$body"