mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
Add a tool to draw the Django template inheritance graph
(imported from commit e10bb719d62a76abfea76c7fc69093a3cc33272e)
This commit is contained in:
1
templates/.gitignore
vendored
Normal file
1
templates/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/graph.svg
|
18
tools/django-template-graph
Executable file
18
tools/django-template-graph
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# Draws the Django template inheritance graph.
|
||||
|
||||
cd "$(dirname "$0")"/../templates
|
||||
|
||||
(
|
||||
echo 'digraph {'
|
||||
for t in $(find -name '*.html' -printf '%P\n'); do
|
||||
echo "\"$t\";"
|
||||
perl -lne 'print "\"'"$t"'\" -> \"$1\";" if m/{%\s*extends\s*"([^"]+)"/' "$t"
|
||||
done
|
||||
echo '}'
|
||||
) > graph.dot
|
||||
|
||||
dot -Tsvg graph.dot > graph.svg
|
||||
rm graph.dot
|
||||
echo file://"$(pwd)"/graph.svg
|
Reference in New Issue
Block a user