3 # Pull in dependencies.
5 src_file=$(get_source_file "$1")
6 meta_file="${1%.index_snippet}.automatic_metadata"
7 redo-ifchange "$meta_file"
8 intermediate_file="${1%.index_snippet}.intermediate"
9 redo-ifchange "$intermediate_file"
10 template_file=index_snippet.tmpl
11 redo-ifchange "$template_file"
14 title=$(cat "$intermediate_file" | head -1 | prep_sed)
15 link=$(escape_url "${1%.index_snippet}.html" | prep_sed)
16 datetime_created_unix=$(get_creation_date_from_meta_file_seconds "$meta_file")
17 date_created_human=$(date -u "+%Y-%m-%d" -d "@${datetime_created_unix}")
19 # Put data into template.
20 template=$(cat "$template_file")
21 printf "%s\n" "$template" | \
22 sed 's/%TITLE%/'"$title"'/g' | \
23 sed 's/%LINK%/'"$link"'/g' | \
24 sed 's/%DATE_CREATED%/'"$date_created_human"'/g' | \