#!/bin/bash
# Regenerate html files.
set -e
( cd linkify; build; )
# generate html/$1.html using /tmp/tags
process() {
rm -f html/$1.html
convert_html $1
linkify/linkify /tmp/tags html/$1.html
mv html/$1.html.out html/$1.html
}
convert_html() {
vim -c "set number" -c TOhtml -c write -c qall $1
sed -i 's,
.*/mu/,Mu - ,' $1.html
sed -i 's,\.html,,' $1.html
sed -i 's/^\* { \(.*\) }/* { font-size:12pt; \1 }/g' $1.html
sed -i 's/^body { \(.*\) }/body { font-size:12pt; \1 }/g' $1.html
# turn most code grey
sed -i 's/#eeeeee/#aaaaaa/g' $1.html
# line numbers are darker than normal
sed -i 's/^\.LineNr .*/.LineNr { color:#444444; }/' $1.html # line numbers
# tweak contrast for remaining colors
sed -i 's/^\.Constant .*/.Constant { color:#00a0a0; }/' $1.html
sed -i 's/^\.muControl .*/.muControl { color:#c0a020; }/' $1.html
# comment colors manually adjusted for better contrast; browser has >256 colors
sed -i 's/^\.Delimiter .*/.Delimiter { color:#800080; }/' $1.html # not meant to be read; can be lower-contrast
sed -i 's/^\.PreProc .*/.PreProc { color:#800080; }/' $1.html # not meant to be read; can be lower-contrast
sed -i 's/^\.Identifier .*/.Identifier { color:#c0a020; }/' $1.html # same as muControl
sed -i 's/^\.Special .*/.Special { color:#c00000; }/' $1.html # same as traceAbsent..
sed -i 's/^\.subxH1Comment.*/.subxH1Comment { color:#00ffff; }/' $1.html
sed -i 's/^\.subxComment.*/.subxComment { color:#16bfff; }/' $1.html
sed -i 's/^\.subxS1Comment.*/.subxS1Comment { color:#2d8cff; }/' $1.html
sed -i 's/^\.subxS2Comment.*/.subxS2Comment { color:#4466ff; }/' $1.html # slightly too dark
# comment links in regular colors, just underlined
sed -i '/^body {/ a .subxH1Comment a { color:inherit; }' $1.html
sed -i '/^body {/ a .subxH2Comment a { color:inherit; }' $1.html
sed -i '/^body {/ a .subxComment a { color:inherit; }' $1.html
sed -i '/^body {/ a .subxS1Comment a { color:inherit; }' $1.html
sed -i '/^body {/ a .subxS2Comment a { color:inherit; }' $1.html
# 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
mv -i $1.html html/`dirname $1`
}
ctags -x *.cc |grep -v "^operator \| member \| variable " > /tmp/tags
for f in *.cc
do
process $f
done
ctags -x [0-9]*.mu > /tmp/tags
for f in [0-9]*.mu
do
process $f
done
for f in [a-zA-Z]*.mu
do
ctags -x [0-9]*.mu $f > /tmp/tags
process $f
done
( cd edit
ctags -x ../[0-9]*.mu *.mu > /tmp/tags
)
for f in edit/*.mu
do
process $f
done
( cd subx
ctags -x *.cc |grep -v '^. ' > /tmp/tags # don't hyperlink every 'i' to the integer register variant
)
for f in subx/*.cc
do
process $f
done
echo > /tmp/tags
for f in subx/*.subx subx/examples/*.subx subx/apps/*.subx
do
process $f
done
rm /tmp/tags
( cd linkify; clean; )