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])
_BETWEEN_TAGS_RE = re.compile(r"<br />\s+<")
def hexdoc_minify(value: str) -> str:
merged_lines = "".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,
# )
return "".join(line.strip() for line in value.splitlines())
def hexdoc_block(value: Any, allow_none: bool = False) -> str:

View file

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

View file

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

View file

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

View file

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

View file

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