Fixed the DOI information for doc/rfc*/bibtex/ temporarily; for a better fix we need to import the DOI values in ietf/sync/rfceditor.py

- Legacy-Id: 13478
This commit is contained in:
Henrik Levkowetz 2017-05-31 16:29:07 +00:00
parent 25bb9a1c0f
commit b81be04f20
3 changed files with 14 additions and 4 deletions

View file

@ -843,7 +843,7 @@ class DocTestCase(TestCase):
entry = bibtexparser.loads(r.content).get_entry_dict()["rfc6020"]
self.assertEqual(entry['series'], u'Request for Comments')
self.assertEqual(entry['number'], u'6020')
self.assertEqual(entry['doi'], u'10.17487/rfc6020')
self.assertEqual(entry['doi'], u'10.17487/RFC6020')
self.assertEqual(entry['year'], u'2010')
self.assertEqual(entry['month'], u'oct')
#
@ -863,7 +863,7 @@ class DocTestCase(TestCase):
entry = bibtexparser.loads(r.content).get_entry_dict()['rfc1149']
self.assertEqual(entry['series'], u'Request for Comments')
self.assertEqual(entry['number'], u'1149')
self.assertEqual(entry['doi'], u'10.17487/rfc1149')
self.assertEqual(entry['doi'], u'10.17487/RFC1149')
self.assertEqual(entry['year'], u'1990')
self.assertEqual(entry['month'], u'apr')
self.assertEqual(entry['day'], u'1')

View file

@ -763,12 +763,22 @@ def document_bibtex(request, name, rev=None):
doc = h
break
if doc.is_rfc():
# This needs to be replaced with a lookup, as the mapping may change
# over time. Probably by updating ietf/sync/rfceditor.py to add the
# as a DocAlias, and use a method on Document to retrieve it.
doi = "10.17487/RFC%04d" % int(doc.rfc_number())
else:
doi = None
return render(request, "doc/document_bibtex.bib",
dict(doc=doc,
replaced_by=replaced_by,
published=published,
rfc=rfc,
latest_revision=latest_revision),
latest_revision=latest_revision,
doi=doi,
),
content_type="text/plain; charset=utf-8",
)

View file

@ -13,7 +13,7 @@
number = {{ doc.rfc_number }},
howpublished = {% templatetag openbrace %}RFC {{ doc.rfc_number }}{% if doc.doc.intended_std_level %} ({{ doc.intended_std_level }}){% endif %}{% templatetag closebrace %},
publisher = {RFC Editor},
doi = {% templatetag openbrace %}10.17487/rfc{{ doc.rfc_number }}{% templatetag closebrace %},
doi = {% templatetag openbrace %}{{ doi }}{% templatetag closebrace %},
url = {https://rfc-editor.org/rfc/rfc{{ doc.rfc_number }}.txt},{% else %}
{% if published %}%% You should probably cite rfc{{ latest_revision.doc.rfc_number }} instead of this I-D.{% else %}{% if replaced_by %}%% You should probably cite {{replaced_by|join:" or "}} instead of this I-D.{% else %}
{% if doc.rev != latest_revision.rev %}%% You should probably cite {{latest_revision.doc.name}}-{{latest_revision.rev}} instead of this revision.{%endif%}{% endif %}{% endif %}