-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_header
executable file
·90 lines (80 loc) · 2.64 KB
/
generate_header
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 output_file"
exit 1
fi
TITLE="$(grep "^$1;" files | cut -d ';' -f 2)"
OBSOLETE="$(grep "^$1;" files | cut -d ';' -f 3)"
BACKGROUND="$(grep "^$1;" files | cut -d ';' -f 5)"
DESCR="$(grep "^$1;" files | cut -d ';' -f 6)"
PRIVATE="$(grep "^$1;" files | cut -d ';' -f 7)"
if [ "$1" != "index.html" ]; then
TITLE="Youth Weekend 2014: ${TITLE}"
fi
if [ "${BACKGROUND}" = "group_pic" ]; then
HEIGHT_CSS=" height: 417px;"
fi
cat > "$1" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>${TITLE}</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="style.css"/>
<link rel="stylesheet" type="text/css" href="fonts.css"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="site.js"> </script>
<meta name="viewport" content="initial-scale=1.0, user-scalable=yes"/>
<link rel="icon" href="yww-128.png"/>
<link rel="icon" href="yww-64.png"/>
<link rel="icon" href="yww-32.png"/>
<link rel="apple-touch-icon-precomposed" href="yww-144.png"/>
<script type="text/javascript">
\$(document).ready(crib_ready);
</script>
<style type="text/css">
#header {
background: url('${BACKGROUND}.jpg');
${HEIGHT_CSS}
}
</style>
</head>
<body>
<div id="container">
<a href="index.html" id="header">
<span id="main_logo"><img src="yww.svg" width="67" height="85" alt="YW Logo"/></span>
<span id="main_title">Youth Weekend</span>
<span id="main_subtitle">May 2-4, 2014 at Western Washington University in Bellingham.</span>
<span id="main_descr">${DESCR}</span>
</a>
<div id="navigation">
EOF
cat files | while IFS=';' read file title obsolete visible junk; do
if [ "${file:0:1}" = "#" -o "${file}" = "index.html" ]; then
continue
fi
if [ "${visible}" != "yes" ]; then
continue
fi
class=
if [ "$1" = "${file}" ]; then
class=" class=\"selected\""
fi
id="$(echo "${file}" | sed -e 's/.html$//g')"
echo " <a href=\"${file}\" id=\"${id}\"${class}>${title}</a>" >> "$1"
done
cat >> "$1" << EOF
</div>
EOF
if [ "${OBSOLETE}" != "no" ]; then
cat >> "$1" << EOF
<div id="obsolete"><strong>Notice:</strong> This page has not been updated with 2014 information. Please check back later.</div>
EOF
fi
if [ "${PRIVATE}" != "no" ]; then
cat >> "$1" << EOF
<div id="private"><strong>Notice:</strong> This page contains information not visible to the general public. Please handle with care.</div>
EOF
fi
exit 0