diff --git a/data.go b/data.go
index 5c808d0..e866cf6 100644
--- a/data.go
+++ b/data.go
@@ -51,6 +51,9 @@ type ZasData struct {
// onto the layout's
element since Body only carries the source
// body's inner HTML, not the element itself.
bodyAttrs map[string]string
+ // Tracks embed nesting depth for this render, guarding against a self-
+ // or mutually-embedding file recursing without bound.
+ embedDepth int
}
/*
diff --git a/embed_depth_test.go b/embed_depth_test.go
new file mode 100644
index 0000000..2a9f459
--- /dev/null
+++ b/embed_depth_test.go
@@ -0,0 +1,33 @@
+package zas
+
+import (
+ "os"
+ "strings"
+ "testing"
+
+ "github.com/melvinmt/gt"
+)
+
+// A file that embeds itself (directly, or through a cycle of mutually-
+// embedding files) recurses through parseAndReplace/handleEmbedTags without
+// bound now that raw HTML - including