Here is a tiny contribution mine. A patch for xowiki/tcl/xowiki-procs.tcl. If we try to use an undefined variable, the page will crash (we have to edit back and remove the variable). This way, it returns (correctly, I think) the error log with the available @__template_variables__@ computed. Please apply the patch below against the current CVS version of xowiki patckage:
1311c1311
< return "Error in Page $name: $__errMsg
$contentPossible values are$__template_variables__"
---
> return [list "
Error in Page $name: $__errMsg
$contentPossible values are$__template_variables__" text/html]
This will return a list, as expected by class Page instproc substitute_markup.