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 html_file="${src_file%.*}.html"
11 redo-ifchange "$html_file"
12 template_file=index_snippet.tmpl
13 redo-ifchange "$template_file"
16 title=$(cat "$intermediate_file" | head -1 | prep_sed)
17 link=$(escape_url "${1%.index_snippet}.html" | prep_sed)
18 datetime_created_unix=$(get_creation_date_from_meta_file_seconds "$meta_file")
19 date_created_human=$(date -u "+%Y-%m-%d" -d "@${datetime_created_unix}")
21 # Put data into template.
22 template=$(cat "$template_file")
23 printf "%s\n" "$template" | \
24 sed 's/%TITLE%/'"$title"'/g' | \
25 sed 's/%LINK%/'"$link"'/g' | \
26 sed 's/%DATE_CREATED%/'"$date_created_human"'/g' | \