2016-10-12 05:38:46 +00:00
|
|
|
#!/bin/bash
|
2015-05-31 02:30:33 +00:00
|
|
|
# Regenerate html files.
|
2021-03-24 00:31:08 +00:00
|
|
|
# If given a single argument, try to regenerate just that file. Not supported everywhere.
|
2015-05-31 02:30:33 +00:00
|
|
|
|
2016-12-27 19:14:12 +00:00
|
|
|
set -e
|
|
|
|
|
2019-12-08 00:19:38 +00:00
|
|
|
( 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() {
|
2021-03-24 00:34:07 +00:00
|
|
|
mkdir -p html/$(dirname $1)
|
2017-11-06 09:28:53 +00:00
|
|
|
rm -f html/$1.html
|
2017-11-05 19:17:34 +00:00
|
|
|
convert_html $1
|
2021-03-24 00:41:31 +00:00
|
|
|
tools/linkify /tmp/tags $1.html
|
|
|
|
mv $1.html.out html/$1.html
|
|
|
|
rm $1.html
|
2017-11-05 19:17:34 +00:00
|
|
|
}
|
|
|
|
|
2020-12-30 17:37:50 +00:00
|
|
|
URL_BASE='https://github.com/akkartik/mu/blob/main'
|
2018-12-01 22:13:33 +00:00
|
|
|
|
2017-11-05 19:17:34 +00:00
|
|
|
convert_html() {
|
2021-11-11 20:52:51 +00:00
|
|
|
vim -c "set number" -c TOhtml -c write -c qall $1
|
2015-09-07 17:37:27 +00:00
|
|
|
|
2018-05-12 17:22:26 +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
|
|
|
|
2018-12-30 08:02:42 +00:00
|
|
|
sed -i '/^body {/a a { color:inherit; }' $1.html
|
2015-09-07 17:37:27 +00:00
|
|
|
}
|
|
|
|
|
2021-03-24 05:27:46 +00:00
|
|
|
ctags -x boot.subx [0-9]*.subx [0-9]*.mu > /tmp/tags
|
|
|
|
for f in boot.subx [0-9]*.subx [0-9]*.mu
|
2020-12-27 18:57:44 +00:00
|
|
|
do
|
|
|
|
test $# -gt 0 && test $1 != $f && continue
|
|
|
|
process $f
|
|
|
|
done
|
|
|
|
|
2021-03-24 00:31:08 +00:00
|
|
|
for f in [^0-9]*.subx [^0-9]*.mu
|
2020-12-27 18:57:44 +00:00
|
|
|
do
|
|
|
|
test $# -gt 0 && test $1 != $f && continue
|
2021-03-24 05:27:46 +00:00
|
|
|
test $f = "boot.subx" && continue
|
2021-03-24 06:02:41 +00:00
|
|
|
ctags -x boot.subx [0-9]*.subx [0-9]*.mu $f > /tmp/tags
|
2020-12-27 18:57:44 +00:00
|
|
|
process $f
|
|
|
|
done
|
|
|
|
|
2021-07-16 15:38:43 +00:00
|
|
|
for f in apps/*.mu
|
|
|
|
do
|
2021-09-01 21:21:04 +00:00
|
|
|
test $# -gt 0 && test $1 != $f && continue
|
2021-07-16 15:38:43 +00:00
|
|
|
( cd $(dirname $f)
|
|
|
|
ctags -x ../[0-9]*.subx ../[0-9]*.mu $(basename $f) > /tmp/tags
|
|
|
|
)
|
|
|
|
process $f
|
|
|
|
done
|
|
|
|
|
2021-03-24 00:31:08 +00:00
|
|
|
( cd shell
|
2021-03-24 06:02:41 +00:00
|
|
|
ctags -x ../boot.subx ../[0-9]*.subx ../[0-9]*.mu *.mu > /tmp/tags
|
2021-03-24 00:31:08 +00:00
|
|
|
)
|
|
|
|
for f in shell/*.mu
|
2020-12-27 18:57:44 +00:00
|
|
|
do
|
2021-08-12 02:44:20 +00:00
|
|
|
test $# -gt 0 && test $1 != $f && continue
|
2020-12-27 18:57:44 +00:00
|
|
|
process $f
|
|
|
|
done
|
|
|
|
|
2021-08-12 02:25:27 +00:00
|
|
|
( cd browse-slack
|
|
|
|
ctags -x ../boot.subx ../[0-9]*.subx ../[0-9]*.mu *.mu > /tmp/tags
|
|
|
|
)
|
|
|
|
for f in browse-slack/*.mu
|
|
|
|
do
|
2021-08-12 02:44:20 +00:00
|
|
|
test $# -gt 0 && test $1 != $f && continue
|
2021-08-12 02:25:27 +00:00
|
|
|
process $f
|
|
|
|
done
|
|
|
|
|
2021-11-11 20:52:51 +00:00
|
|
|
( cd linux
|
|
|
|
ctags -x [0-9]*.subx [0-9]*.mu > /tmp/tags
|
|
|
|
)
|
|
|
|
for f in linux/[0-9]*.subx linux/[0-9]*.mu
|
|
|
|
do
|
|
|
|
process $f
|
|
|
|
done
|
|
|
|
|
|
|
|
for f in linux/[^0-9]*.subx linux/[^0-9]*.mu
|
|
|
|
do
|
|
|
|
( cd $(dirname $f)
|
|
|
|
ctags -x [0-9]*.subx [0-9]*.mu $(basename $f) > /tmp/tags
|
|
|
|
)
|
|
|
|
process $f
|
|
|
|
done
|
|
|
|
|
|
|
|
for f in linux/apps/*.subx linux/apps/*.mu
|
|
|
|
do
|
|
|
|
( cd $(dirname $f)
|
|
|
|
ctags -x ../[0-9]*.subx ../[0-9]*.mu $(basename $f) > /tmp/tags
|
|
|
|
)
|
|
|
|
process $f
|
|
|
|
done
|
|
|
|
|
|
|
|
for f in linux/apps/advent2020/*.mu linux/apps/advent2017/*.mu
|
|
|
|
do
|
|
|
|
( cd $(dirname $f)
|
|
|
|
ctags -x ../../[0-9]*.subx ../../[0-9]*.mu $(basename $f) > /tmp/tags
|
|
|
|
)
|
|
|
|
process $f
|
|
|
|
done
|
|
|
|
|
|
|
|
( cd linux/tile
|
|
|
|
ctags -x ../[0-9]*.subx ../[0-9]*.mu *.mu > /tmp/tags
|
|
|
|
)
|
|
|
|
for f in linux/tile/*.mu
|
|
|
|
do
|
|
|
|
process $f
|
|
|
|
done
|
|
|
|
|
|
|
|
( cd linux/apps/raytracing
|
|
|
|
ctags -x ../../[0-9]*.subx ../../[0-9]*.mu *.mu > /tmp/tags
|
|
|
|
)
|
|
|
|
for f in linux/apps/raytracing/*.mu
|
|
|
|
do
|
|
|
|
process $f
|
|
|
|
done
|
|
|
|
|
|
|
|
( cd linux/bootstrap
|
|
|
|
ctags -x *.cc |grep -v '^. ' > /tmp/tags # don't hyperlink every 'i' to the integer register variant
|
|
|
|
)
|
|
|
|
for f in linux/bootstrap/*.cc
|
|
|
|
do
|
|
|
|
process $f
|
|
|
|
done
|
|
|
|
|
2018-09-08 05:42:23 +00:00
|
|
|
rm /tmp/tags
|