cgit-root generation

This automates creation of the header and footer.  Previously I modified
them manually and they got out-of-sync.

This is deployed to a different location on my webserver, even though the
public route is `/projects'.
master
Mike Gerwitz 2019-01-17 00:55:31 -05:00
parent f0a08f8755
commit f24dc3e227
Signed by: mikegerwitz
GPG Key ID: 8C917B7F5DC51BA2
6 changed files with 65 additions and 86 deletions

3
.gitignore vendored
View File

@ -1,12 +1,13 @@
*.html
!/src/about/resume.html
!src/cgit/*.html
!src/cgit/head.html
*.meta
*.mk
/post/list
!/docs/about/resume.html
rss.xml
/www-root
/cgit-root
/papers/*.pdf
/papers/*.dvi

View File

@ -35,6 +35,7 @@ phtml := $(postsrc:.md=.html)
pmk := $(pmeta:.meta=.mk)
www-root = www-root
cgit-root = cgit-root
# articles in TeX
texticles = $(wildcard papers/*/)
@ -62,7 +63,7 @@ RSS_N=10
export WWW_URL
.PHONY: default clean webroot
.PHONY: default clean webroot cgitroot
default: www-root
@ -132,5 +133,11 @@ papers/%.dvi: papers/%/abstract.tex
docs/papers/.list: thoughts articles
echo "$(articles) $(texticles)" | tr ' ' '\n' | tools/doclist >$@
cgitroot: $(cgit-root)/head.html $(cgit-root)/header.html $(cgit-root)/footer.html \
$(cgit-root)/cgitrc
$(cgit-root)/%: src/cgit/%
install -Dma+r $< $@
clean:
rm -rf $(www-root) $(pmeta) $(phtml) $(pmk)
rm -rf $(www-root) $(pmeta) $(phtml) $(pmk) $(cgit-root)

View File

@ -1,74 +0,0 @@
</div>
<footer>
<div id="rss"><a href="rss.xml">RSS</a></div>
<hr />
<div class="pre-copyright"> <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/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></div>
<div class="pre-copyright"> <div id="selflinks">
<a href="https://gitlab.com/u/mikegerwitz">
<img src="/images/gitlab.svg"
alt="See me on GitLab"
title="See me on GitLab"
width="42" height="42" border="0"
/>
</a>
<a href="/about/githubbub">
<img src="/images/octoright-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>
<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>
</div></div>
<div id="copyright">
Copyright &copy; 2012&ndash;2017 Mike Gerwitz.
This content is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
</div>
<div>Output generated by cgit</div>
</footer>

27
src/cgit/footer.sh 100755
View File

@ -0,0 +1,27 @@
#!/bin/bash
# Extracts relevant portion of footer for cgit
#
# Copyright (C) 2019 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/>.
##
set -euo pipefail
main()
{
awk 'NR==1,/<\/footer>/{ print }' < src/footer.tpl.htm
}
main "$@"

View File

@ -1,9 +0,0 @@
<div class="body-index no-sidebar">
<header>
<h1 class="title"><a href="http://mikegerwitz.com">Mike Gerwitz</a></h1>
<h2 class="desc">Free Software Hacker+Activist</h2>
</header>
<ul id="menu">
<li><a href="/about">About</a></li><li><a href="/projects">Projects</a></li><li><a href="/papers">Papers</a></li><li><a href="/talks">Talks</a></li><li><a href="//social.mikegerwitz.com/" title="My GNU Social Instance">Social</a></li>
</ul>

27
src/cgit/header.sh 100755
View File

@ -0,0 +1,27 @@
#!/bin/bash
# Extracts relevant portion of header for cgit
#
# Copyright (C) 2019 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/>.
##
set -euo pipefail
main()
{
awk '/<header>/,/<main>/{ print }' < <( src/mkheader projects )
}
main "$@"