Merge pull request #6527 from larseggert/feat-md-bs
feat: Render markdown agendas with bs5 styles
This commit is contained in:
commit
aed328b50a
|
@ -279,15 +279,21 @@ def materials_document(request, document, num=None, ext=None):
|
|||
if len(file_ext) == 2 and file_ext[1] == '.md' and mtype == 'text/plain':
|
||||
sorted_accept = sort_accept_tuple(request.META.get('HTTP_ACCEPT'))
|
||||
for atype in sorted_accept:
|
||||
if atype[0] == 'text/markdown':
|
||||
content_type = content_type.replace('plain', 'markdown', 1)
|
||||
break;
|
||||
elif atype[0] == 'text/html':
|
||||
bytes = "<html>\n<head><base target=\"_blank\" /></head>\n<body>\n%s\n</body>\n</html>\n" % markdown.markdown(bytes.decode(encoding=chset))
|
||||
content_type = content_type.replace('plain', 'html', 1)
|
||||
break;
|
||||
elif atype[0] == 'text/plain':
|
||||
break;
|
||||
if atype[0] == "text/markdown":
|
||||
content_type = content_type.replace("plain", "markdown", 1)
|
||||
break
|
||||
elif atype[0] == "text/html":
|
||||
bytes = render_to_string(
|
||||
"minimal.html",
|
||||
{
|
||||
"content": markdown.markdown(bytes.decode(encoding=chset)),
|
||||
"title": basename,
|
||||
},
|
||||
)
|
||||
content_type = content_type.replace("plain", "html", 1)
|
||||
break
|
||||
elif atype[0] == "text/plain":
|
||||
break
|
||||
|
||||
response = HttpResponse(bytes, content_type=content_type)
|
||||
response['Content-Disposition'] = 'inline; filename="%s"' % basename
|
||||
|
|
|
@ -47,7 +47,7 @@ url("npm:bootstrap-icons/font/fonts/bootstrap-icons.woff") format("woff");
|
|||
@import "bootstrap-icons/font/bootstrap-icons";
|
||||
|
||||
// Leave room for fixed-top navbar...
|
||||
body {
|
||||
body.navbar-offset {
|
||||
padding-top: 60px;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<script src="{% static 'ietf/js/ietf.js' %}"></script>
|
||||
{% analytical_head_bottom %}
|
||||
</head>
|
||||
<body {% block bodyAttrs %}{% endblock %} class="position-relative"
|
||||
<body {% block bodyAttrs %}{% endblock %} class="navbar-offset position-relative"
|
||||
data-group-menu-data-url="{% url 'ietf.group.views.group_menu_data' %}">
|
||||
{% analytical_body_top %}
|
||||
<a class="visually-hidden visually-hidden-focusable" href="#content">Skip to main content</a>
|
||||
|
|
21
ietf/templates/minimal.html
Normal file
21
ietf/templates/minimal.html
Normal file
|
@ -0,0 +1,21 @@
|
|||
{# Copyright The IETF Trust 2015-2023, All Rights Reserved #}
|
||||
<!DOCTYPE html>
|
||||
{% load static %}
|
||||
{% load origin %}
|
||||
{% origin %}
|
||||
<html data-bs-theme="auto" lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>{{ title }}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="{{ settings.STATIC_IETF_ORG }}/fonts/inter/import.css" rel="stylesheet">
|
||||
<link href="{{ settings.STATIC_IETF_ORG }}/fonts/noto-sans-mono/import.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{% static 'ietf/css/ietf.css' %}">
|
||||
{# load this in the head, to prevent flickering #}
|
||||
<script src="{% static 'ietf/js/theme.js' %}"></script>
|
||||
</head>
|
||||
<body class="m-2 bg-transparent">
|
||||
{{ content }}
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue