Detect bulleted lists and set margin-bottom to 0.

This commit is contained in:
Edward Betts 2018-06-04 07:45:44 +01:00
parent cb3ae7d3a9
commit 9084dba5c1
2 changed files with 7 additions and 3 deletions

View file

@ -14,3 +14,7 @@ html, body {
.btn { .btn {
font-family: sans-serif; font-family: sans-serif;
} }
.margin-bottom-zero {
margin-bottom: 0;
}

View file

@ -66,11 +66,11 @@
<p>Revision as of {{ version.modified.strftime('%H:%M, %d %B %Y') }}</p> <p>Revision as of {{ version.modified.strftime('%H:%M, %d %B %Y') }}</p>
{% endif %} {% endif %}
<div class="card mb-2" id="text"> <div class="card mb-2 px-2" id="text">
<div class="card-block"> <div class="card-block">
{% if span_length %} {% if span_length %}
{%- for start, line in add_highlight(text, span_start, span_length) if line -%} {%- for start, line in add_highlight(text, span_start, span_length) if line -%}
<p class="card-text" data-start="{{ start }}"> <p class="card-text{% if line.0.text.startswith('-') %} margin-bottom-zero{% endif %}" data-start="{{ start }}">
{% for i in line %} {% for i in line %}
{%- if i.highlight -%} {%- if i.highlight -%}
{%- if i.highlight != '\n' and i.highlight != '\r\n' -%} {%- if i.highlight != '\n' and i.highlight != '\r\n' -%}
@ -86,7 +86,7 @@
{%- for start, line in iter_lines(text) if line != '\r\n' -%} {%- for start, line in iter_lines(text) if line != '\r\n' -%}
{# <p data-start="{{ start }}">{% if line != "\n" and line != "\r\n" %}{{ line }}{% else %}&nbsp;{% endif {# <p data-start="{{ start }}">{% if line != "\n" and line != "\r\n" %}{{ line }}{% else %}&nbsp;{% endif
%}</p>#} %}</p>#}
<p data-start="{{ start }}">{{ nbsp_at_start(line) }}</p> <p class="card-text{% if line.startswith('-') %} margin-bottom-zero{% endif %}" data-start="{{ start }}">{{ nbsp_at_start(line) }}</p>
{%- endfor -%} {%- endfor -%}
{% endif %} {% endif %}
</div> </div>