Fix #1586 and add tests for more coverage

This fixes a regression in 1.4.0 where a tag followed by a single space was inadvertently seen as "pipeless-text" which resulted in an exception.

It also removes some code that was made redundant by this fix and adds tests for the error messages thrown by getting `include:filter` wrong.

I'm going to merge this straight away, since it fixes a bug in last night's release but let me know if anything needs fixing/tidying up.