1
0
Fork 0
repo2html/tpl/index

65 lines
1.5 KiB
Plaintext
Raw Normal View History

#!/bin/bash
output-heading()
{
# 1 = dategroup
# we assign the heading to the id for the purpose of URL hashes
echo "<h3 id="$1" class="index">$1</h3>"
# every heading is followed by at least one index line
echo '<ul class="index">'
}
output-line()
{
# 1 = day, 2 = pagefile, 3 = fmtsubject
printf '<li><span class="day">(%s)</span> <a href="%s">%s</a></li>' "$@"
}
close-heading()
{
echo '</ul>'
}
cat <<EOH
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="alternate" title="RSS Feed"
href="rss.xml" type="application/rss+xml" />
$( [ -n "$html_external_css" ] \
&& printf '<link rel="stylesheet" type="text/css" href="%s" />' \
"$html_external_css"
)
<title>$title</title>
</head>
<body class="index">
<header>
<h1 class="title">$title</h1>
<h2 class="desc">$desc</h2>
</header>
2013-05-25 11:10:14 -04:00
$html_pre_index
EOH
# generate index and populate statistical vars
do-index output-heading output-line close-heading
cat <<EOF
<footer>
<div id="rss"><a href="rss.xml">RSS</a></div>
<hr />
$( [ -n "$html_footer" ] \
&& printf '<div class="pre-copyright">%s</div>' "$html_footer"
)
$( [ -n "$html_index_footer" ] \
&& printf '<div class="pre-copyright">%s</div>' "$html_index_footer"
)
<div>Copyright &copy; $yearrange $copyright</div>
<div>Last Updated: $( ./tsdate "$lastts" '%F %H:%M:%S' )</div>
<div class="commit-id">$lasthash</div>
</footer>
</body>
</html>
EOF