Index: utils/opt-viewer/opt-viewer.py =================================================================== --- utils/opt-viewer/opt-viewer.py +++ utils/opt-viewer/opt-viewer.py @@ -184,18 +184,29 @@ '''.format(filename), file=self.stream) self.html_formatter = HtmlFormatter(encoding='utf-8') - self.cpp_lexer = CppLexer() + self.cpp_lexer = CppLexer(stripnl=False) - def render_source_line(self, linenum, line): - html_line = highlight(line, self.cpp_lexer, self.html_formatter) - print(''' + def render_source_lines(self, stream, line_remarks): + file_text = stream.read() + html_highlighted = highlight(file_text, self.cpp_lexer, self.html_formatter) + + # Take off the header and footer, these must be + # reapplied line-wise, within the page structure + html_highlighted = html_highlighted.replace('
', '')
+ html_highlighted = html_highlighted.replace('
{html_line}