Merge pull request #4796 from manics/fix-redoc

Fix rest API djlint auto-formatting
This commit is contained in:
Min RK
2024-04-23 09:38:57 +02:00
committed by GitHub
2 changed files with 5 additions and 8 deletions

View File

@@ -42,6 +42,7 @@ repos:
- id: djlint-reformat-jinja - id: djlint-reformat-jinja
files: ".*templates/.*.html" files: ".*templates/.*.html"
types_or: ["html"] types_or: ["html"]
exclude: redoc.html
- id: djlint-jinja - id: djlint-jinja
files: ".*templates/.*.html" files: ".*templates/.*.html"
types_or: ["html"] types_or: ["html"]

View File

@@ -1,3 +1,4 @@
{# djlint: off #}
{%- extends "!layout.html" %} {%- extends "!layout.html" %}
{# not sure why, but theme CSS prevents scrolling within redoc content {# not sure why, but theme CSS prevents scrolling within redoc content
# If this were fixed, we could keep the navbar and footer # If this were fixed, we could keep the navbar and footer
@@ -8,9 +9,7 @@
{% endblock docs_navbar %} {% endblock docs_navbar %}
{% block footer %} {% block footer %}
{% endblock footer %} {% endblock footer %}
{# djlint: off #}
{%- block body_tag -%}<body>{%- endblock body_tag %} {%- block body_tag -%}<body>{%- endblock body_tag %}
{# djlint: on #}
{%- block extrahead %} {%- block extrahead %}
{{ super() }} {{ super() }}
<link href="{{ pathto('_static/redoc-fonts.css', 1) }}" rel="stylesheet" /> <link href="{{ pathto('_static/redoc-fonts.css', 1) }}" rel="stylesheet" />
@@ -23,14 +22,11 @@
document.body.innerText = "Rendered API specification doesn't work with file: protocol. Use sphinx-autobuild to do local builds of the docs, served over HTTP." document.body.innerText = "Rendered API specification doesn't work with file: protocol. Use sphinx-autobuild to do local builds of the docs, served over HTTP."
} else { } else {
Redoc.init( Redoc.init(
"{{ pathto('_static/rest-api.yml', 1) }}", { "{{ pathto('_static/rest-api.yml', 1) }}",
{ {{ meta.redoc_options | default ({}) }},
meta.redoc_options |
default ({})
}
},
document.getElementById("redoc-spec"), document.getElementById("redoc-spec"),
); );
} }
</script> </script>
{%- endblock content %} {%- endblock content %}
{# djlint: on #}