fix(2848) support templates with td/tr/th/tbody root nodes

Some hack-ish logic to get compile to avoid throwing up on table content as root nodes.

I'm sure this can be improved upon, and certain things (like the regexp) could be moved outside of the function. Suggestions would be good.

Fixes #2848