Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions ietf/meeting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ietf/static/css/ietf.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the change to base seem out of scope for this PR subject. Please make things like this in their own PR going forward.

padding-top: 60px;
}

Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
21 changes: 21 additions & 0 deletions ietf/templates/minimal.html
Original file line number Diff line number Diff line change
@@ -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>