2016-01-12 13:08:43 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2012-10-16 06:31:47 +02:00
|
|
|
|
|
|
|
# Draws the Django template inheritance graph.
|
|
|
|
|
|
|
|
cd "$(dirname "$0")"/../templates
|
|
|
|
|
|
|
|
(
|
|
|
|
echo 'digraph {'
|
2018-08-03 02:14:49 +02:00
|
|
|
find . -name '*.html' -printf '%P\n' | while read -r t; do
|
2012-10-16 07:45:37 +02:00
|
|
|
echo "\"$t\";" | sed 's|/|\\n|g'
|
|
|
|
perl -lne 'print "\"'"$t"'\" -> \"$1\";" if m/{%\s*extends\s*"([^"]+)"/' "$t" \
|
|
|
|
| sed 's|/|\\n|g'
|
2012-10-16 06:31:47 +02:00
|
|
|
done
|
|
|
|
echo '}'
|
|
|
|
) > graph.dot
|
|
|
|
|
|
|
|
dot -Tsvg graph.dot > graph.svg
|
|
|
|
rm graph.dot
|
|
|
|
echo file://"$(pwd)"/graph.svg
|