Fake line numbers, ugh.
parent
9f0abed499
commit
e1f7477d25
|
@ -19,7 +19,26 @@
|
|||
{{ snipt.stylized|safe }}
|
||||
</div>
|
||||
{% else %}
|
||||
{{ snipt.stylized|safe }}
|
||||
{% if 'linenos' not in snipt.stylized %}
|
||||
<table class="highlighttable fakenos">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="linenos">
|
||||
<div class="linenodiv">
|
||||
<pre>
|
||||
{% generate_line_numbers for snipt.line_count %}
|
||||
</pre>
|
||||
</div>
|
||||
</td>
|
||||
<td class="code">
|
||||
{{ snipt.stylized|safe }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
{{ snipt.stylized|safe }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if snipt.line_count > 8 and not detail and 'snipt-expand' not in snipt.tags_list %}
|
||||
<a href="#" class="expand">
|
||||
|
|
|
@ -47,6 +47,14 @@ def get_lexers(context, asvar):
|
|||
context[asvar] = get_lexers_list()
|
||||
return ''
|
||||
|
||||
@tag(register, [Constant('for'), Variable()])
|
||||
def generate_line_numbers(context, line_numbers):
|
||||
html = ''
|
||||
|
||||
for i in range(1, line_numbers + 1):
|
||||
html = html + '<span class="special">{}</span>'.format(i)
|
||||
|
||||
return html
|
||||
|
||||
@register.filter
|
||||
def md5(string):
|
||||
|
|
Loading…
Reference in New Issue