From: Christian Heller Date: Wed, 21 Dec 2016 23:11:38 +0000 (+0100) Subject: Move (links to) files meant to be public into separate directory. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7Bdb.prefix%7D%7D/test?a=commitdiff_plain;h=c67421732e148c768cc83395c143480b2b9b6106;p=redo-blog Move (links to) files meant to be public into separate directory. --- diff --git a/processor/all.do b/processor/all.do index 73d0124..3c3a021 100644 --- a/processor/all.do +++ b/processor/all.do @@ -1,6 +1,10 @@ #!/bin/sh +# Set up directories. metadata_dir=.meta +public_dir=public +cur_dir=$(pwd) +mkdir -p "$public_dir" # Remove target files for which no sources files can be found. for file in "$metadata_dir"/*.intermediate; do @@ -37,10 +41,14 @@ done for file in "$metadata_dir"/*.intermediate; do if test -f "$file"; then basename=$(basename "$file") - redo-ifchange "${basename%.intermediate}.html" + html_file=${basename%.intermediate}.html + redo-ifchange "$html_file" + ln -sf "$cur_dir/$html_file" "${public_dir}/" fi done # Regenerate feed and index pages. Always. -redo "feed.xml" -redo "index.html" +redo feed.xml +ln -sf "$cur_dir"/feed.xml "${public_dir}/" +redo index.html +ln -sf "$cur_dir"/index.html "${public_dir}/" diff --git a/processor/default.html.do b/processor/default.html.do index 4371a3a..99be463 100644 --- a/processor/default.html.do +++ b/processor/default.html.do @@ -24,6 +24,5 @@ EOF # Write remaining entry head and body. printf "%s – %s\n\n\n" "$blog_title" "$title_plaintext_escaped" -#printf "%s – %s\n\n\n" "$blog_title" "$entry_title" printf "

%s

\n" "$title_html" printf "
\n%s\n
\n\n" "$body" diff --git a/test.sh b/test.sh index c54e48a..8e2a024 100755 --- a/test.sh +++ b/test.sh @@ -64,3 +64,15 @@ cat "$original_file" | \ > "$generated_file" diff_test "$expected_file" "$generated_file" rm "$generated_file" + +# Check symbolic links. +for file in "$generated_files_dir"/feed.xml "$generated_files_dir"/*.html; do + basename=$(basename "$file") + linkname=$(readlink "$generated_files_dir/public/$basename") + printf "== public/%s symbolic link test ==\n" "$basename" + if [ "$working_dir/$generated_files_dir/$basename" = "$linkname" ]; then + echo "== test SUCCESS ==" + else + echo "== test FAILURE ==" + fi +done