about summary refs log blame commit diff stats
path: root/update_html
blob: 5ca4d74b2be1d12063dfeb86550cfa444464511b (plain) (tree)
1
2
3
4
5
6
7
8
9
10
           

                        
           
                                   


                                                

                                                                    



                                                                    

                                                                                                                   
                                                                                           
                                                                                         



                                 










                               
                            
  
            
    






                                                                                         
#!/bin/bash
# Regenerate html files.

process() {
  vim -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 's/^\* { \(.*\) }/* { font-size: 12pt; \1 }/g' $1.html
  sed -i 's/^body { \(.*\) }/body { font-size: 12pt; \1 }/g' $1.html
  # tweak contrast
  sed -i 's/^\.Constant .*/.Constant { color: #00a0a0; }/' $1.html
  sed -i 's/^\.muControl .*/.muControl { color: #c0a020; }/' $1.html
  sed -i 's/^\.Comment .*/.Comment { color: #9090ff; }/' $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..

  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

# switch the 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 's/┈/╌/g' html/edit/*.mu.html
sed -i 's/┊/╎/g' html/edit/*.mu.html