Skip to content

Commit 639043e

Browse files
evynckerjsparksjennifer-richards
authored
Fix: meeting important dates can have markdown links (ietf-tools#6594)
* Fix ietf-tools#3911 by adding a markdown filter for template * fix: move the new markdown filter to utils * fix: linkify after markdown --------- Co-authored-by: Robert Sparks <rjsparks@nostrum.com> Co-authored-by: Jennifer Richards <jennifer@staff.ietf.org>
1 parent bb8cf21 commit 639043e

4 files changed

Lines changed: 38 additions & 26 deletions

File tree

ietf/doc/templatetags/ietf_filters.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ def link_other_doc_match(match):
227227
url = urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc + rev))
228228
return f'<a href="{url}">{match[1]}</a>'
229229

230-
231230
@register.filter(name="urlize_ietf_docs", is_safe=True, needs_autoescape=True)
232231
def urlize_ietf_docs(string, autoescape=None):
233232
"""
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright The IETF Trust 2023, All Rights Reserved
2+
3+
from django.db import migrations
4+
5+
def markdown_names(apps, schema_editor):
6+
ImportantDateName = apps.get_model("name", "ImportantDateName")
7+
changes = [
8+
('bofproposals', "Preliminary BOF proposals requested. To request a __BoF__ session use the [IETF BoF Request Tool](/doc/bof-requests)."),
9+
('openreg', "IETF Online Registration Opens [Register Here](https://www.ietf.org/how/meetings/register/)."),
10+
('opensched', "Working Group and BOF scheduling begins. To request a Working Group session, use the [IETF Meeting Session Request Tool](/secr/sreq/). If you are working on a BOF request, it is highly recommended to tell the IESG now by sending an [email to iesg@ietf.org](mailtp:iesg@ietf.org) to get advance help with the request."),
11+
('cutoffwgreq', "Cut-off date for requests to schedule Working Group Meetings at UTC 23:59. To request a __Working Group__ session, use the [IETF Meeting Session Request Tool](/secr/sreq/)."),
12+
('idcutoff', "Internet-Draft submission cut-off (for all Internet-Drafts, including -00) by UTC 23:59. Upload using the [I-D Submission Tool](/submit/)."),
13+
('cutoffwgreq', "Cut-off date for requests to schedule Working Group Meetings at UTC 23:59. To request a __Working Group__ session, use the [IETF Meeting Session Request Tool](/secr/sreq/)."),
14+
('bofprelimcutoff', "Cut-off date for BOF proposal requests. To request a __BoF__ session use the [IETF BoF Request Tool](/doc/bof-requests)."),
15+
('cutoffbofreq', "Cut-off date for BOF proposal requests to Area Directors at UTC 23:59. To request a __BoF__ session use the [IETF BoF Request Tool](/doc/bof-requests)."),
16+
]
17+
for slug, newDescription in changes:
18+
datename = ImportantDateName.objects.get(pk=slug) # If the slug does not exist, then Django will throw an exception :-)
19+
datename.desc = newDescription
20+
datename.save()
21+
22+
class Migration(migrations.Migration):
23+
dependencies = [
24+
("name", "0010_subseries"),
25+
]
26+
27+
operations = [
28+
migrations.RunPython(markdown_names),
29+
]

ietf/templates/meeting/important-dates.html

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends "base.html" %}
22
{# Copyright The IETF Trust 2017, All Rights Reserved #}
33
{% load origin %}
4-
{% load ietf_filters static textfilters ietf_filters %}
4+
{% load ietf_filters static textfilters htmlfilters %}
55
{% block pagehead %}
66
<link rel="stylesheet" href="{% static "ietf/css/list.css" %}">
77
{% endblock %}
@@ -45,30 +45,7 @@ <h2 class="mt-5">
4545
{% endif %}
4646
</td>
4747
<td>
48-
{{ d.name.desc|urlize_ietf_docs|linkify }}{% if d.name.desc|slice:"-1:" != "." %}.{% endif %}
49-
{% if first and d.name.slug == 'openreg' or first and d.name.slug == 'earlybird' %}
50-
<a href="https://www.ietf.org/how/meetings/register/">Register here</a>.
51-
{% endif %}
52-
{% if d.name.slug == 'opensched' %}
53-
To request a Working Group session, use the
54-
<a href="{% url 'ietf.secr.sreq.views.main' %}">IETF Meeting Session Request Tool</a>.
55-
If you are working on a BOF request, it is highly recommended
56-
to tell the IESG now by sending an email to
57-
<a href="mailto:iesg@ietf.org">iesg@ietf.org</a>
58-
to get advance help with the request.
59-
{% endif %}
60-
{% if d.name.slug == 'cutoffwgreq' %}
61-
To request a Working Group session, use the
62-
<a href="{% url 'ietf.secr.sreq.views.main' %}">IETF Meeting Session Request Tool</a>.
63-
{% endif %}
64-
{% if d.name.slug == 'cutoffbofreq' %}
65-
To request a BOF, please see instructions on
66-
<a href="https://www.ietf.org/how/bofs/bof-procedures/">Requesting a BOF</a>.
67-
{% endif %}
68-
{% if d.name.slug == 'idcutoff' %}
69-
Upload using the
70-
<a href="{% url 'ietf.submit.views.upload_submission' %}">I-D Submission Tool</a>.
71-
{% endif %}
48+
{{ d.name.desc|urlize_ietf_docs|markdown|linkify }}{% if d.name.desc|slice:"-1:" != "." %}.{% endif %}
7249
{% if d.name.slug == 'draftwgagenda' or d.name.slug == 'revwgagenda' or d.name.slug == 'procsub' or d.name.slug == 'revslug' %}
7350
Upload using the
7451
<a href="{% url 'ietf.meeting.views.materials' num=meeting.number %}">Meeting Materials Management Tool</a>.

ietf/utils/templatetags/htmlfilters.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from django.template.defaultfilters import stringfilter
88

99
from ietf.utils.html import remove_tags
10+
from ietf.utils.markdown import markdown as utils_markdown
1011

1112
register = Library()
1213

@@ -16,3 +17,9 @@
1617
def removetags(value, tags):
1718
"""Removes a comma-separated list of [X]HTML tags from the output."""
1819
return remove_tags(value, re.split(r"\s*,\s*", tags))
20+
21+
@register.filter(name="markdown", is_safe=True)
22+
def markdown(string):
23+
# One issue is that the string is enclosed in <p></p>... Let's remove the leading/trailing ones...
24+
return utils_markdown(string)[3:-4]
25+

0 commit comments

Comments
 (0)