ts2: Improve the output of processed TS files

 - Pretty-print empty tags without self-closing them
 - Always preserve TS doctype
 - Add a test reusing existing ts data