From: W. Trevor King Date: Tue, 14 Sep 2010 17:38:29 +0000 (-0400) Subject: Improve html_toc.py parser error messages. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e015ac050c62b06c6ca0a81f073db4db286ca2ea;p=parallel_computing.git Improve html_toc.py parser error messages. --- diff --git a/_script/html_toc.py b/_script/html_toc.py index 0375ded..b530fad 100755 --- a/_script/html_toc.py +++ b/_script/html_toc.py @@ -47,8 +47,12 @@ class ToCTree (object): tree = etree.parse(StringIO('\n'.join(lines)), parser=parser) if len(parser.error_log) > 0: print >> sys.stderr, '%s: parsing error' % self._path - print >> sys.stderr, '(listed lines offset by +2)' - print >> sys.stderr, parser.error_log + for error in parser.error_log: + print >> sys.stderr, ' '+'\n '.join([ + '%s (line %d)' % (error.message, error.line-2), + ' '+lines[error.line][:error.column], + ' '+' '*error.column + lines[error.line][error.column:], + ]) return (tree, 2) def _page_title(self):