From 95254951ce9036dec1f296c1b611852f2165c86b Mon Sep 17 00:00:00 2001 From: Kesara Rathnayake Date: Fri, 17 Nov 2023 11:28:07 +1300 Subject: [PATCH 1/2] fix: Follow HTML presentational hints in PDF Set `presentational_hints` option in WeasyPrint so that HTML presentational hints are respected. Fixes #1054 --- xml2rfc/writers/pdf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml2rfc/writers/pdf.py b/xml2rfc/writers/pdf.py index f8eac40e..c8612627 100644 --- a/xml2rfc/writers/pdf.py +++ b/xml2rfc/writers/pdf.py @@ -104,7 +104,7 @@ def pdf(self): page_css_text = page_css_template.format(**page_info) page_css = weasyprint.CSS(string=page_css_text) - pdf = writer.write_pdf(None, stylesheets=[ css, page_css ]) + pdf = writer.write_pdf(None, stylesheets=[ css, page_css ], presentational_hints=True) return pdf From 871c91b1042fd3164217196ddcdf010765b64bed Mon Sep 17 00:00:00 2001 From: Kesara Rathnayake Date: Fri, 17 Nov 2023 11:48:48 +1300 Subject: [PATCH 2/2] chore: Run yestests --- tests/valid/docfile.html | 4 ++-- tests/valid/draft-miek-test.html | 2 +- tests/valid/draft-template.html | 2 +- tests/valid/indexes.pages.text | 16 ++++++++-------- tests/valid/indexes.prepped.xml | 6 +++--- tests/valid/indexes.text | 6 +++--- tests/valid/indexes.v3.html | 10 +++++----- tests/valid/manpage.txt | 2 +- tests/valid/rfc7911.html | 2 +- tests/valid/sourcecode.pages.text | 20 ++++++++++---------- tests/valid/sourcecode.prepped.xml | 6 +++--- tests/valid/sourcecode.text | 6 +++--- tests/valid/sourcecode.v3.html | 10 +++++----- 13 files changed, 46 insertions(+), 46 deletions(-) diff --git a/tests/valid/docfile.html b/tests/valid/docfile.html index a7188310..e8d239f2 100644 --- a/tests/valid/docfile.html +++ b/tests/valid/docfile.html @@ -24,7 +24,7 @@ Xml2rfc Vocabulary V3 Schema -October 2023 +November 2023 xml2rfc(1) @@ -39,7 +39,7 @@
xml2rfc(1)
Published:
- +
Author:
diff --git a/tests/valid/draft-miek-test.html b/tests/valid/draft-miek-test.html index ca9b8b80..47533256 100644 --- a/tests/valid/draft-miek-test.html +++ b/tests/valid/draft-miek-test.html @@ -33,7 +33,7 @@ intervaltree 3.1.0 Jinja2 3.1.2 lxml 4.9.3 - platformdirs 3.11.0 + platformdirs 3.10.0 pycountry 22.3.5 PyYAML 6.0.1 requests 2.31.0 diff --git a/tests/valid/draft-template.html b/tests/valid/draft-template.html index 1684dd5c..384405b4 100644 --- a/tests/valid/draft-template.html +++ b/tests/valid/draft-template.html @@ -22,7 +22,7 @@ intervaltree 3.1.0 Jinja2 3.1.2 lxml 4.9.3 - platformdirs 3.11.0 + platformdirs 3.10.0 pycountry 22.3.5 PyYAML 6.0.1 requests 2.31.0 diff --git a/tests/valid/indexes.pages.text b/tests/valid/indexes.pages.text index 105c8264..efa53c9d 100644 --- a/tests/valid/indexes.pages.text +++ b/tests/valid/indexes.pages.text @@ -3,9 +3,9 @@ Network Working Group H. Person, Ed. -Internet-Draft October 26, 2023 +Internet-Draft November 16, 2023 Intended status: Experimental -Expires: April 28, 2024 +Expires: May 19, 2024 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 April 28, 2024. + This Internet-Draft will expire on May 19, 2024. Copyright Notice @@ -53,9 +53,9 @@ Table of Contents -Person Expires April 28, 2024 [Page 1] +Person Expires May 19, 2024 [Page 1] -Internet-Draft xml2rfc index tests October 2023 +Internet-Draft xml2rfc index tests November 2023 This is another section! @@ -109,9 +109,9 @@ Index -Person Expires April 28, 2024 [Page 2] +Person Expires May 19, 2024 [Page 2] -Internet-Draft xml2rfc index tests October 2023 +Internet-Draft xml2rfc index tests November 2023 E @@ -165,4 +165,4 @@ Author's Address -Person Expires April 28, 2024 [Page 3] +Person Expires May 19, 2024 [Page 3] diff --git a/tests/valid/indexes.prepped.xml b/tests/valid/indexes.prepped.xml index 1dfac855..5f736f29 100644 --- a/tests/valid/indexes.prepped.xml +++ b/tests/valid/indexes.prepped.xml @@ -1,5 +1,5 @@ - + @@ -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 28 April 2024. + This Internet-Draft will expire on 19 May 2024.
diff --git a/tests/valid/indexes.text b/tests/valid/indexes.text index a5450d8d..1afadf08 100644 --- a/tests/valid/indexes.text +++ b/tests/valid/indexes.text @@ -3,9 +3,9 @@ Network Working Group H. Person, Ed. -Internet-Draft October 26, 2023 +Internet-Draft November 16, 2023 Intended status: Experimental -Expires: April 28, 2024 +Expires: May 19, 2024 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 April 28, 2024. + This Internet-Draft will expire on May 19, 2024. Copyright Notice diff --git a/tests/valid/indexes.v3.html b/tests/valid/indexes.v3.html index 66cbd169..2445cad6 100644 --- a/tests/valid/indexes.v3.html +++ b/tests/valid/indexes.v3.html @@ -19,11 +19,11 @@ Internet-Draft xml2rfc index tests -October 2023 +November 2023 Person -Expires April 28, 2024 +Expires May 19, 2024 [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 April 28, 2024.

+ This Internet-Draft will expire on May 19, 2024.