thoughts/tpl/.config

148 lines
4.4 KiB
Plaintext
Raw Normal View History

#!/bin/bash
#
# Basic template configuration; command-line options will override
#
2015-05-16 02:14:32 -04:00
# 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/>.
# #
2013-05-25 11:09:26 -04:00
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
2013-05-25 11:09:26 -04:00
paths=$(
2015-05-16 02:14:32 -04:00
find "$path_root/docs" -maxdepth 1 -name '[0-9][0-9]-*.??' \
-exec basename {} \; \
2013-05-25 11:09:26 -04:00
| 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
2015-05-16 02:14:32 -04:00
name="$( basename "${p%%.*}" )"
2013-05-25 11:09:26 -04:00
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" />'
2013-05-25 11:09:26 -04:00
# 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
2013-05-25 11:09:26 -04:00
)"
# additional content in the footer before the copyright (the awkward newline
# positions are to prevent spaces in the output)
html_footer=$(cat <<EOM
2013-06-01 23:23:09 -04:00
<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="http://gitorious.org/~mikegerwitz">
<img src="/images/gitorious-42.png"
alt="See me on Gitorious"
title="See me on Gitorious"
width="42" height="42" border="0"
/>
</a>
2015-05-16 02:01:09 -04:00
<a href="/about/githubbub">
<img src="/images/github-42.png"
2015-05-16 02:01:09 -04:00
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
)