diff --git a/test.py b/test.py index c039687d..fa7c9bdf 100644 --- a/test.py +++ b/test.py @@ -12,6 +12,7 @@ from xml2rfc.boilerplate_rfc_7841 import boilerplate_rfc_status_of_memo from xml2rfc.walkpdf import xmldoc from xml2rfc.writers.base import default_options, BaseV3Writer, RfcWriterError +from xml2rfc.writers import DatatrackerToBibConverter from xml2rfc.writers.text import MAX_WIDTH try: @@ -847,5 +848,39 @@ def test_validate_draft_name(self): self.writer.validate_draft_name() +class DatatrackerToBibConverterTest(unittest.TestCase): + """DatatrackerToBibConverter tests""" + + def setUp(self): + xml2rfc.log.quiet = True + path = "tests/input/elements.xml" + self.parser = xml2rfc.XmlRfcParser(path, + quiet=True, + options=default_options, + **options_for_xmlrfcparser) + self.xmlrfc = self.parser.parse() + self.writer = xml2rfc.DatatrackerToBibConverter(self.xmlrfc, quiet=True) + + def test_convert(self): + reference_a = "reference.I-D.ietf-sipcore-multiple-reasons.xml" + reference_b = "reference.I-D.draft-ietf-sipcore-multiple-reasons-01.xml" + rfc = lxml.etree.fromstring(f""" + + + +""") + self.writer.root = rfc + self.writer.convert_xincludes() + + ns = {"xi": b"http://www.w3.org/2001/XInclude"} + xincludes = self.writer.root.xpath("//xi:include", namespaces=ns) + + # reference without revision + self.assertEqual(xincludes[0].get("href"), f"https://bib.ietf.org/public/rfc/bibxml-ids/{reference_a}") + + # reference with revision + self.assertEqual(xincludes[1].get("href"), f"https://bib.ietf.org/public/rfc/bibxml-ids/{reference_b}") + + if __name__ == '__main__': unittest.main() diff --git a/tests/valid/docfile.html b/tests/valid/docfile.html index 048e536e..02444f0d 100644 --- a/tests/valid/docfile.html +++ b/tests/valid/docfile.html @@ -4,15 +4,15 @@ -Xml2rfc Vocabulary Version 3 Schema xml2rfc release 3.24.0 +Xml2rfc Vocabulary Version 3 Schema xml2rfc release 3.25.0 - - + + @@ -24,7 +24,7 @@ Xml2rfc Vocabulary V3 Schema -November 2024 +December 2024 xml2rfc(1) @@ -39,7 +39,7 @@
xml2rfc(1)
Published:
- +
Author:
@@ -49,7 +49,7 @@
-

Xml2rfc Vocabulary Version 3 Schema
xml2rfc release 3.24.0

+

Xml2rfc Vocabulary Version 3 Schema
xml2rfc release 3.25.0

Abstract

@@ -371,7 +371,7 @@

The latest version of this documentation is available in HTML form at https://ietf-tools.github.io/xml2rfc/.

- This documentation applies to xml2rfc version 3.24.0.

+ This documentation applies to xml2rfc version 3.25.0.

@@ -5616,7 +5616,7 @@

One or more of the following output formats may be specified. The default is --text. The destination filename will be based on the input filename, unless --out=FILE or --basename=BASE is used. - The group has 10 options.

+ The group has 11 options.

@@ -5673,39 +5673,48 @@

-
---v2v3
+
+--use-bib

- Convert vocabulary version 2 XML to version 3.

+ Update all datatracker references with bib.ietf.org.

-
---preptool
+
+--v2v3

- Run preptool on the input.

+ Convert vocabulary version 2 XML to version 3.

-
---unprep
+
+--preptool

- Reduce prepped xml to unprepped.

+ Run preptool on the input.

-
---info
+
+--unprep

- Generate a JSON file with anchor to section lookup information.

+ Reduce prepped xml to unprepped.

+
+
+
+
+--info
+
+
+

+ Generate a JSON file with anchor to section lookup information.

@@ -6387,7 +6396,7 @@

The following variables are available for use in an xml2rfc - manpage Jinja2 template, as of xml2rfc version 3.24.0:

+ manpage Jinja2 template, as of xml2rfc version 3.25.0:

{{ bare_latin_tags }}:
diff --git a/tests/valid/draft-miek-test.html b/tests/valid/draft-miek-test.html index ec692a8f..5f5b06be 100644 --- a/tests/valid/draft-miek-test.html +++ b/tests/valid/draft-miek-test.html @@ -16,7 +16,7 @@ This version is adapted to work with "xml2rfc" version 2.x. ' name="description"> - + @@ -26,7 +26,7 @@ + + @@ -20,7 +20,7 @@ - +
Status of This Memo @@ -41,7 +41,7 @@ material or to cite them other than as "work in progress." - This Internet-Draft will expire on 18 May 2025. + This Internet-Draft will expire on 7 June 2025.
diff --git a/tests/valid/indexes.text b/tests/valid/indexes.text index e51940a2..36f16d62 100644 --- a/tests/valid/indexes.text +++ b/tests/valid/indexes.text @@ -3,9 +3,9 @@ Network Working Group H. Person, Ed. -Internet-Draft November 14, 2024 +Internet-Draft December 4, 2024 Intended status: Experimental -Expires: May 18, 2025 +Expires: June 7, 2025 xml2rfc index tests @@ -26,7 +26,7 @@ Status of This Memo time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." - This Internet-Draft will expire on May 18, 2025. + This Internet-Draft will expire on June 7, 2025. Copyright Notice diff --git a/tests/valid/indexes.v3.html b/tests/valid/indexes.v3.html index ae3e33e3..43f59f89 100644 --- a/tests/valid/indexes.v3.html +++ b/tests/valid/indexes.v3.html @@ -6,7 +6,7 @@ xml2rfc index tests - + @@ -19,11 +19,11 @@ Internet-Draft xml2rfc index tests -November 2024 +December 2024 Person -Expires May 18, 2025 +Expires June 7, 2025 [Page] @@ -36,12 +36,12 @@
indexes-00
Published:
- +
Intended Status:
Experimental
Expires:
-
+
Author:
@@ -71,7 +71,7 @@

time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

- This Internet-Draft will expire on May 18, 2025.

+ This Internet-Draft will expire on June 7, 2025.