Added tex documents to build process

master
Mike Gerwitz 2013-06-03 22:28:55 -04:00
parent e24910415f
commit e981ac9c71
2 changed files with 55 additions and 5 deletions

View File

@ -19,9 +19,11 @@
pages := $(patsubst %.pg, %.html, \
$(shell find docs/ -name '*.pg'))
articles := $(patsubst %.txt, %.html, \
$(shell find docs/ -name '*.txt'))
$(shell find docs/ -maxdepth 2 -name '*.txt'))
# articles in TeX with an inappropriate var name
texticles=$(patsubst %/, %.html, $(dir $(shell find docs/ -name 'Makefile')))
www_root := www-root/
url_root := http://mikegerwitz.com/
url_root := http://mikegerwitz.com
repo_url := https://gitorious.org/mtg-personal/thoughts
repo_commit_url := '$(repo_url)/commit/%s'
@ -37,7 +39,7 @@ repo2html := repo2html \
-U '$(repo_commit_url)' \
-E
.PHONY: default clean pages articles thoughts
.PHONY: default clean pages articles thoughts docs
default: www-root
@ -58,18 +60,27 @@ thoughts:
$<
./tools/mgify "$@"
# "pages"
%.html: %.pg docs/papers/.list
$(repo2html) -icontent -ftools/extfmt <$< >$@
# TeX papers are expected to have their own makefiles as well as an abstract.tex
%.html: coope/%.tex
$(MAKE) -C '$(dir $<)' pdf dvi
url_root='$(url_root)' ./tools/texdoc '$(dir $<)' | $(repo2html) -icontent -ftools/extfmt >$@
docs/papers/.list: thoughts $(articles)
echo "$(articles)" | tr ' ' '\n' | tools/doclist >$@
pages: $(pages)
articles: $(articles)
articles: $(articles) $(texticles)
docs: pages articles
www-root: docs thoughts
mkdir -p www-root/papers
( cd docs/ && find . -name '*.html' -exec ../tools/doc-cp {} ../www-root/{} \; )
( cd docs/ \
&& find . -maxdepth 2 -name '*.html' -exec ../tools/doc-cp {} ../www-root/{} \; \
&& find . -maxdepth 3 -name '*.pdf' -o -name '*.dvi' -exec cp {} ../www-root/{} \; \
)
cp -r images/ www-root/
cp style.css www-root/
ln -sf ../images www-root/papers/images

39
tools/texdoc 100755
View File

@ -0,0 +1,39 @@
#!/bin/bash
#
# Generates HTML page for a paper written with TeX
#
# Copyright (C) 2013 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/>.
##
path="${1%/}"
abstract="$path/abstract.tex"
main="$path/${path##*/}.tex"
base="$( basename "$path" )"
# grab the title from the first line of the main source file
head -n1 "$main" | sed '1s/^% //;1a\\'
(
tr '\n' ' ' \
| sed 's/\\[^ ]\+\({[^}]\+}\)\?//g;$a\\'
# all articles should provide PDF and DVI
cat <<EOF
**Download:** [PDF][0] or [DVI][1]
[0] $url_root/${path#*/}/$base.pdf
[1] $url_root/${path#*/}/$base.dvi
EOF
) < "$abstract"