# HG changeset patch # User Matthew Wild # Date 1536851145 -3600 # Node ID ba8219ac7484c3ffa57d7e506fbc4fe61f649ca0 # Parent 8191f165b9dd19f73898b5d62ef74df8e7d970fe scansion.pretty: Just emit input on invalid XML diff -r 8191f165b9dd -r ba8219ac7484 scansion/pretty.lua --- a/scansion/pretty.lua Thu Sep 13 16:05:24 2018 +0100 +++ b/scansion/pretty.lua Thu Sep 13 16:05:45 2018 +0100 @@ -66,7 +66,10 @@ end return function (s, ind) - local doc = assert(xml.parse(s)); + local doc = xml.parse(s); + if not doc then + return s; -- Not valid XML, don't prettify + end return pretty_print(doc, ind); end end