Truncate lines in parser errors.

The offending lines of code displayed in the error message are truncated to 80
characters. This should make reading the error messages less of a pain when
dealing with very long lines of HTML/XML.
This commit is contained in:
Yorick Peterse 2014-04-10 10:08:51 +02:00
parent 292a98d7f6
commit c974b96b88
1 changed files with 7 additions and 1 deletions

View File

@ -204,7 +204,13 @@ end
prefix = ' ' prefix = ' '
end end
code << "#{prefix}#{number}: #{line.strip}\n" line = line.strip
if line.length > 80
line = line[0..79] + ' (more)'
end
code << "#{prefix}#{number}: #{line}\n"
end end
end end