Skip to content

Commit

Permalink
feat: Add bibxml button to document info page (ietf-tools#5908)
Browse files Browse the repository at this point in the history
  • Loading branch information
pselkirk committed Jul 5, 2023
1 parent 09f3477 commit 221a0a7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions ietf/doc/tests_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,15 @@ def test_build_file_urls(self, mocked):
build_file_urls(WgDraftFactory(rev=''))

urls, types = build_file_urls(WgDraftFactory(rev='23'))
self.assertEqual(['xml', 'bibtex'], [t for t, _ in urls])
self.assertEqual(['xml', 'bibtex', 'bibxml'], [t for t, _ in urls])
self.assertEqual(types, ['xml'])

urls, types = build_file_urls(WgRfcFactory(rev=''))
self.assertEqual(['pdf', 'bibtex'], [t for t, _ in urls])
self.assertEqual(['pdf', 'bibtex', 'bibxml'], [t for t, _ in urls])
self.assertEqual(types, ['pdf'])

urls, types = build_file_urls(WgRfcFactory(rev='23'))
self.assertEqual(['pdf', 'bibtex'], [t for t, _ in urls])
self.assertEqual(['pdf', 'bibtex', 'bibxml'], [t for t, _ in urls])
self.assertEqual(types, ['pdf'])


Expand Down
2 changes: 2 additions & 0 deletions ietf/doc/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,7 @@ def build_file_urls(doc: Union[Document, DocHistory]):
if doc.tags.filter(slug="verified-errata").exists():
file_urls.append(("with errata", settings.RFC_EDITOR_INLINE_ERRATA_URL.format(rfc_number=doc.rfc_number())))
file_urls.append(("bibtex", urlreverse('ietf.doc.views_doc.document_bibtex',kwargs=dict(name=name))))
file_urls.append(("bibxml", urlreverse('ietf.doc.views_doc.document_bibxml',kwargs=dict(name=name))))
elif doc.rev:
base_path = os.path.join(settings.INTERNET_ALL_DRAFTS_ARCHIVE_DIR, doc.name + "-" + doc.rev + ".")
possible_types = settings.IDSUBMIT_FILE_TYPES
Expand All @@ -1038,6 +1039,7 @@ def build_file_urls(doc: Union[Document, DocHistory]):
file_urls.append(("htmlized", urlreverse('ietf.doc.views_doc.document_html', kwargs=dict(name=doc.name, rev=doc.rev))))
file_urls.append(("pdfized", urlreverse('ietf.doc.views_doc.document_pdfized', kwargs=dict(name=doc.name, rev=doc.rev))))
file_urls.append(("bibtex", urlreverse('ietf.doc.views_doc.document_bibtex',kwargs=dict(name=doc.name,rev=doc.rev))))
file_urls.append(("bibxml", urlreverse('ietf.doc.views_doc.document_bibxml',kwargs=dict(name=doc.name,rev=doc.rev))))
else:
# As of 2022-12-14, there are 1463 Document and 3136 DocHistory records with type='draft' and rev=''.
# All of these are in the rfc state and are covered by the above cases.
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/doc/document_format_buttons.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
href="{{ url }}">
{% if label == 'pdf' or label == 'pdfized' %}
<i class="bi bi-file-pdf"></i> pdf
{% elif label == 'xml' or label == 'html' %}
{% elif label == 'xml' or label == 'html' or label == 'bibxml' %}
<i class="bi bi-file-code"></i> {{ label}}
{% elif label == 'htmlized' %}
<i class="bi bi-file-code"></i> htmlized
Expand Down

0 comments on commit 221a0a7

Please sign in to comment.