home · contact · privacy
Add workaround for redo-ifcreate not working as expected.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 19 Jan 2017 00:53:18 +0000 (01:53 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 19 Jan 2017 00:53:18 +0000 (01:53 +0100)
README.md
processor/default.html.do
processor/default.links.do [new file with mode: 0644]
processor/metadata/default.feed_snippet.do

index 0165c1118adef11d700c960f41f406ca9306f89a..f16e442ec81aa1475f58fb2bbff1d5356c3e95ad 100644 (file)
--- 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,
index 8937ce8ed1bbd9077472efbb535877160a645846..c744889405bbe8e4f8b9070b18cd02828d994882 100644 (file)
@@ -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 (file)
index 0000000..f078b88
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+if [ ! -f "$1" ]; then
+  touch "$1"
+fi
index 7ff8d4348a6f4946fa4d4f07c23937ec517621fd..9a9b7ab218ea96a5adcf4bc17e37b5d8f41f5bae 100644 (file)
@@ -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 "<entry>\n"
 printf "<title type=\"html\">%s</title>\n" "$title"
 printf "<id>urn:uuid:%s</id>\n" "$uuid"