Make tags wellformed

The last script in this part of the workflow creates some more well-formed tags and replaces some characters with the respective XML entities.
Read more about this script in the wiki.