X-Git-Url: https://plomlompom.com/repos/?p=redo-blog;a=blobdiff_plain;f=processor%2Fdefault.feed_snippet.do;fp=processor%2Fdefault.feed_snippet.do;h=9d33ad94f7f7331ffef9ced2189061a3627cfc70;hp=0000000000000000000000000000000000000000;hb=4373137de8ac6ad8731e6828a9876de9efe0a82e;hpb=6138fd7efef3873fa3f48b92f2275f86eb76e329 diff --git a/processor/default.feed_snippet.do b/processor/default.feed_snippet.do new file mode 100644 index 0000000..9d33ad9 --- /dev/null +++ b/processor/default.feed_snippet.do @@ -0,0 +1,27 @@ +#!/bin/sh + +# Pull in dependencies. +. ./helpers.sh +src_file=$(get_source_file "$1") +uuid_file="${1%.feed_snippet}.uuid" +redo-ifchange "$uuid_file" +intermediate_file="${src_file%.*}.intermediate" +redo-ifchange "$intermediate_file" + +# Get variables, write entry. +html_file=`escape_url "${src_file%.*}.html"` +lastmod=`stat -c%y "$src_file"` +lastmod_rfc3339=`date -u "+%Y-%m-%dT%TZ" -d "$lastmod"` +published=`stat -c%y "$uuid_file"` +published_rfc3339=`date -u "+%Y-%m-%dT%TZ" -d "${published}"` +title=`read_and_escape_file "$intermediate_file" | head -1` +uuid=`read_and_escape_file "$uuid_file" | head -1` +body=`read_and_escape_file "$intermediate_file" | sed 1d` +printf "\n" +printf "%s\n" "$title" +printf "urn:uuid:%s\n" "$uuid" +printf "%s\n" "$lastmod_rfc3339" +printf "%s\n" "$published_rfc3339" +printf "\n" "$(get_basepath)" "${html_file#\./}" +printf "\n%s\n\n" "$body" +printf "\n"