mu/tools/update_html

74 lines
1.8 KiB
Plaintext
Raw Normal View History

2016-10-12 05:38:46 +00:00
#!/bin/bash
2015-05-31 02:30:33 +00:00
# Regenerate html files.
2019-09-01 05:34:26 +00:00
# If given a single argument, regenerate just that file.
2015-05-31 02:30:33 +00:00
2016-12-27 19:14:12 +00:00
set -e
( cd tools; c++ -g linkify.cc -o linkify; )
2017-11-05 19:17:34 +00:00
# generate html/$1.html using /tmp/tags
2015-09-07 17:37:27 +00:00
process() {
rm -f html/$1.html
2017-11-05 19:17:34 +00:00
convert_html $1
tools/linkify /tmp/tags html/$1.html
2017-11-05 19:17:34 +00:00
mv html/$1.html.out html/$1.html
}
2018-12-01 22:13:33 +00:00
URL_BASE='https://github.com/akkartik/mu/blob/master'
2017-11-05 19:17:34 +00:00
convert_html() {
vim -c "set number" -c TOhtml -c write -c qall $1
2015-09-07 17:37:27 +00:00
sed -i 's,<title>.*/mu/,<title>Mu - ,' $1.html
2015-09-07 17:37:27 +00:00
sed -i 's,\.html</title>,</title>,' $1.html
2018-12-01 22:13:33 +00:00
sed -i "/^<body/a <a href='$URL_BASE/$1'>$URL_BASE/$1</a>" $1.html
2018-11-30 22:19:59 +00:00
sed -i 's/^\* { \(.*\) }/* { font-size:12pt; \1 }/g' $1.html
sed -i 's/^body { \(.*\) }/body { font-size:12pt; \1 }/g' $1.html
2015-09-07 17:37:27 +00:00
sed -i '/^body {/a a { color:inherit; }' $1.html
2016-11-25 19:04:14 +00:00
# switch unicode characters around in the rendered html
# the ones we have in the source files render double-wide in html
# the ones we want in the html cause iTerm2 to slow down in alt-tabbing for some reason
# the following commands give us the best of both worlds
sed -i -e 's/┈/╌/g' -e 's/┊/╎/g' $1.html
2015-09-07 17:37:27 +00:00
mv -i $1.html html/`dirname $1`
}
2020-01-20 01:53:06 +00:00
ctags -x *.cc |grep -v '^. ' > /tmp/tags # don't hyperlink every 'i' to the integer register variant
for f in *.cc
do
test $# -gt 0 && test $1 != $f && continue
process $f
done
2020-07-11 07:02:29 +00:00
ctags -x [0-9]*.subx [0-9]*.mu > /tmp/tags
for f in *.subx *.mu
2019-01-15 00:53:12 +00:00
do
2019-09-01 05:34:26 +00:00
test $# -gt 0 && test $1 != $f && continue
process $f
done
2020-01-02 23:23:01 +00:00
for f in apps/*.subx
do
2019-09-01 05:34:26 +00:00
test $# -gt 0 && test $1 != $f && continue
2020-01-02 23:23:01 +00:00
( cd apps
2020-07-11 07:02:29 +00:00
ctags -x ../[0-9]*.subx ../[0-9]*.mu `basename $f` > /tmp/tags
2020-01-02 23:23:01 +00:00
)
process $f
done
2020-01-20 01:53:06 +00:00
for f in apps/*.mu
do
test $# -gt 0 && test $1 != $f && continue
( cd apps
2020-07-11 07:02:29 +00:00
ctags -x ../[0-9]*.subx ../[0-9]*.mu `basename $f` > /tmp/tags
2020-01-20 01:53:06 +00:00
)
process $f
done
2018-09-08 05:42:23 +00:00
rm /tmp/tags