fix highlighting on console.html files

the console.html files had improper highlighting because of extra
nesting of pre tags. This was missed the first time around, but
has been driving me nuts for weeks.

The solution is to drop pre tags from files when processing them,
as we're going to wrap it in our own pre tags later. Tests are
updated for the new format.

Change-Id: I5b7f2b0a25ae27a218c51fb73b5fde5055b51578
This commit is contained in:
Sean Dague 2014-05-03 06:24:48 -04:00
parent c10c8fb746
commit f7d23a2657
2 changed files with 16 additions and 5 deletions

View File

@ -83,12 +83,18 @@ class TestFilters(base.TestCase):
# we shouldn't be dropping anything with the first line
line = gen.next()
self.assertEqual("<span class='line'><pre>\n</span>", line)
line = gen.next()
self.assertIn("<a name='_2013-09-27_18_07_11_860' "
"class='date' href='#_2013-09-27_18_07_11_860'>", line)
self.assertIn(
"</span><span class='line _2013-09-27_18_07_11_860'>"
"<a name='_2013-09-27_18_07_11_860' class='date' "
"href='#_2013-09-27_18_07_11_860'>2013-09-27 18:07:11.860</a> | "
"Started by user <a href='https://jenkins02.openstack.org/user"
"/null' class='model-link'>anonymous</a>",
line)
line = gen.next()
self.assertIn("<a name='_2013-09-27_18_07_11_884' "
"class='date' href='#_2013-09-27_18_07_11_884'>", line)
line = gen.next()
self.assertIn("<a name='_2013-09-27_18_09_18_784' "
"class='date' href='#_2013-09-27_18_09_18_784'>", line)

View File

@ -252,6 +252,11 @@ def html_filter(fname, minsev):
yield _css_preamble(supports_sev)
for line in fileinput.FileInput(fname, openhook=fileinput.hook_compressed):
# skip pre lines coming off the file, this fixes highlighting on
# console logs
if re.match('<(/)?pre>$', line):
continue
if should_escape:
newline = escape_html(line)
else: