#!/bin/sh

# Outputs the extra dependencies of a Markdown file.
#
# Must be run from the website directory.

cat ${1%.html}.md |
  awk '$1 == "```ttyshot" { getline; print $1 "-ttyshot.html" }'

cat ${1%.html}.md |
  awk '$1 == "@module" {
         if ($2 == "builtin") {
           print "eval"
         } else if ($2 == "edit") {
           print "eval"
         } else {
           print "mods/" $2
         }
       }' |
  while read dir; do
    echo ../pkg/$dir ../pkg/$dir/*.elv
  done
