thoughts/tpl/.config

148 lines
4.4 KiB
Bash

#!/bin/bash
#
# Basic template configuration; command-line options will override
#
# Copyright (C) 2013, 2015 Mike Gerwitz
#
# 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/>.
# #
get-menu-docs()
{
# we shall only consider ordered pages---that is, those that begin with numbers; this
# allows pages to exist that are not listed in the menu
paths=$(
find "$path_root/docs" -maxdepth 1 -name '[0-9][0-9]-*.??' \
-exec basename {} \; \
| sort
)
for p in $paths; do
# we shall consider the name of the link to be the path with the extension
# and sorting prefix stripped
name="$( basename "${p%%.*}" )"
echo "${name#??-}"
done
}
html_external_css=/style.css
# lets certain browsers---such as the proprietary mobile Safari browser that
# seems to be far too Ubiquitous---know that they should trust us with rendering
# the page to fit within the device's screen resolution
html_head='<meta name="viewport" content="initial-scale=1.0" />'
# menu just below the header, above the index
html_pre_index="$(
echo '<ul id="menu">'
# generate menu from the root documents
for name in `get-menu-docs`; do
# each word in the name will be capitalized and the link shall not contain
# the file extension
words=( ${name//[_-]/ } )
printf '<li><a href="/%s">%s</a></li>' "$name" "${words[*]^}"
done
# the remainder will appear below the menu, above the index
cat <<EOH
</ul>
<div id="headline">
<a href="https://www.eff.org/nsa-spying">
<img src="/images/eff-nsa-spying.png"
alt="NSA Spying on Americans"
title="NSA Spying on Americans" />
</a>
<a href="http://upgradefromwindows8.com">
<img src="/images/win8-close.png"
alt="Close Windows, Open Doors" />
</a>
</div>
EOH
)"
# additional content in the footer before the copyright (the awkward newline
# positions are to prevent spaces in the output)
html_footer=$(cat <<EOM
<a href="/about/inside" id="gnuinside">
<img src="/images/gnu-inside.png" alt="GNU/Linux Inside!" />
</a>
<div class="bimgs">
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"
><img src="/images/cc-bysa-88x31.png"
alt="[CC BY-SA]"
title="Creative Commons Attribution-ShareAlike"
width="88" height="31" border="0"
/></a>
<a href="http://www.fsf.org/register_form?referrer=5804"
><img src="/images/fsf-member.png"
alt="[FSF Associate Member]"
title="Mike Gerwitz - FSF Associate Member"
width="88" height="31" border="0"
/></a>
<a href="http://endsoftpatents.org/innovating-without-patents"
><img src="/images/esp-button.png"
alt="[ Innovating Without Patents! ]"
title="Innovating Without Patents"
width="88" height="31" border="0"
/></a>
<a href="http://www.defectivebydesign.org/join/button"
><img src="/images/elim-drm.gif"
alt="[ Eliminate DRM! ]"
title="Eliminate DRM!"
width="88" height="30" border="0"
/></a>
</div>
EOM
)
# index-only footer (we don't want too much spam; the other pages look much
# cleaner without this)
html_index_footer=$(cat <<EOM
<div id="selflinks">
<a href="https://gitlab.com/u/mikegerwitz">
<img src="/images/gitlab-42.png"
alt="See me on GitLab"
title="See me on GitLab"
width="42" height="42" border="0"
/>
</a>
<a href="/about/githubbub">
<img src="/images/github-42.png"
alt="Don't see me on GitHub"
title="Don't see me on GitHub"
width="42" height="42" border="0"
/>
</a>
<a href="http://www.fsf.org/register_form?referrer=5804">
<img src="/images/fsf-42.png"
alt="FSF Member #5804"
title="FSF Member #5804"
width="42" height="42" border="0"
/>
</a>
</div>
EOM
)