Fix #1284: Regression: Invalid XHTML in shiny exception template when first line in stack frame is HTML. Adds test for this and other issues. Also refs #1009, #1240 and #1242