]> git.plutz.net Git - shellwiki/blob - themes/default.sh
theme template and default theme
[shellwiki] / themes / default.sh
1 #!/bin/sh
2
3 theme_404(){
4   printf "%s\r\n" "Status: 404 Not Found"
5
6   theme_page '/[404]/'
7 }
8
9 theme_page(){
10   local page="$1" title
11   title="${page%/}"; title="${title##*/}"
12
13   printf "%s\r\n" "Content-Type: text/html; charset=utf-8" ""
14
15   cat <<-EOF
16         <!DOCTYPE HTML>
17         <html><head>
18           <meta name="viewport" content="width=device-width"/>
19           <link rel="stylesheet" type="text/css" href="$_BASE/[wiki]/cgilite/common.css">
20           <title>$(HTML "${title}")</title>
21         </head><body id="$(HTML "$page")">
22           <header></header>
23           <main>$(wiki "$page" || printf 'Page not found')</main>
24           <footer></footer>
25         </body></html>
26         EOF
27 }