From 4e40407f43023e6ff75136725f7735b85e331e18 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Fri, 10 Nov 2023 13:38:39 +0100 Subject: [PATCH 1/9] chore: Replace markup_txt with rfc2html --- ietf/doc/views_doc.py | 16 +++--- ietf/templates/doc/document_draft.html | 17 +++++-- ietf/utils/markup_txt.py | 69 -------------------------- 3 files changed, 19 insertions(+), 83 deletions(-) delete mode 100644 ietf/utils/markup_txt.py diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py index a3548fa921..85dca72e7f 100644 --- a/ietf/doc/views_doc.py +++ b/ietf/doc/views_doc.py @@ -51,6 +51,7 @@ from django import forms from django.contrib.staticfiles import finders +import rfc2html import debug # pyflakes:ignore @@ -81,7 +82,7 @@ from ietf.review.models import ReviewAssignment from ietf.review.utils import can_request_review_of_doc, review_assignments_to_list_for_docs, review_requests_to_list_for_docs from ietf.review.utils import no_review_from_teams_on_doc -from ietf.utils import markup_txt, log, markdown +from ietf.utils import log, markdown from ietf.utils.draft import PlaintextDraft from ietf.utils.response import permission_denied from ietf.utils.text import maybe_split @@ -301,13 +302,10 @@ def document_main(request, name, rev=None, document_html=False): name = doc.name file_urls, found_types = build_file_urls(doc) - if not snapshot and doc.get_state_slug() == "rfc": - # content - content = doc.text_or_error() # pyflakes:ignore - content = markup_txt.markup(maybe_split(content, split=split_content)) - content = doc.text_or_error() # pyflakes:ignore - content = markup_txt.markup(maybe_split(content, split=split_content)) + content = maybe_split(content, split=split_content) + if content: + content = rfc2html.markup(content) if not snapshot and doc.get_state_slug() == "rfc": if not found_types: @@ -693,7 +691,7 @@ def document_main(request, name, rev=None, document_html=False): content = "A conflict review response has not yet been proposed." else: content = doc.text_or_error() # pyflakes:ignore - content = markup_txt.markup(content) + content = markdown.markdown(content) ballot_summary = None if doc.get_state_slug() in ("iesgeval", ) and doc.active_ballot(): @@ -808,8 +806,6 @@ def document_main(request, name, rev=None, document_html=False): basename = "{}.txt".format(doc.name) pathname = os.path.join(doc.get_file_path(), basename) content = get_unicode_document_content(basename, pathname) - # If we want to go back to using markup_txt.markup_unicode, call it explicitly here like this: - # content = markup_txt.markup_unicode(content, split=False, width=80) assignments = ReviewAssignment.objects.filter(review__name=doc.name) review_assignment = assignments.first() diff --git a/ietf/templates/doc/document_draft.html b/ietf/templates/doc/document_draft.html index 09cab69208..229ab57b8e 100644 --- a/ietf/templates/doc/document_draft.html +++ b/ietf/templates/doc/document_draft.html @@ -14,8 +14,17 @@ href="/feed/document-changes/{{ name }}/"> + +{% endblock %} +{% block morecss %} + .rfcmarkup :is(h1, h2, h3, h4, h5, h6), + .rfcmarkup :is(.h1, .h2, .h3, .h4, .h5, .h6) { + font-weight: bold; + font-size: 1em; + } + .rfcmarkup .newpage { margin-top: -1.5em; } + .rfcmarkup .grey, hr { opacity: .25; } {% endblock %} -{% block morecss %}.inline { display: inline; }{% endblock %} {% block title %} {% if doc.get_state_slug == "rfc" and not snapshot %} RFC {{ rfc_number }} - {{ doc.title }} @@ -658,7 +667,7 @@ Nits - From d6f3d3a079483e0cc16c63a9e6c3c31582642d3d Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Fri, 10 Nov 2023 14:20:29 +0100 Subject: [PATCH 3/9] Remove comment --- ietf/templates/doc/document_draft.html | 1 - 1 file changed, 1 deletion(-) diff --git a/ietf/templates/doc/document_draft.html b/ietf/templates/doc/document_draft.html index 426bb26efe..b220fd796f 100644 --- a/ietf/templates/doc/document_draft.html +++ b/ietf/templates/doc/document_draft.html @@ -14,7 +14,6 @@ href="/feed/document-changes/{{ name }}/"> - {% endblock %} {% block morecss %} .rfcmarkup :is(h1, h2, h3, h4, h5, h6), From 208daf3befec0497dfcfeac9b2236ada87fd96e6 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Fri, 10 Nov 2023 18:41:09 +0100 Subject: [PATCH 4/9] Suppress harder --- ietf/templates/doc/document_html.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ietf/templates/doc/document_html.html b/ietf/templates/doc/document_html.html index 97272bb050..1c6517ed81 100644 --- a/ietf/templates/doc/document_html.html +++ b/ietf/templates/doc/document_html.html @@ -165,7 +165,7 @@ {% else %}

