-
Notifications
You must be signed in to change notification settings - Fork 1
/
html.sh
36 lines (31 loc) · 892 Bytes
/
html.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# This file defines functions which print pre-defined parts of the html
# document like scripts and stylesheets.
# Prints things that always go in the head tag like stylesheets and meta
# attributes.
html_head() {
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0">'
echo '<link rel="stylesheet" href="'"$STATIC_URL"'/style.css">'
}
# Base template for html pages. This includes all the javascript and
# stylesheets as well as page elements that show on every page such as a nav
# bar and footer. The body should be written to stdin (probably via here-doc)
# and will be inserted into the "<main>" tag on the page.
#
# The first and only argument to this function is the page title.
html_page() {
cat <<EOF
<!DOCTYPE html>
<html>
<head>
<title>$1</title>
$(html_head)
</head>
<body>
<main>
$(cat /dev/stdin)
</main>
</body>
</html>
EOF
}