Skip to content

Commit f5507da

Browse files
committed
feat: Render markdown agendas with bs5 styles
So that the look is consistent with the rest of the datatracker.
1 parent bea4459 commit f5507da

4 files changed

Lines changed: 39 additions & 11 deletions

File tree

ietf/meeting/views.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -279,15 +279,22 @@ def materials_document(request, document, num=None, ext=None):
279279
if len(file_ext) == 2 and file_ext[1] == '.md' and mtype == 'text/plain':
280280
sorted_accept = sort_accept_tuple(request.META.get('HTTP_ACCEPT'))
281281
for atype in sorted_accept:
282-
if atype[0] == 'text/markdown':
283-
content_type = content_type.replace('plain', 'markdown', 1)
284-
break;
285-
elif atype[0] == 'text/html':
286-
bytes = "<html>\n<head><base target=\"_blank\" /></head>\n<body>\n%s\n</body>\n</html>\n" % markdown.markdown(bytes.decode(encoding=chset))
287-
content_type = content_type.replace('plain', 'html', 1)
288-
break;
289-
elif atype[0] == 'text/plain':
290-
break;
282+
if atype[0] == "text/markdown":
283+
content_type = content_type.replace("plain", "markdown", 1)
284+
break
285+
elif atype[0] == "text/html":
286+
bytes = render(
287+
request,
288+
"minimal.html",
289+
{
290+
"content": markdown.markdown(bytes.decode(encoding=chset)),
291+
"title": basename,
292+
},
293+
)
294+
content_type = content_type.replace("plain", "html", 1)
295+
break
296+
elif atype[0] == "text/plain":
297+
break
291298

292299
response = HttpResponse(bytes, content_type=content_type)
293300
response['Content-Disposition'] = 'inline; filename="%s"' % basename

ietf/static/css/ietf.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ url("npm:bootstrap-icons/font/fonts/bootstrap-icons.woff") format("woff");
9999
@import "bootstrap-icons/font/bootstrap-icons";
100100

101101
// Leave room for fixed-top navbar...
102-
body {
102+
body.navbar-offset {
103103
padding-top: 60px;
104104
}
105105

ietf/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<script src="{% static 'ietf/js/ietf.js' %}"></script>
3232
{% analytical_head_bottom %}
3333
</head>
34-
<body {% block bodyAttrs %}{% endblock %} class="position-relative"
34+
<body {% block bodyAttrs %}{% endblock %} class="navbar-of position-relative"
3535
data-group-menu-data-url="{% url 'ietf.group.views.group_menu_data' %}">
3636
{% analytical_body_top %}
3737
<a class="visually-hidden visually-hidden-focusable" href="#content">Skip to main content</a>

ietf/templates/minimal.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{# Copyright The IETF Trust 2015-2023, All Rights Reserved #}
2+
<!DOCTYPE html>
3+
{% load static %}
4+
{% load origin %}
5+
{% origin %}
6+
<html data-bs-theme="auto" lang="en">
7+
<head>
8+
<meta charset="utf-8">
9+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
10+
<title>{{ title }}</title>
11+
<meta name="viewport" content="width=device-width, initial-scale=1">
12+
<link href="{{ settings.STATIC_IETF_ORG }}/fonts/inter/import.css" rel="stylesheet">
13+
<link href="{{ settings.STATIC_IETF_ORG }}/fonts/noto-sans-mono/import.css" rel="stylesheet">
14+
<link rel="stylesheet" href="{% static 'ietf/css/ietf.css' %}">
15+
{# load this in the head, to prevent flickering #}
16+
<script src="{% static 'ietf/js/theme.js' %}"></script>
17+
</head>
18+
<body class="m-2">
19+
{{ content }}
20+
</body>
21+
</html>

0 commit comments

Comments
 (0)