Remove scuffed whitespace stripping

This commit is contained in:
object-Object 2023-07-19 21:51:43 -04:00
parent 46767353b0
commit d0d3023985
6 changed files with 16 additions and 33 deletions

View file

@ -28,21 +28,8 @@ class IncludeRawExtension(Extension):
return Markup(source[0]) return Markup(source[0])
_BETWEEN_TAGS_RE = re.compile(r"<br />\s+<")
def hexdoc_minify(value: str) -> str: def hexdoc_minify(value: str) -> str:
merged_lines = "".join(line.strip() for line in value.splitlines()) return "".join(line.strip() for line in value.splitlines())
# FIXME: hack
return _BETWEEN_TAGS_RE.sub("<br /><", merged_lines)
# return minify_html.minify(
# code=value,
# keep_closing_tags=True,
# keep_html_and_head_opening_tags=True,
# keep_spaces_between_attributes=True,
# ensure_spec_compliant_unquoted_attribute_values=True,
# )
def hexdoc_block(value: Any, allow_none: bool = False) -> str: def hexdoc_block(value: Any, allow_none: bool = False) -> str:

View file

@ -1,7 +1,7 @@
{% extends "pages/PageWithTitle.html.jinja" %} {% extends "pages/PageWithTitle.html.jinja" %}
{% block inner_body %} {% block inner_body %}
{{ super() }} {{- super() }}
<h4 class='linkout'> <h4 class='linkout'>
<a href='{{ page.url|hexdoc_block }}'>{{ page.link_text }}</a> <a href='{{ page.url|hexdoc_block }}'>{{ page.link_text }}</a>
</h4> </h4>

View file

@ -1,12 +1,9 @@
{% if page.anchor %} {%- if page.anchor -%}
{# set a variable so children can use this value #} {%- set page_anchor_id = entry.id.path ~ "@" ~ page.anchor -%}{# set a variable so children can use this value -#}
{% set page_anchor_id = entry.id.path ~ "@" ~ page.anchor %}
<div id='{{ page_anchor_id }}'> <div id='{{ page_anchor_id }}'>
{# body isn' required because EmptyPage uses this template directly #} {% block body scoped %}{% endblock %}{# not required because EmptyPage uses this template directly -#}
{% block body scoped %}{% endblock %}
</div> </div>
{% else %} {%- else -%}
{# can't define a block twice in the same template, so just reference it with self #} {{ self.body() }}{# can't define a block twice in the same template, so just reference it #}
{{ self.body() }} {%- endif -%}
{% endif %}
<br /> <br />

View file

@ -1,5 +1,5 @@
{% extends "pages/Page.html.jinja" %} {% extends "pages/Page.html.jinja" %}
{% block body %} {% block body %}
{{ page.text|hexdoc_block(true) }} {{- page.text|hexdoc_block(true) -}}
{% endblock body %} {% endblock %}

View file

@ -2,9 +2,8 @@
{% import "macros.html.jinja" as macros %} {% import "macros.html.jinja" as macros %}
{% block body %} {% block body %}
{% if page.title is not none %} {%- if page.title is not none -%}
{# we need title_attrs for PageWithPattern #} <h4{% block title_attrs %}{% endblock %}>{# we need title_attrs for PageWithPattern -#}
<h4{% block title_attrs %}{% endblock %}>
{{ page.title|hexdoc_block }} {{ page.title|hexdoc_block }}
{% if page_anchor_id is defined %} {# note: page_anchor_id is conditionally defined in Page #} {% if page_anchor_id is defined %} {# note: page_anchor_id is conditionally defined in Page #}
{{ macros.permalink(page_anchor_id) }} {{ macros.permalink(page_anchor_id) }}
@ -12,7 +11,7 @@
</h4> </h4>
{% endif %} {% endif %}
{# pretty sure this is the only good way to do this #} {# pretty sure this is the only good way to do this #}
{# and yes, winfy - this probably would have worked just fine in python too #} {# and yes, this probably would have worked just fine in python too #}
{% set outer_body = super() %} {% set super_body = super() %}
{% block inner_body scoped %}{{ outer_body }}{% endblock %} {% block inner_body scoped %}{{ super_body }}{% endblock %}
{% endblock body %} {% endblock body %}

View file

@ -1,6 +1,6 @@
{% extends "pages/PageWithTitle.html.jinja" %} {% extends "pages/PageWithTitle.html.jinja" %}
{% block inner_body %} {% block inner_body -%}
<h4 class='spotlight-title page-header'> <h4 class='spotlight-title page-header'>
{{ page.item }} {{ page.item }}
</h4> </h4>