home · contact · privacy
Rename generated meta files, test for them.
[redo-blog] / processor / default.html.do
1 #!/bin/sh
2
3 # Pull in global dependencies.
4 . ./helpers.sh
5 intermediate_file="${1%.html}.intermediate"
6 title_file=title.meta
7 redo-ifchange "$title_file" 
8 redo-ifchange "$intermediate_file"
9
10 # Build entry data.
11 blog_title=`read_and_escape_file "$title_file" | head -1`
12 title_html=`cat "$intermediate_file" | head -1`
13 title_plaintext=`echo "$title_html" | html2text`
14 title_plaintext_escaped=`escape_html "$title_plaintext"`
15 body=`cat "$intermediate_file" | sed 1d`
16
17 # Write first part of entry head.
18 cat << EOF
19 <!DOCTYPE html>
20 <html>
21 <head>
22 EOF
23
24 # Write remaining entry head and body. 
25 printf "<title>%s – %s</title>\n</head>\n<body>\n" "$blog_title" "$title_plaintext_escaped"
26 #printf "<title>%s – %s</title>\n</head>\n<body>\n" "$blog_title" "$entry_title"
27 printf "<h1>%s</h1>\n" "$title_html"
28 printf "<section>\n%s\n</section>\n</body>\n</html>" "$body"