I was fiddling with a comic script template shared by someone who is published by Vertigo, and they noted that the beginning of each “comic page” document should start with how many panels there are on that script page. I also began fiddling with it, making descriptive information for a comic page into the parent, and each panel into a separate document.
One essential bit of info on this template that cannot be automated is to note how many panels are to end up on the comic page; that has be counted and entered by hand. But what if there were a <$subdoccount> tag that would fill in the number of children of that document? It’s available in the binder if you enable that feature, so the number of subdocuments should be available to the compile process. A companion value might be <$subdoconelevelcount> : a count of the immediate sub-documents only.