about summary refs log tree commit diff stats
path: root/fnl
diff options
context:
space:
mode:
authorelioat <elioat@tilde.institute>2023-10-30 15:58:24 -0400
committerelioat <elioat@tilde.institute>2023-10-30 15:58:24 -0400
commita0c4292dc2ea9ee11ab3aceda4aa5ced31ba8dcf (patch)
tree46e09cb4fcd95e9adf02fa9026884b46eb8fc749 /fnl
parent49cd6866163f168c95d3b18692710464440fc0ab (diff)
downloadtour-a0c4292dc2ea9ee11ab3aceda4aa5ced31ba8dcf.tar.gz
*
Diffstat (limited to 'fnl')
0 files changed, 0 insertions, 0 deletions
a id='n80' href='#n80'>80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
#!/bin/bash
# Regenerate html files.
# If given a single argument, regenerate just that file.

set -e

( cd tools; c++ -g linkify.cc -o linkify; )

# generate html/$1.html using /tmp/tags
process() {
  mkdir -p html/`dirname $1`
  rm -f html/$1.html
  convert_html $1
  tools/linkify /tmp/tags html/$1.html
  mv html/$1.html.out html/$1.html
}

URL_BASE='https://github.com/akkartik/mu/blob/main'

convert_html() {
  vim -c "set number" -c TOhtml -c write -c qall $1

  sed -i 's,<title>.*/mu/,<title>Mu - ,' $1.html
  sed -i 's,\.html</title>,</title>,' $1.html

  sed -i "/^<body/a <a href='$URL_BASE/$1'>$URL_BASE/$1</a>" $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`
}

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

ctags -x [0-9]*.subx [0-9]*.mu  > /tmp/tags
for f in *.subx *.mu
do
  test $# -gt 0  &&  test $1 != $f  &&  continue
  process $f
done

for f in apps/*.subx
do
  test $# -gt 0  &&  test $1 != $f  &&  continue
  ( cd apps
    ctags -x ../[0-9]*.subx ../[0-9]*.mu `basename $f` > /tmp/tags
  )
  process $f
done

for f in apps/*.mu
do
  test $# -gt 0  &&  test $1 != $f  &&  continue
  ( cd apps
    ctags -x ../[0-9]*.subx ../[0-9]*.mu `basename $f` > /tmp/tags
  )
  process $f
done

for f in apps/*/*.mu
do
  test $# -gt 0  &&  test $1 != $f  &&  continue
  ( cd `dirname $f`
    ctags -x ../../[0-9]*.subx ../../[0-9]*.mu *.mu > /tmp/tags
  )
  process $f
done

for f in baremetal/*.hex
do
  test $# -gt 0  &&  test $1 != $f  &&  continue
  ( cd baremetal
    ctags -x [0-9]*.subx [0-9]*.mu `basename $f` > /tmp/tags
  )
  process $f
done

for f in baremetal/*.subx
do
  test $# -gt 0  &&  test $1 != $f  &&  continue
  ( cd baremetal
    ctags -x [0-9]*.subx [0-9]*.mu `basename $f` > /tmp/tags
  )
  process $f
done

for f in baremetal/*.mu
do
  test $# -gt 0  &&  test $1 != $f  &&  continue
  ( cd baremetal
    ctags -x [0-9]*.subx [0-9]*.mu `basename $f` > /tmp/tags
  )
  process $f
done

for f in baremetal/*/*.mu
do
  test $# -gt 0  &&  test $1 != $f  &&  continue
  ( cd `dirname $f`
    ctags -x ../../[0-9]*.subx ../../[0-9]*.mu *.mu > /tmp/tags
  )
  process $f
done

rm /tmp/tags