%def name="render_line(line_num, tokens,
annotation=None,
bgcolor=None, show_annotation=None)">
<%
from rhodecode.lib.codeblocks import render_tokenstream
# avoid module lookup for performance
html_escape = h.html_escape
%>
% if annotation:
% if show_annotation:
${h.gravatar_with_user(annotation.author, 16) | n}
${h.chop_at_smart(annotation.message, '\n', suffix_if_chopped='...')}
|
|
r${annotation.revision}
|
% else:
|
|
|
% endif
% else:
|
% endif
|
## newline at end is necessary for highlight to work when line is empty
## and for copy pasting code to work as expected
${render_tokenstream(tokens)|n}${'\n'}
|
%def>
<%def name="render_annotation_lines(annotation, lines, color_hasher)">
% for line_num, tokens in lines:
${render_line(line_num, tokens,
bgcolor=color_hasher(annotation and annotation.raw_id or ''),
annotation=annotation, show_annotation=loop.first
)}
% endfor
%def>