From: Christian Heller Date: Thu, 19 Jan 2017 00:53:18 +0000 (+0100) Subject: Add workaround for redo-ifcreate not working as expected. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/static/process?a=commitdiff_plain;h=c841d869ec1eaa8107bece1385038339aa6cfd3e;p=redo-blog Add workaround for redo-ifcreate not working as expected. --- diff --git a/README.md b/README.md index 0165c11..f16e442 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,9 @@ run ./add_dir.sh DIRECTORY. You can then enter the directory and run redo there. This will generate article .html files from all .md and .rst files, plus a ./index.html, and a ./feed.xml. These files will be linked to symbolically in a directory ./public/. If you -provide a file suffixed .links to basename of an article file, these links will -be added as article-specific linkbacks to the .html file and the feed entry. +provide or edit a file suffixed .links to basename of an article file, these +links will be added as article-specific linkbacks to the .html file and the feed +entry. Some metadata files will also be generated below ./metadata/: For each article, there will be generated a .automatic_metadata (to contain an article's UUID, diff --git a/processor/default.html.do b/processor/default.html.do index 8937ce8..c744889 100644 --- a/processor/default.html.do +++ b/processor/default.html.do @@ -21,6 +21,7 @@ redo-ifchange "$article_tmpl_file" linkback_tmpl_file="${metadata_dir}"/linkback.tmpl redo-ifchange "$linkback_tmpl_file" replies_file="${1%.html}.links" +redo-ifchange "$replies_file" # Build entry data. blog_title=$(read_and_escape_file "$title_file" | head -1 | prep_sed) @@ -33,9 +34,7 @@ datetime_created_unix=$(get_creation_date_from_meta_file_seconds "$meta_file") date_created=$(date -u "+%Y-%m-%d" -d "@${datetime_created_unix}") datetime_lastmod_unix=$(get_lastmod_date_from_meta_file "$meta_file") date_updated=$(date -u "+%Y-%m-%d" -d "@${datetime_lastmod_unix}") -if test -f "$replies_file"; then - replies=$(while read line; do prep_url "$line"; done < "$replies_file") -fi +replies=$(while read line; do prep_url "$line"; done < "$replies_file") # Put data into template. template=$(cat "$article_tmpl_file") diff --git a/processor/default.links.do b/processor/default.links.do new file mode 100644 index 0000000..f078b88 --- /dev/null +++ b/processor/default.links.do @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ ! -f "$1" ]; then + touch "$1" +fi diff --git a/processor/metadata/default.feed_snippet.do b/processor/metadata/default.feed_snippet.do index 7ff8d43..9a9b7ab 100644 --- a/processor/metadata/default.feed_snippet.do +++ b/processor/metadata/default.feed_snippet.do @@ -14,6 +14,7 @@ redo-ifchange "$meta_file" intermediate_file="${1%.feed_snippet}.intermediate" redo-ifchange "$intermediate_file" replies_file="${src_file%.*}.links" +redo-ifchange "$replies_file" # Get variables, write entry. html_file=$(escape_url "${1%.feed_snippet}.html") @@ -24,9 +25,7 @@ uuid=$(get_uuid_from_meta_file "$meta_file") published_unix=$(get_creation_date_from_meta_file_seconds "$meta_file") published_rfc3339=$(date -u "+%Y-%m-%dT%TZ" -d "@${published_unix}") body=$(read_and_escape_file "$intermediate_file" | sed 1d) -if test -f "$replies_file"; then - replies=$(while read line; do prep_url "$line"; done < "$replies_file") -fi +replies=$(while read line; do prep_url "$line"; done < "$replies_file") printf "\n" printf "%s\n" "$title" printf "urn:uuid:%s\n" "$uuid"