fixed it. there was an unclosed comment in the code. I found it by copying the template to the sandbox, and replacing all "{#" with "{safesubst:#", then looking at the preview of a substituted version, which showed the problem pretty clearly. my other method of debugging is to just start substituting the template in one of my own personal sandboxes until I see the problem. I use a regexp search/replace javascript tool for automating the "replace all" stuff.
Removing underscores from filenames (to aid linewrapping)
Headings
== Main heading within article ==
{{main|...}} <!--{{main/seealso/futher}}s first-->
[[File:...]] <!--then images-->
<!--then single blankline-->
Article text continues...
===Subheading=== / ====Subsubheading====
{{main|...}} <!--as above,-->
[[File:...]] <!--except no blankline-->
Article text continues without blank line above...
{{vlist}} for lists presented as a column (without bullets).
{{hlist}} for lists presented as strings (separated by dots).