metanorma / metanorma-ietf

Metanorma processor for IETF documents
BSD 2-Clause "Simplified" License
6 stars 5 forks source link

Investigate sorting of references #192

Closed opoudjis closed 1 year ago

opoudjis commented 1 year ago

https://github.com/cisba/i-d_dlts/pull/1

opoudjis commented 1 year ago

Note that :sort-refs: results in compilation failure. Need to confirm that that is xml2rfc's problem and not mine.

opoudjis commented 1 year ago

Confirmed that metanorma-ietf inherits the default behaviour of metanorma-standoc, which is not to sort references.

Also confirmed that xml2rfc supports sortRefs in its current version, 3.18.2.

I've compiled the following:

= X
A
:docnumber: 1
:fullname: Michael Douglass
:lastname: Douglass
:sort-refs: true

== Clause
A

[source,xml]
----
abv
----

[bibliography]
== Normative References

* [[[RFC2119,RFC 2119]]]
* [[[RFC7991,RFC 7991]]]
* [[[RFC7992,IETF BCP 47]]]
* [[[RFC7993,RFC 5646]]]

[%bibitem]
=== Automatic Cryptographic Validation Protocol
id:: ACVP
contributor::
contributor.person.name.initial:: B.
contributor.person.name.surname:: Fussell
contributor.person.affiliation.organization.name:: Cisco
contributor::
contributor.person.name.initial:: A.
contributor.person.name.surname:: Vassilev
contributor.person.affiliation.organization.name:: National Institute of Standards and Technology
contributor.person.affiliation.organization.abbreviation:: NIST
contributor::
contributor.person.name.initial:: H.
contributor.person.name.surname:: Booth
contributor.person.affiliation.organization.name:: National Institute of Standards and Technology
contributor.person.affiliation.organization.abbreviation:: NIST
contributor::
contributor.role:: publisher
contributor.organization.name:: National Institute of Standards and Technology
contributor.organization.abbreviation:: NIST
date::
date.type:: published
date.value:: 2019-07-01

It generates the RFC XML

<?rfc sortrefs="yes"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" docName="1" category="std" ipr="trust200902" sortRefs="true" submissionType="IETF" xml:lang="en" version="3" >
....
      <reference target="https://www.rfc-editor.org/info/rfc2119" anchor="RFC2119"><front><title>Key words for use in RFCs to Indicate Requirement Levels</title> <author fullname="S. Bradner" asciiFullname="S. Bradner"></author> <date month="March" year="1997"></date> <keyword>Standards</keyword><keyword>Track</keyword><keyword>Documents</keyword> <abstract>  <t anchor="_d880f395-e6d7-8f4a-03cf-d16fe47fb9c2">In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t></abstract> </front> <format target="https://www.rfc-editor.org/info/rfc2119" type="src"></format> <seriesInfo value=" 10.17487/RFC2119" name="DOI"></seriesInfo> <refcontent>RFC 2119</refcontent></reference>
      <reference target="https://www.rfc-editor.org/info/rfc7991" anchor="RFC7991"><front><title>The "xml2rfc" Version 3 Vocabulary</title> <author fullname="P. Hoffman" asciiFullname="P. Hoffman"></author> <date month="December" year="2016"></date> <keyword>v3</keyword><keyword>xml2rfcv3</keyword><keyword>format</keyword> <abstract>  <t anchor="_441cc74c-f66c-463b-8ae9-33e7e4842e35">This document defines the "xml2rfc" version 3 vocabulary: an XML-based language used for writing RFCs and Internet-Drafts. It is heavily derived from the version 2 vocabulary that is also under discussion. This document obsoletes the v2 grammar described in RFC 7749.</t></abstract> </front> <format target="https://www.rfc-editor.org/info/rfc7991" type="src"></format> <seriesInfo value=" 10.17487/RFC7991" name="DOI"></seriesInfo> <refcontent>RFC 7991</refcontent></reference>
      <reference target="https://www.rfc-editor.org/info/bcp47" anchor="RFC7992"><front><title>Best Current Practice 47</title><author surname="Unknown"></author> </front> <format target="https://www.rfc-editor.org/info/bcp47" type="src"></format> <refcontent>BCP 47</refcontent></reference>
      <reference target="https://www.rfc-editor.org/info/rfc5646" anchor="RFC7993"><front><title>Tags for Identifying Languages</title> <author fullname="A. Phillips" asciiFullname="A. Phillips"></author> <author fullname="M. Davis" asciiFullname="M. Davis"></author> <date month="September" year="2009"></date> <keyword>language tags</keyword><keyword>private interchange</keyword> <abstract>  <t anchor="_7fb32bbe-015b-d31e-b72b-0c1cf0607079">This document describes the structure, content, construction, and semantics of language tags for use in cases where it is desirable to indicate the language used in an information object. It also describes how to register values for use in language tags and the creation of user-defined extensions for private interchange. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t></abstract> </front> <format target="https://www.rfc-editor.org/info/rfc5646" type="src"></format> <seriesInfo value=" 10.17487/RFC5646" name="DOI"></seriesInfo> <refcontent>RFC 5646</refcontent></reference>
      <reference anchor="ACVP">
        <front><title>Automatic Cryptographic Validation Protocol</title><author surname="Unknown"></author> <date day="1" year="2019" month="July"></date> </front>
      </reference>
    </references>

That is to say, the references in the RFC XML are in the same order as they have been entered into Asciidoc.

The xml2rfc output is:

2.  Normative References

   [ACVP]     "Automatic Cryptographic Validation Protocol", 1 July
              2019.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", RFC 2119, DOI 10.17487/RFC2119, March
              1997, <https://www.rfc-editor.org/info/rfc2119>.

   [RFC7991]  Hoffman, P., "The "xml2rfc" Version 3 Vocabulary",
              RFC 7991, DOI 10.17487/RFC7991, December 2016,
              <https://www.rfc-editor.org/info/rfc7991>.

   [RFC7992]  "Best Current Practice 47", BCP 47,
              <https://www.rfc-editor.org/info/bcp47>.

   [RFC7993]  Phillips, A. and M. Davis, "Tags for Identifying
              Languages", RFC 5646, DOI 10.17487/RFC5646, September
              2009, <https://www.rfc-editor.org/info/rfc5646>.

So the references are being sorted.

So... there is nothing for me to do here. There has been an issue report that rfc2xml is rejecting sortRefs as an attribute on the root rfc element, but I cannot reproduce that problem, and that issue in any case resides with the linked ticket.