#!/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
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}/"
# Write remaining entry head and body.
printf "<title>%s – %s</title>\n</head>\n<body>\n" "$blog_title" "$title_plaintext_escaped"
-#printf "<title>%s – %s</title>\n</head>\n<body>\n" "$blog_title" "$entry_title"
printf "<h1>%s</h1>\n" "$title_html"
printf "<section>\n%s\n</section>\n</body>\n</html>" "$body"
> "$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