3 # Pull in global dependencies.
6 intermediate_file="${metadata_dir}/${1%.html}.intermediate"
7 redo-ifchange "$intermediate_file"
8 title_file="${metadata_dir}"/title
9 redo-ifchange "$title_file"
10 template_file="${metadata_dir}"/article.tmpl
11 redo-ifchange "$template_file"
14 blog_title=$(read_and_escape_file "$title_file" | head -1 | prep_sed)
15 title_html=$(cat "$intermediate_file" | head -1)
16 title_plaintext=`echo "$title_html" | html2text`
17 title_html=$(printf "%s" "$title_html" | prep_sed)
18 title_plaintext=$(escape_html "$title_plaintext" | prep_sed)
19 body=$(cat "$intermediate_file" | sed 1d | prep_sed)
21 # Put data into template.
22 template=$(cat "$template_file")
23 printf "%s" "$template" | \
24 sed 's/%BLOG_TITLE%/'"$blog_title"'/g' | \
25 sed 's/%ARTICLE_TITLE_ESCAPED%/'"$title_plaintext"'/g' | \
26 sed 's/%ARTICLE_TITLE_HTML%/'"$title_html"'/g' | \
27 sed 's/%BODY%/'"$body"'/g' | \