%def name="render_line(line_num, tokens,
annotation=None,
bgcolor=None)">
<%
# avoid module lookups for performance
from rhodecode.lib.codeblocks import pygment_token_class
from rhodecode.lib.helpers import html_escape
%>
|
${
''.join(
'%s' %
(pygment_token_class(token_type), html_escape(token_text))
for token_type, token_text in tokens) + '\n' | n
} |
## this ugly list comp is necessary for performance
%def>
<%def name="render_annotation_lines(annotation, lines, color_hasher)">
<%
rowspan = len(lines) + 1 # span the line's and annotation
%>
%if not annotation:
|
|
%else:
${h.gravatar_with_user(annotation.author, 16) | n}
${
h.truncate(annotation.message, len(lines) * 30)
}
|
r${annotation.revision}
|
%endif
%for line_num, tokens in lines:
${render_line(line_num, tokens,
bgcolor=color_hasher(annotation and annotation.raw_id or ''),
annotation=annotation,
)}
%endfor
%def>