Give proper error message on badly placed extends tag.

Fixes #31. Related to #85, #60.

The extends tag really should be the very first thing in the template.