From: Christian Heller Date: Sat, 19 Nov 2016 21:01:58 +0000 (+0100) Subject: Rename generated meta files, test for them. X-Git-Url: https://plomlompom.com/repos/?p=redo-blog;a=commitdiff_plain;h=5a17d0898d72bc8574601f57f26af8d3e0da2288 Rename generated meta files, test for them. --- diff --git a/processor/author.do b/processor/author.do deleted file mode 100644 index ed14e3f..0000000 --- a/processor/author.do +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -if [ ! -f "$1" ]; then - printf "Joe Sixpack" -fi diff --git a/processor/author.meta.do b/processor/author.meta.do new file mode 100644 index 0000000..ed14e3f --- /dev/null +++ b/processor/author.meta.do @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ ! -f "$1" ]; then + printf "Joe Sixpack" +fi diff --git a/processor/default.html.do b/processor/default.html.do index 3ff4132..2a457a5 100644 --- a/processor/default.html.do +++ b/processor/default.html.do @@ -3,11 +3,12 @@ # Pull in global dependencies. . ./helpers.sh intermediate_file="${1%.html}.intermediate" -redo-ifchange title +title_file=title.meta +redo-ifchange "$title_file" redo-ifchange "$intermediate_file" # Build entry data. -blog_title=`read_and_escape_file title | head -1` +blog_title=`read_and_escape_file "$title_file" | head -1` title_html=`cat "$intermediate_file" | head -1` title_plaintext=`echo "$title_html" | html2text` title_plaintext_escaped=`escape_html "$title_plaintext"` diff --git a/processor/feed.xml.do b/processor/feed.xml.do index 2cdb7b2..14ead59 100644 --- a/processor/feed.xml.do +++ b/processor/feed.xml.do @@ -2,21 +2,25 @@ # Pull in global dependencies. . ./helpers.sh -redo-ifchange url -redo-ifchange author -redo-ifchange uuid -redo-ifchange title +url_file=url.meta +author_file=author.meta +uuid_file=uuid.meta +title_file=title.meta +redo-ifchange "$url_file" +redo-ifchange "$author_file" +redo-ifchange "$uuid_file" +redo-ifchange "$title_file" # Build some variables. XML-escape even file contents that should not contain # dangerous characters, just to avoid any XML trouble. -base_url=`cat url | head -1` +base_url=`cat "$url_file" | head -1` url_protocol=`echo $base_url | cut -d ':' -f 1` url_basepath=`echo $base_url | cut -d '/' -f 3-` url_basepath_escaped=`escape_url "$url_basepath"` basepath="$url_protocol""://""$url_basepath_escaped" -title=`read_and_escape_file title | head -1` -author=`read_and_escape_file author | head -1` -uuid=`read_and_escape_file uuid | head -1` +title=`read_and_escape_file "$title_file" | head -1` +author=`read_and_escape_file "$author_file" | head -1` +uuid=`read_and_escape_file "$uuid_file" | head -1` # Write majority of feed head. cat << EOF @@ -47,13 +51,13 @@ for file in $files; do # Build some variables and dependencies. intermediate_file="${file%.*}.intermediate" htmlfile=`escape_url "${file%.*}.html"` + uuid_file="${file%.*}.uuid" redo-ifchange "$intermediate_file" - redo-ifchange "$uuidfile" + redo-ifchange "$uuid_file" title=`read_and_escape_file "$intermediate_file" | head -1` - uuidfile="${file%.*}.uuid" - uuid=`read_and_escape_file "$uuidfile" | head -1` + uuid=`read_and_escape_file "$uuid_file" | head -1` body=`read_and_escape_file "$intermediate_file" | sed 1d` - published=`stat -c%y "$uuidfile"` + published=`stat -c%y "$uuid_file"` published_rfc3339=`date -u "+%Y-%m-%dT%TZ" -d "$published"` # Write entry. diff --git a/processor/index.html.do b/processor/index.html.do index 8bf6751..2b71ffb 100644 --- a/processor/index.html.do +++ b/processor/index.html.do @@ -2,7 +2,8 @@ # Pull in global dependencies. . ./helpers.sh -redo-ifchange title +title_file=title.meta +redo-ifchange "$title_file" # Write index head. cat << EOF @@ -10,7 +11,7 @@ cat << EOF EOF -blog_title=`read_and_escape_file title | head -1` +blog_title=`read_and_escape_file "$title_file" | head -1` printf "%s\n\n\n" "$blog_title" printf "

%s

\n