- + {{ doc.htmlized|default:"Generation of htmlized text failed"|safe }}
{% endif %} @@ -332,4 +332,4 @@ {% analytical_body_bottom %} - + \ No newline at end of file From 788226c65a668fc5f2e4f126288a31fb8e63dcef Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Mon, 13 Nov 2023 09:47:33 +0200 Subject: [PATCH 5/9] Suppress even more --- ietf/templates/doc/document_draft.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ietf/templates/doc/document_draft.html b/ietf/templates/doc/document_draft.html index b220fd796f..d2f496d61e 100644 --- a/ietf/templates/doc/document_draft.html +++ b/ietf/templates/doc/document_draft.html @@ -769,7 +769,7 @@ {% endif %}
- + {{ content|safe|default:"(Unavailable)" }}
From f3c16ad9ef27c6ea1c673569448c95617614c19e Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Fri, 15 Dec 2023 08:42:30 +0200 Subject: [PATCH 6/9] Fix test --- ietf/doc/views_doc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py index 6c99f61a1b..afc6152738 100644 --- a/ietf/doc/views_doc.py +++ b/ietf/doc/views_doc.py @@ -266,7 +266,7 @@ def document_main(request, name, rev=None, document_html=False): file_urls, found_types = build_file_urls(doc) content = doc.text_or_error() # pyflakes:ignore - content = markup_txt.markup(maybe_split(content, split=split_content)) + content = markdown.markdown(maybe_split(content, split=split_content)) if not found_types: content = "This RFC is not currently available online." From 78c0d2765458dc1248634e3ab76f1ba76f8ec657 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Mon, 18 Dec 2023 09:39:11 +0200 Subject: [PATCH 7/9] Ignore vnu "duplicate ID" errors --- docker/configs/settings_local.py | 2 ++ docker/docker-compose.extend.yml | 2 +- ietf/utils/test_runner.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docker/configs/settings_local.py b/docker/configs/settings_local.py index 07c16c2e9a..a9647958d4 100644 --- a/docker/configs/settings_local.py +++ b/docker/configs/settings_local.py @@ -7,6 +7,8 @@ from ietf.settings_postgresqldb import DATABASES # pyflakes:ignore +IDTRACKER_BASE_URL="http://localhost:8000" + IDSUBMIT_IDNITS_BINARY = "/usr/local/bin/idnits" IDSUBMIT_STAGING_PATH = "test/staging/" diff --git a/docker/docker-compose.extend.yml b/docker/docker-compose.extend.yml index d055c976f4..8dc1bbac05 100644 --- a/docker/docker-compose.extend.yml +++ b/docker/docker-compose.extend.yml @@ -11,7 +11,7 @@ services: - /workspace/__pycache__ - /workspace/.vite - /workspace/.yarn/unplugged - - app-assets:/assets + - /Users/lars/Documents/IETF/assets:/assets db: ports: - '5432' diff --git a/ietf/utils/test_runner.py b/ietf/utils/test_runner.py index 5901da8060..882ab8a927 100644 --- a/ietf/utils/test_runner.py +++ b/ietf/utils/test_runner.py @@ -196,6 +196,7 @@ def vnu_filter_message(msg, filter_db_issues, filter_test_issues): if filter_test_issues and re.search( r"""Ceci\ n'est\ pas\ une\ URL| ^The\ '\w+'\ attribute\ on\ the\ '\w+'\ element\ is\ obsolete| + ^Duplicate\ ID|^The\ first\ occurrence\ of\ ID| ^Section\ lacks\ heading""", msg["message"], flags=re.VERBOSE, From b0fa9818038ff2cecc4e2c249e45990675811b1c Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Mon, 18 Dec 2023 09:53:58 +0200 Subject: [PATCH 8/9] Undo accidental commit --- docker/configs/settings_local.py | 2 -- docker/docker-compose.extend.yml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/docker/configs/settings_local.py b/docker/configs/settings_local.py index a9647958d4..07c16c2e9a 100644 --- a/docker/configs/settings_local.py +++ b/docker/configs/settings_local.py @@ -7,8 +7,6 @@ from ietf.settings_postgresqldb import DATABASES # pyflakes:ignore -IDTRACKER_BASE_URL="http://localhost:8000" - IDSUBMIT_IDNITS_BINARY = "/usr/local/bin/idnits" IDSUBMIT_STAGING_PATH = "test/staging/" diff --git a/docker/docker-compose.extend.yml b/docker/docker-compose.extend.yml index 8dc1bbac05..d055c976f4 100644 --- a/docker/docker-compose.extend.yml +++ b/docker/docker-compose.extend.yml @@ -11,7 +11,7 @@ services: - /workspace/__pycache__ - /workspace/.vite - /workspace/.yarn/unplugged - - /Users/lars/Documents/IETF/assets:/assets + - app-assets:/assets db: ports: - '5432' From f482cfb9603dfbe9652e8d60767efb6f501811df Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Mon, 18 Dec 2023 10:13:56 +0200 Subject: [PATCH 9/9] Fix RFCs --- ietf/doc/views_doc.py | 4 +++- ietf/templates/doc/document_rfc.html | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ietf/doc/views_doc.py b/ietf/doc/views_doc.py index afc6152738..2f8af019a2 100644 --- a/ietf/doc/views_doc.py +++ b/ietf/doc/views_doc.py @@ -266,7 +266,9 @@ def document_main(request, name, rev=None, document_html=False): file_urls, found_types = build_file_urls(doc) content = doc.text_or_error() # pyflakes:ignore - content = markdown.markdown(maybe_split(content, split=split_content)) + content = maybe_split(content, split=split_content) + if content: + content = rfc2html.markup(content) if not found_types: content = "This RFC is not currently available online." diff --git a/ietf/templates/doc/document_rfc.html b/ietf/templates/doc/document_rfc.html index 36c9babd79..37aeaa08f9 100644 --- a/ietf/templates/doc/document_rfc.html +++ b/ietf/templates/doc/document_rfc.html @@ -15,7 +15,15 @@ {% endblock %} -{% block morecss %}.inline { display: inline; }{% endblock %} +{% block morecss %} + .rfcmarkup :is(h1, h2, h3, h4, h5, h6), + .rfcmarkup :is(.h1, .h2, .h3, .h4, .h5, .h6) { + font-weight: bold; + font-size: 1em; + } + .rfcmarkup .newpage { margin-top: -1.5em; } + .rfcmarkup .grey, hr { opacity: .25; } +{% endblock %} {% block title %} RFC {{ doc.rfc_number }} - {{ doc.title }} {% endblock %} @@ -155,8 +163,9 @@
RFC {{ doc.rfc_number }}
-
-
{{ content|sanitize|safe|default:"(Unavailable)" }}
+
+ + {{ content|safe|default:"(Unavailable)" }}
{% if split_content %} @@ -173,4 +182,4 @@ - {% endblock %} + {% endblock %} \ No newline at end of file