bug 850840 issue with id attribute on body element

this is a fix as discussed in bugzilla for bug 850840 - issue with id attribute on body element.
Can you move the `{% endif %}` to include the trailing space? This will make it include `id="blah" ` when an id is provided and avoid 2 spaces after `<body` when it's not.