datatracker/ietf/templates/doc/document_material.html
Lars Eggert 5598762608
fix: add more HTML validation & fixes (#3891)
* Update vnu.jar

* Fix py2 -> py3 issue

* Run pyupgrade

* test: Add default-jdk to images

* test: Add option to also validate HTML with vnu.jar

Since it's already installed in bin. Don't do this by default, since it
increases the time needed for tests by ~50%.

* fix: Stop the urlizer from urlizing in linkified mailto: text

* More HTML fixes

* More HTML validation fixes

* And more HTML fixes

* Fix floating badge

* Ignore unicode errors

* Only URLize docs that are existing

* Final fixes

* Don't URLize everything during test-crawl

* Feed HTML into vnu using python rather than Java to speed things up

* Allow test-crawl to start vnu on a different port

* Increase retry count to vnu. Restore batch size to 30.

* More HTML validation fixes

* Use urllib3 to make requests to vnu, since overriding requests_mock is tricky

* Undo commit of unmodified file

* Also urlize ftp links

* Fix matching of file name

* More HTML fixes

* Add `is_valid_url` filter

* weekday -> data-weekday

* urlencode URLs

* Add and use vnu_fmt_message. Bump vnu max buffer.

* Simplify doc_exists

* Don't add tab link to mail archive if the URL is invalid

* Run urlize_ietf_docs before linkify

Reduces the possibility of generating incorrect HTML

* Undo superfluous change

* Runner fixes

* Consolidate vnu message filtering into vnu_filter_message

* Correctly handle multiple persons with same name

* Minimze diff

* Fix HTML nits

* Print source snippet in vnu_fmt_message

* Only escape if there is something to escape

* Fix snippet

* Skip crufty old IPR declarations

* Only include modal when needed. Add handles.

* Fix wordwrap+linkification

* Update ietf/doc/templatetags/ietf_filters.py

* Update ietf/doc/templatetags/tests_ietf_filters.py

* Don't right-align second column
2022-05-03 13:55:48 -05:00

140 lines
5.9 KiB
HTML

{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin %}
{% load static %}
{% load ietf_filters textfilters %}
{% block title %}{{ doc.title|default:"Untitled" }}{% endblock %}
{% block content %}
{% origin %}
{{ top|safe }}
{% include "doc/revisions_list.html" %}
<div id="timeline"></div>
{% if doc.rev != latest_rev %}
<div class="alert alert-warning my-3">The information below is for an old version of the document.</div>
{% endif %}
<table class="table table-sm table-borderless">
<tbody class="meta border-top">
<tr>
<th scope="row">
{% if doc.meeting_related %}Meeting{% endif %}
{{ doc.type.name }}
</th>
<td></td>
<td>
{% if doc.group %}
{{ doc.group.name }}
<a href="{{ doc.group.about_url }}">({{ doc.group.acronym }})</a>
{{ doc.group.type.name }}
{% endif %}
{% if snapshot %}<span class="badge bg-warning">Snapshot</span>{% endif %}
</td>
</tr>
<tr>
<th scope="row">Title</th>
<td class="edit">
{% if not snapshot and can_manage_material %}
{% doc_edit_button 'ietf.doc.views_material.edit_material' name=doc.name action="title" %}
{% endif %}
</td>
<th scope="row">{{ doc.title|default:'<span class="text-muted">(None)</span>' }}</th>
</tr>
{% if doc.abstract or doc.type_id == 'slides' and can_manage_material and not snapshot %}
<tr>
<th scope="row">Abstract</th>
<td class="edit">
{% if not snapshot and can_manage_material %}
{% doc_edit_button 'ietf.doc.views_material.edit_material' name=doc.name action="abstract" %}
{% endif %}
</td>
<td>{{ doc.abstract|format_snippet }}</td>
</tr>
{% endif %}
<tr>
<th scope="row">State</th>
<td class="edit">
{% if not snapshot and can_manage_material %}
{% doc_edit_button 'ietf.doc.views_material.edit_material' name=doc.name action="state" %}
{% endif %}
</td>
<td>{{ doc.get_state.name }}</td>
</tr>
{% if other_types %}
<tr>
<th scope="row">Other versions</th>
<td class="edit"></td>
<td>
{% for t, url in other_types %}
<a href="{{ url }}">{{ t }}</a>{% if not forloop.last %},{% endif %}
{% endfor %}
</td>
</tr>
{% endif %}
{% if doc.type_id == 'procmaterials' and doc.external_url|length > 0 %}
<tr>
<th scope="row">External URL</th>
<td class="edit"></td>
<td>
<a href="{{ doc.external_url }}">{{ doc.external_url }}</a>
</td>
</tr>
{% endif %}
{% if doc.type_id != 'procmaterials' %}
{% if presentations or can_manage_material %}
<tr>
<th scope="row">On agenda</th>
<td class="edit">
{% if not snapshot and can_manage_material %}
{% doc_edit_button "ietf.doc.views_doc.all_presentations" name=doc.name %}
{% endif %}
</td>
<td>
{% if presentations %}
{% for pres in presentations %}
{{ pres.session.short_name }} at {{ pres.session.meeting }}
{% if pres.rev != doc.rev %}(version -{{ pres.rev }}){% endif %}{% if not forloop.last %},{% endif %}
{% endfor %}
{% else %}
<span class="text-muted">(None)</span>
{% endif %}
</td>
</tr>
{% endif %}
{% endif %}
<tr>
<th scope="row">Last updated</th>
<td class="edit"></td>
<td>{{ doc.time|date:"Y-m-d" }}</td>
</tr>
</tbody>
</table>
<p class="buttonlist">
{% if can_upload %}
<a class="btn btn-primary"
href="{% url 'ietf.doc.views_material.edit_material' name=doc.name action="revise" %}">
Upload New Revision
</a>
{% endif %}
</p>
<div id="materials-content" class="card mt-5">
<div class="card-header">{{ doc.name }}-{{ doc.rev }}</div>
<div class="card-body">
{% if doc.rev and content != None %}
{% if content_is_html %}
{{ content|sanitize|safe }}
{% else %}
<pre>{{ content|maybewordwrap|urlize_ietf_docs|linkify }}</pre>
{% endif %}
{% else %}
Not available as plain text.
{% if other_types %}
<a href="{{ other_types.0.1 }}">Download as {{ other_types.0.0.upper }}</a>.
{% endif %}
{% endif %}
</div>
</div>
{% endblock %}
{% block js %}
<script src="{% static 'ietf/js/d3.js' %}"></script>
<script src="{% static 'ietf/js/document_timeline.js' %}"></script>
{% endblock %}