thoughts/tpl/.config

163 lines
4.8 KiB
Plaintext
Raw Normal View History

#!/bin/bash
#
# Basic template configuration; command-line options will override
#
# Copyright (C) 2013, 2015, 2016 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
2015-12-09 23:26:46 -05:00
echo '<li><a href="//social.mikegerwitz.com/"' \
'title="My GNU Social Instance">Social</a></li>'
2013-05-25 11:09:26 -04:00
# 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">
2015-11-20 23:18:54 -05:00
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.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 since 2007-10-31]"
title="FSF Associate Member"
width="125" 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">
2015-07-18 08:18:12 -04:00
<img src="/images/gitlab.svg"
alt="mikegerwitz on GitLab"
title="mikegerwitz on GitLab"
width="42" height="42" border="0"
/>
</a>
2015-05-16 02:01:09 -04:00
<a href="/about/githubbub">
<img src="/images/octoright-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>
2015-05-19 23:12:49 -04:00
<a href="https://savannah.gnu.org/users/mikegerwitz">
<img src="/images/meditate-42.png"
alt="See me on Savannah"
title="See me on Savannah"
width="42" height="42" border="0"
/>
</a>
<a href="https://news.ycombinator.com/user?id=mikegerwitz"
title="mikegerwitz on Hacker News"
class="hn-icon">HN</a>
2017-09-22 03:07:18 -04:00
<a href="https://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>
<a href="https://www.eff.org/">
<img src="/images/eff-42.png"
alt="EFF Member"
title="EFF Member"
width="42" height="42" border="0"
/>
</a>
</div>
EOM
)