Logic to correct invalid HTML

Invalid HTML resulting from displayed math (a <div> will have as its parent a <p> - that's invalid) is now fixed. I am submitting it just yet to the official pelican plugin repositories because I would like people to test this. So if you use this plugin, please can you test the latest version and tell me if things are working