#!/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 } URL_BASE='https://github.com/akkartik/mu/blob/master' convert_html() { 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 "/^$URL_BASE/$1" $1.html sed -i 's/^\* { \(.*\) }/* { font-size:12pt; \1 }/g' $1.html sed -i 's/^body { \(.*\) }/body { font-size:12pt; \1 }/g' $1.html sed -i '/^body {/a 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` } for f in subx/examples/*.subx do ( cd subx/examples ctags -x `basename $f` > /tmp/tags ) process $f done ( cd subx ctags -x *.subx > /tmp/tags ) for f in subx/*.subx do process $f done rm /tmp/tags ( cd linkify; clean; )