From e2b87343c5341d521f3dceb4976fad8054ac7efd Mon Sep 17 00:00:00 2001 From: Kesara Rathnayake Date: Tue, 17 Sep 2024 10:19:54 +1200 Subject: [PATCH] fix(text): Update non-ASCII art text (#1140) * fix(text): Update non-ASCII art text Fixes #617 This change introduces two new command line options for text: --rfc-html-archive-url Default value: https://www.rfc-editor.org/rfc/ URL for HTML file archive of RFCs. --id-html-archive-url Default value: https://www.ietf.org/archive/id/ URL for HTML file archive Internet-Drafts. * chore: Run yestests pre-changes * chore: Run yestests post-changes --- test.py | 29 ++++++++++++++++++++++++ tests/valid/docfile.html | 36 +++++++++++++++++++++++------- tests/valid/draft-miek-test.html | 6 ++--- tests/valid/draft-template.html | 6 ++--- tests/valid/draft-v3-features.text | 19 ++++++++-------- tests/valid/elements.bom.text | 8 +++---- tests/valid/elements.pages.text | 8 +++---- tests/valid/elements.text | 8 +++---- tests/valid/elements.wip.text | 8 +++---- tests/valid/indexes.pages.text | 16 ++++++------- tests/valid/indexes.prepped.xml | 8 +++---- tests/valid/indexes.text | 6 ++--- tests/valid/indexes.v3.html | 12 +++++----- tests/valid/manpage.txt | 22 +++++++++++++----- tests/valid/rfc7911.html | 6 ++--- tests/valid/sourcecode.pages.text | 20 ++++++++--------- tests/valid/sourcecode.prepped.xml | 8 +++---- tests/valid/sourcecode.text | 6 ++--- tests/valid/sourcecode.v3.html | 12 +++++----- xml2rfc/run.py | 4 ++++ xml2rfc/writers/base.py | 2 ++ xml2rfc/writers/text.py | 11 +++++---- 22 files changed, 166 insertions(+), 95 deletions(-) diff --git a/test.py b/test.py index fe2a9199..b525ccc8 100644 --- a/test.py +++ b/test.py @@ -697,6 +697,35 @@ def test_render_reference(self): self.assertEqual(len(lines), 2) self.assertIn(url, lines[1].text) + def test_render_artwork_svg_only(self): + artwork_str = ''' + + + foobar + +''' + artwork = lxml.etree.fromstring(artwork_str) + + # for RFC + self.writer.root = lxml.etree.fromstring(f'') + self.writer.options.rfc = True + self.writer.rfcnumber = 1234 + lines = self.writer.render_artwork(artwork, width=60) + text = ''.join(line.text for line in lines) + self.assertIn("Artwork only available as svg", text) + self.assertIn(default_options.rfc_html_archive_url, text) + self.assertIn('rfc1234.html', text) + + # for Draft + self.writer.options.rfc = None + lines = self.writer.render_artwork(artwork, width=60) + text = ' '.join(line.text for line in lines) + self.assertIn("Artwork only available as svg", text) + self.assertIn(default_options.id_html_archive_url, text) + self.assertIn(".html", text) + + + class BaseV3WriterTest(unittest.TestCase): '''BaseV3Writer tests''' diff --git a/tests/valid/docfile.html b/tests/valid/docfile.html index f3cb7604..3ccf9d71 100644 --- a/tests/valid/docfile.html +++ b/tests/valid/docfile.html @@ -4,15 +4,15 @@ -Xml2rfc Vocabulary Version 3 Schema xml2rfc release 3.22.0 +Xml2rfc Vocabulary Version 3 Schema xml2rfc release 3.23.0 - - + + @@ -24,7 +24,7 @@ Xml2rfc Vocabulary V3 Schema -August 2024 +September 2024 xml2rfc(1) @@ -39,7 +39,7 @@
xml2rfc(1)
Published:
- +
Author:
@@ -49,7 +49,7 @@
-

Xml2rfc Vocabulary Version 3 Schema
xml2rfc release 3.22.0

+

Xml2rfc Vocabulary Version 3 Schema
xml2rfc release 3.23.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.22.0.

+ This documentation applies to xml2rfc version 3.23.0.

@@ -6188,6 +6188,26 @@

+ +
+
+
+--rfc-html-archive-url
+
+
+


Default value: https://www.rfc-editor.org/rfc/

+

+ URL for HTML file archive of RFCs.

+
+
+
+
+--id-html-archive-url
+
+
+


Default value: https://www.ietf.org/archive/id/

+

+ URL for HTML file archive Internet-Drafts.

@@ -6367,7 +6387,7 @@

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

+ manpage Jinja2 template, as of xml2rfc version 3.23.0:

{{ bare_latin_tags }}:
diff --git a/tests/valid/draft-miek-test.html b/tests/valid/draft-miek-test.html index 20b63000..e8bebf54 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 20 February 2025. + This Internet-Draft will expire on 20 March 2025.
diff --git a/tests/valid/indexes.text b/tests/valid/indexes.text index e3825c95..6c27adde 100644 --- a/tests/valid/indexes.text +++ b/tests/valid/indexes.text @@ -3,9 +3,9 @@ Network Working Group H. Person, Ed. -Internet-Draft August 19, 2024 +Internet-Draft September 16, 2024 Intended status: Experimental -Expires: February 20, 2025 +Expires: March 20, 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 February 20, 2025. + This Internet-Draft will expire on March 20, 2025. Copyright Notice diff --git a/tests/valid/indexes.v3.html b/tests/valid/indexes.v3.html index 825690f8..887310fa 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 -August 2024 +September 2024 Person -Expires February 20, 2025 +Expires March 20, 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 February 20, 2025.

+ This Internet-Draft will expire on March 20, 2025.