home · contact · privacy
Move all scripts etc. to their own directory.
[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 redo-ifchange title
7 redo-ifchange "$intermediate_file"
8
9 # Build entry data.
10 blog_title=`read_and_escape_file title | head -1`
11 title_html=`cat "$intermediate_file" | head -1`
12 title_plaintext=`echo "$title_html" | html2text`
13 title_plaintext_escaped=`escape_html "$title_plaintext"`
14 body=`cat "$intermediate_file" | sed 1d`
15
16 # Write first part of entry head.
17 cat << EOF
18 <!DOCTYPE html>
19 <html>
20 <head>
21 EOF
22
23 # Write remaining entry head and body. 
24 printf "<title>%s – %s</title>\n</head>\n<body>\n" "$blog_title" "$title_plaintext_escaped"
25 #printf "<title>%s – %s</title>\n</head>\n<body>\n" "$blog_title" "$entry_title"
26 printf "<h1>%s</h1>\n" "$title_html"
27 printf "<section>\n%s\n</section>\n</body>\n</html>" "$body"