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):