#!/bin/bash # Regenerate html files. set -e process() { vim -c "set number" -c TOhtml -c write -c qall $1 sed -i 's,\~/mu/,<title>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 # ..so that we can use white for cross-links (underlining only on hover) sed -i '/^body {/ a a:hover { text-decoration: underline; }' $1.html sed -i '/^body {/ a a { color:#eeeeee; text-decoration: none; }' $1.html # line numbers are darker still 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 # real links in comments continue to be the usual blue sed -i 's/^\.Comment .*/.Comment { color: #9090ff; }\n.Comment a { color:#0000ee; text-decoration:underline; }/' $1.html 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.. # 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` } if [ $# -gt 0 ] then for f in $* do process $f done exit 0 fi rm html/*.html html/edit/*.html for f in *.cc *.mu edit/*.mu do process $f done if which ctags >&/dev/null then ( cd linkify; build; ) ctags -x *.cc |grep -v "^operator \| member \| variable " > cpp.tags linkify/linkify cpp.tags html/*.cc.html rm cpp.tags ctags -x [0-9]*.mu > mu.tags linkify/linkify mu.tags html/[0-9]*.mu.html for f in [a-zA-Z]*.mu do ctags -x [0-9]*.mu $f > mu.tags linkify/linkify mu.tags html/$f.html done rm mu.tags ( cd edit ctags -x ../[0-9]*.mu *.mu > mu.tags ../linkify/linkify mu.tags ../html/edit/*.mu.html rm mu.tags ) ( cd linkify; clean; ) for f in html/*.html html/edit/*.html do mv $f.out $f done fi