summary refs log tree commit diff
path: root/www/photo.causal.agency/generate.sh
diff options
context:
space:
mode:
Diffstat (limited to 'www/photo.causal.agency/generate.sh')
-rw-r--r--www/photo.causal.agency/generate.sh32
1 files changed, 23 insertions, 9 deletions
diff --git a/www/photo.causal.agency/generate.sh b/www/photo.causal.agency/generate.sh
index 558b8a54..be673790 100644
--- a/www/photo.causal.agency/generate.sh
+++ b/www/photo.causal.agency/generate.sh
@@ -41,8 +41,11 @@ page_title() {
 page_head() {
 	local date=$1
 	local title=$(page_title $date)
-	local lens film
+	local body lens film
 
+	if test -f $date/body; then
+		body=$(encode $date/body)
+	fi
 	if test -f $date/lens; then
 		lens=$(encode $date/lens)
 	else
@@ -75,7 +78,7 @@ page_head() {
 	details { max-width: 78ch; margin: 0.5em auto; }
 	</style>
 	<h1>${title}</h1>
-	<p>๐Ÿ“ท ${lens}${film:+ ๐ŸŽž๏ธ }${film:-}</p>
+	<p>๐Ÿ“ท ${body:-}${body:+ ยท }${lens}${film:+ ๐ŸŽž๏ธ }${film:-}</p>
 	EOF
 }
 
@@ -101,14 +104,21 @@ photo_id() {
 
 page_photo() {
 	local photo=$1 preview=$2 description=$3
-	if ! test -f $description; then
-		description=/dev/null
-	fi
 	photo_info $photo
 	cat <<-EOF
 	<figure id="$(photo_id $photo)">
 		<a href="${photo##*/}">
+	EOF
+	if test -f $description; then
+		cat <<-EOF
 			<img src="../${preview}" alt="$(encode $description)">
+		EOF
+	else
+		cat <<-EOF
+			<img src="../${preview}">
+		EOF
+	fi
+	cat <<-EOF
 		</a>
 		<figcaption>
 	EOF
@@ -120,11 +130,15 @@ page_photo() {
 			${PhotographicSensitivity} ISO
 		EOF
 	fi
-	cat <<-EOF
+	if test -f $description; then
+		cat <<-EOF
 			<details>
 				<summary>description</summary>
 				$(encode $description)
 			</details>
+		EOF
+	fi
+	cat <<-EOF
 		</figcaption>
 	</figure>
 	EOF
@@ -211,12 +225,12 @@ for date in 20*; do
 	if ! test -f $page; then
 		echo $page >&2
 		page_head $date >$page
-		for photo in ${date}/*.JPG; do
+		for photo in ${date}/*.[Jj][Pp][Gg]; do
 			preview=$(preview $photo)
 			if ! test -f static/${photo}; then
 				ln $photo static/${photo}
 			fi
-			page_photo $photo $preview ${photo%.JPG}.txt >>$page
+			page_photo $photo $preview ${photo%.[Jj][Pp][Gg]}.txt >>$page
 		done
 	fi
 	set -- $date "$@"
@@ -229,7 +243,7 @@ atom_head >static/feed.atom
 for date; do
 	index_page $date >>static/index.html
 	atom_entry_head $date >>static/feed.atom
-	for photo in ${date}/*.JPG; do
+	for photo in ${date}/*.[Jj][Pp][Gg]; do
 		thumbnail=$(thumbnail $photo)
 		index_photo $date $photo $thumbnail >>static/index.html
 		index_photo $date $photo $thumbnail $Root | encode >>static/feed.atom