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