1
0
Fork 0
repo2html/tpl/commit

87 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
#
# Commit 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/>.
# #
cat <<EOF
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>$subject</title>
$( [ -n "$html_external_css" ] \
&& printf '<link rel="stylesheet" type="text/css" href="%s" />' \
"$html_external_css"
)
<style type="text/css">
sup { font-size: 0.6em; }
:target { background-color: #fce94f; }
p.ref { margin: 0.25em 0em; }
$commit_html_inline_css
</style>
$html_head
</head>
<body class="${html_body_class:-commit}">
<article>
<header>
<h1 class="subject">$subject</h1>
<h2 class="date">$year-$month-$day</h2>
<div class="author">
$author
<a href="mailto:$email" class="email">&lt;$email&gt;</a>
</div>
</header>
<div class="content">
$( cat )
</div>
<footer>
<p>
<a href="$url_root#$dategroup">(Return to index)</a>
</p>
<hr />
$( [ -n "$html_footer" ] \
&& printf '<div class="pre-copyright">%s</div>' "$html_footer"
)
$( [ -n "$html_commit_footer" ] \
&& printf '<div class="pre-copyright">%s</div>' "$html_commit_footer"
)
<div id="copyright">
Copyright &copy; $year $copyright.
$license
</div>
<div class="commit-id">$(
if [ -n "$repo_commit_url" ]; then
printf '<a href="'"$repo_commit_url"'">%s</a>' "$hash" "$hash"
elif [ -n "$repo_url" ]; then
printf '<a href="%s">%s</a>' "$repo_url" "$hash"
else
echo "$hash"
fi
)</div>
</footer>
</article>
</body>
</html>
EOF