Skip to content

Commit

Permalink
feat: show references to and from subseries
Browse files Browse the repository at this point in the history
  • Loading branch information
rjsparks committed Nov 1, 2023
1 parent 1f82fab commit 71a760f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
6 changes: 6 additions & 0 deletions ietf/doc/views_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1431,11 +1431,17 @@ def document_shepherd_writeup_template(request, type):
def document_references(request, name):
doc = get_object_or_404(Document,name=name)
refs = doc.references()
if doc.type_id in ["bcp","std","fyi"]:
for rfc in doc.contains():
refs |= rfc.references()
return render(request, "doc/document_references.html",dict(doc=doc,refs=sorted(refs,key=lambda x:x.target.name),))

def document_referenced_by(request, name):
doc = get_object_or_404(Document,name=name)
refs = doc.referenced_by()
if doc.type_id in ["bcp","std","fyi"]:
for rfc in doc.contains():
refs |= rfc.referenced_by()
full = ( request.GET.get('full') != None )
numdocs = refs.count()
if not full and numdocs>250:
Expand Down
6 changes: 3 additions & 3 deletions ietf/templates/doc/document_referenced_by.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{# Copyright The IETF Trust 2015-2023, All Rights Reserved #}
{% load origin static ietf_filters %}
{% block pagehead %}
<link rel="stylesheet" href="{% static "ietf/css/list.css" %}">
{% endblock %}
{% block title %}References to {{ name }}{% endblock %}
{% block title %}References to {{ name|prettystdname }}{% endblock %}
{% block content %}
{% origin %}
<h1>References to {{ name }}</h1>
<h1>References to {{ name|prettystdname }}</h1>
<p class="alert alert-info my-3">
These dependencies are extracted using heuristics looking for strings with particular prefixes. Notably, this means that references to I-Ds by title only are not reflected here. If it's really important, please inspect the documents' references sections directly.
</p>
Expand Down
6 changes: 3 additions & 3 deletions ietf/templates/doc/document_references.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{# Copyright The IETF Trust 2015-2023, All Rights Reserved #}
{% load origin static ietf_filters %}
{% block pagehead %}
<link rel="stylesheet" href="{% static "ietf/css/list.css" %}">
{% endblock %}
{% block title %}References from {{ doc.name }}{% endblock %}
{% block title %}References from {{ doc.name|prettystdname }}{% endblock %}
{% block content %}
{% origin %}
<h1>References from {{ doc.name }}</h1>
<h1>References from {{ doc.name|prettystdname }}</h1>
<p class="my-3 alert alert-info">
These dependencies are extracted using heuristics looking for strings with particular prefixes. Notably, this means that references to I-Ds by title only are not reflected here. If it's really important, please inspect the documents' references sections directly.
</p>
Expand Down
18 changes: 17 additions & 1 deletion ietf/templates/doc/document_subseries.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,24 @@
{% block content %}
{% origin %}
{{ top|safe }}
<h2>{{ doc.name|slice:":3"|upper }} {{ doc.name|slice:"3:"}} consists of:</h2>
<h2>{{ doc.name|slice:":3"|upper }} {{ doc.name|slice:"3:"}} {% if doc.contains %}consists of:{% else %}currently contains no RFCs{% endif %}</h2>
{% for rfc in doc.contains %}
<p><a href="{% url 'ietf.doc.views_doc.document_main' name=rfc.name %}">RFC {{rfc.name|slice:"3:"}}</a> : {{rfc.title}}</p>
{% endfor %}
<div class="buttonlist">
<a class="btn btn-primary btn-sm"
href="{% url 'ietf.doc.views_doc.document_references' doc.name %}"
rel="nofollow">
<i class="bi bi-arrow-left">
</i>
References
</a>
<a class="btn btn-primary btn-sm"
href="{% url 'ietf.doc.views_doc.document_referenced_by' doc.name %}"
rel="nofollow">
<i class="bi bi-arrow-right">
</i>
Referenced by
</a>
</div>
{% endblock %}

0 comments on commit 71a760f

Please sign in to comment.