Make the parser service slightly more robust against serializer failures

Change-Id: I50624a56fd0319f6acb6fd1c171c7c6f92a97d31
This commit is contained in:
Gabriel Wicke 2012-07-11 12:01:05 +02:00
parent ebcd6d2941
commit 64d2a089d8

View file

@ -264,6 +264,9 @@ var roundTripDiff = function ( req, res, src, document ) {
res.write(document.body.innerHTML + '<hr>'); res.write(document.body.innerHTML + '<hr>');
res.write( '<h2>HTML DOM converted back to Wikitext</h2><hr>' ); res.write( '<h2>HTML DOM converted back to Wikitext</h2><hr>' );
var out = new WikitextSerializer({env: env}).serializeDOM( document.body ); var out = new WikitextSerializer({env: env}).serializeDOM( document.body );
if ( out === undefined ) {
out = "An error occured in the WikitextSerializer, please check the log for information";
}
res.write('<pre>' + htmlSpecialChars( out ) + '</pre><hr>\n'); res.write('<pre>' + htmlSpecialChars( out ) + '</pre><hr>\n');
res.write( '<h2>Diff between original Wikitext (green) and round-tripped wikitext (red)</h2><hr>\n' ); res.write( '<h2>Diff between original Wikitext (green) and round-tripped wikitext (red)</h2><hr>\n' );
var patch; var patch;