doc.sh
1 #!/bin/bash 2 set -euo pipefail 3 IFS=$'\n\t' 4 5 project=$(basename -- $(realpath "./")) 6 type_pattern='Type$' 7 8 echo '<html>' 9 echo '<head>' 10 echo '<title>'$project'</title>' 11 echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' 12 echo '</head>' 13 echo '<body>' 14 echo '<h1>'$project'</h1>' 15 16 for f in $(./scripts/find-dhall-files.sh) 17 do 18 if [ -d "$f" ]; then 19 echo '<h2 style="background-color: #bbb; width: 100%">'$f'</h2>' 20 else 21 type=$(dhall resolve <<< $f | dhall type) 22 if [[ $type =~ $type_pattern ]] ; then 23 echo "<h3>"$(basename -- "$f")" (type)</h3>"; 24 echo '<dl>' 25 echo '<dt>kind</dt><dd><pre>' 26 echo "$type" 27 echo '</pre></dd>' 28 echo '<dt>type</dt><dd><pre>' 29 dhall <<< $f 30 echo '</pre></dd>' 31 echo '</dl>' 32 else 33 echo "<h3>"$(basename -- "$f")" (term)</h3>"; 34 echo '<dl>' 35 echo '<dt>type</dt><dd><pre>' 36 echo "$type" 37 echo '</pre></dd>' 38 echo '</dl>' 39 fi 40 fi 41 done 42 43 echo '</body></html>'