85 lines
2.2 KiB
Bash
Executable File
85 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Index template
|
|
#
|
|
# Copyright (C) 2013 Mike Gerwitz
|
|
#
|
|
# This file is part of repo2html.
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
# #
|
|
|
|
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>
|
|
$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 © $yearrange $copyright</div>
|
|
<div>Last Updated: $( ./tsdate "$lastts" '%F %H:%M:%S' )</div>
|
|
<div class="commit-id">$lasthash</div>
|
|
</footer>
|
|
</body>
|
|
</html>
|
|
EOF
|