Skip to content

Commit eb5423d

Browse files
authored
ci: Also check generated HTML with the "vnu" validator (ietf-tools#3682)
* ci: Also check generated HTML with the "vnu" validator Because HTML Tidy apparently misses a bunch of errors. * thead -> tbody * More fixes * More fixes * Start checker in test runner
1 parent 6ecd4b4 commit eb5423d

File tree

110 files changed

+382
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+382
-333
lines changed

docker/app.Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
124124
# Colorize the bash shell
125125
RUN sed -i 's/#force_color_prompt=/force_color_prompt=/' /root/.bashrc
126126

127+
# Install the Nu Html Checker (v.Nu)
128+
ADD https://github.com/validator/validator/releases/download/latest/vnu.linux.zip /
129+
RUN unzip -d / /vnu.linux.zip
130+
RUN cp -r /vnu-runtime-image/* /usr/local
131+
RUN rm -rf /vnu.linux.zip /vnu-runtime-image
132+
127133
ADD https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for /usr/local/bin/
128134
RUN chmod +rx /usr/local/bin/wait-for
129135

ietf/api/templates/api/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<html>
22
<head>
3-
<style type="text/css">
3+
<style>
44
p.comment {
55
background-color: #cfc;
66
border: solid black 1px;

ietf/dbtemplate/templates/dbtemplate/template_edit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h2>Meta information</h2>
3232
</dl>
3333

3434
<h2>Edit template content</h2>
35-
<form id="dbtemplate-edit" role="form" method="post">
35+
<form id="dbtemplate-edit" method="post">
3636
{% csrf_token %}
3737

3838
{% bootstrap_form form %}

ietf/doc/templatetags/ietf_filters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ def urlize_ietf_docs(string, autoescape=None):
197197
string = re.sub(r"(STD\s*?)0{0,3}(\d+)", "<a href=\"/doc/std\\2/\">\\1\\2</a>", string, flags=re.IGNORECASE)
198198
string = re.sub(r"(FYI\s*?)0{0,3}(\d+)", "<a href=\"/doc/fyi\\2/\">\\1\\2</a>", string, flags=re.IGNORECASE)
199199
string = re.sub(r"(draft-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string, flags=re.IGNORECASE)
200+
string = re.sub(r"(bofreq-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string, flags=re.IGNORECASE)
200201
string = re.sub(r"(conflict-review-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string, flags=re.IGNORECASE)
201202
string = re.sub(r"(status-change-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string, flags=re.IGNORECASE)
202203
string = re.sub(r"(charter-[-0-9a-zA-Z._+]+)", "<a href=\"/doc/\\1/\">\\1</a>", string, flags=re.IGNORECASE)

ietf/group/tests_review.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from ietf.doc.factories import DocumentFactory
2626
from ietf.group.factories import RoleFactory, ReviewTeamFactory, GroupFactory
2727
from ietf.review.factories import ReviewRequestFactory, ReviewerSettingsFactory, ReviewAssignmentFactory
28+
from django.utils.html import escape
2829

2930
class ReviewTests(TestCase):
3031
def test_review_requests(self):
@@ -375,8 +376,8 @@ def test_manage_review_requests(self):
375376
# get
376377
r = self.client.get(unassigned_url)
377378
self.assertEqual(r.status_code, 200)
378-
self.assertContains(r, review_req1.doc.name)
379-
self.assertContains(r, doc_author.name)
379+
self.assertContains(r, escape(review_req1.doc.name))
380+
self.assertContains(r, escape(doc_author.name))
380381

381382
# Test that conflicts are detected
382383
r = self.client.post(unassigned_url, {

ietf/ipr/tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ def test_search(self):
162162
r = self.client.get(url + "?submit=holder&holder=%s" % ipr.holder_legal_name)
163163
self.assertContains(r, ipr.title)
164164

165-
# find by patent infoj
166-
r = self.client.get(url + "?submit=patent&patent=%s" % quote(ipr.patent_info))
165+
# find by patent info
166+
r = self.client.get(url + "?submit=patent&patent=%s" % quote(ipr.patent_info.partition("\n")[0]))
167167
self.assertContains(r, ipr.title)
168168

169169
r = self.client.get(url + "?submit=patent&patent=US12345")

ietf/liaisons/widgets.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,21 @@ def __init__(self, *args, **kwargs):
1818
super(ButtonWidget, self).__init__(*args, **kwargs)
1919

2020
def render(self, name, value, **kwargs):
21-
html = '<span style="display: none" class="showAttachsOn">%s</span>' % conditional_escape(self.show_on)
22-
html += '<span style="display: none" class="attachEnabledLabel">%s</span>' % conditional_escape(self.label)
21+
html = '<span style="display: none;" class="showAttachsOn">%s</span>' % conditional_escape(self.show_on)
22+
html += '<span style="display: none;" class="attachEnabledLabel">%s</span>' % conditional_escape(self.label)
2323
if self.require:
2424
for i in self.require:
25-
html += '<span style="display: none" class="attachRequiredField">%s</span>' % conditional_escape(i)
25+
html += '<span style="display: none;" class="attachRequiredField">%s</span>' % conditional_escape(i)
2626
required_str = 'Please fill in %s to attach a new file' % conditional_escape(self.required_label)
27-
html += '<span style="display: none" class="attachDisabledLabel">%s</span>' % conditional_escape(required_str)
27+
html += '<span style="display: none;" class="attachDisabledLabel">%s</span>' % conditional_escape(required_str)
2828
html += '<input type="button" class="addAttachmentWidget btn btn-primary btn-sm" value="%s">' % conditional_escape(self.label)
2929
return mark_safe(html)
3030

3131

3232
class ShowAttachmentsWidget(Widget):
3333
def render(self, name, value, **kwargs):
3434
html = '<div id="id_%s">' % name
35-
html += '<span style="display: none" class="showAttachmentsEmpty form-control widget">No files attached</span>'
35+
html += '<span style="display: none;" class="showAttachmentsEmpty form-control widget">No files attached</span>'
3636
html += '<div class="attachedFiles form-control widget">'
3737
if value and isinstance(value, QuerySet):
3838
for attachment in value:

ietf/release/tests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,4 @@ def test_stats(self):
4242

4343
s = q('#frequency-data').text()
4444
self.assertIn("type: 'column',", s)
45-
self.assertIn('"data": [[2007, 7], ', s)
46-
45+
self.assertIn('"data": [[2007, 7], ', s)

ietf/secr/templates/announcement/main.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<div class="module">
1212
<h2>Announcement</h2>
1313

14-
<form action="" method="post">{% csrf_token %}
14+
<form method="post">{% csrf_token %}
1515
<table class="new-style full-width amstable" id="announce-table">
1616
{% if form.non_field_errors %}{{ form.non_field_errors }}{% endif %}
1717
{% for field in form.visible_fields %}

ietf/secr/templates/areas/people.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% block title %}Areas - People{% endblock %}
44

55
{% block extrahead %}{{ block.super }}
6-
<link rel="stylesheet" type="text/css" href="{% static 'ietf/css/jquery-ui.css' %}" />
6+
<link rel="stylesheet" href="{% static 'ietf/css/jquery-ui.css' %}" />
77
<script src="{% static 'ietf/js/jquery-ui.js' %}"></script>
88
<script src="{% static 'secr/js/utils.js' %}"></script>
99
{% endblock %}

0 commit comments

Comments
 (0)