Fixed minimal mode with mixed text and attributes. Added unit test for it as well