From 8025bfed6ad39174b5bb08562f8e354168dbec17 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Sat, 29 Oct 2022 11:50:52 +0100 Subject: [PATCH 01/12] .github/workflows/test_1.21.yml: new, for testing release branch 1.21. --- .github/workflows/test_1.21.yml | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/test_1.21.yml diff --git a/.github/workflows/test_1.21.yml b/.github/workflows/test_1.21.yml new file mode 100644 index 000000000..99712b5d3 --- /dev/null +++ b/.github/workflows/test_1.21.yml @@ -0,0 +1,48 @@ +name: Test branch 1.21. + +on: + schedule: + - cron: '13 5 * * *' + workflow_dispatch: + +jobs: + + test_branch_121: + # Simple build+test on single platform using latest MuPDF from git. This is + # a cut-down version of `build_wheels` except that we use latest MuPDF from + # git and use a single platform and python version. + # + name: Test branch 1.21 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + + steps: + + - uses: actions/checkout@v2 + with: + ref: 1.21 + - uses: actions/setup-python@v2 + + # Set up cibuildwheel. + # + - name: cibuildwheel + uses: pypa/cibuildwheel@v2.11.2 + + env: + # We test building with the default hard-coded mupdf URL. + + # Build on single cpu. + CIBW_ARCHS_LINUX: x86_64 + + # Build for single python version. + CIBW_BUILD: "cp311*" + + # Don't build for unsupported platforms. + CIBW_SKIP: "pp* *i686 *-musllinux_* cp36*" + + # Get cibuildwheel to run pytest with each wheel. + CIBW_TEST_REQUIRES: "fontTools pytest" + CIBW_TEST_COMMAND: "pytest -s {project}/tests" + CIBW_BUILD_VERBOSITY: 3 From b3d8d615dcf74f22efe85edc390cfa4513ca8005 Mon Sep 17 00:00:00 2001 From: Francesco Ognibene <35663219+FelixFrog@users.noreply.github.com> Date: Thu, 13 Oct 2022 13:27:20 +0200 Subject: [PATCH 02/12] Fixed documentantion about lettered page labels The PDF specification explicitly says that after "a" to "b", the numbering follows "aa", "bb", ..., "zz" and not "ab", "ab", "az", "ba",... 59d6599efefe7c1028f873baec39ee7ec7a5b49a should be reverted --- docs/document.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/document.rst b/docs/document.rst index 97e7670b1..d32e965f0 100644 --- a/docs/document.rst +++ b/docs/document.rst @@ -519,7 +519,7 @@ For details on **embedded files** refer to Appendix 3. - ``startpage``: (int) the first page number (0-based) to apply the label rule. This key **must be present**. The rule is applied to all subsequent pages until either end of document or superseded by the rule with the next larger page number. - ``prefix``: (str) an arbitrary string to start the label with, e.g. "A-". Default is "". - - ``style``: (str) the numbering style. Available are "D" (decimal), "r"/"R" (Roman numbers, lower / upper case), and "a"/"A" (lower / upper case alphabetical numbering: "a" through "z", then "aa" through "az", etc.). Default is "". If "", no numbering will take place and the pages in that range will receive the same label consisting of the ``prefix`` value. If prefix is also omitted, then the label will be "". + - ``style``: (str) the numbering style. Available are "D" (decimal), "r"/"R" (Roman numbers, lower / upper case), and "a"/"A" (lower / upper case alphabetical numbering: "a" through "z", then "aa" through "zz", etc.). Default is "". If "", no numbering will take place and the pages in that range will receive the same label consisting of the ``prefix`` value. If prefix is also omitted, then the label will be "". - ``firstpagenum``: (int) start numbering with this value. Default is 1, smaller values are ignored. For example:: From ec9470590ef71a4f96c446e987ac1ac721cb3175 Mon Sep 17 00:00:00 2001 From: "Jorj X. McKie" Date: Fri, 28 Oct 2022 12:58:34 -0400 Subject: [PATCH 03/12] Change `Xml.add_link()` method We should support two different parameters, the HTML "href" value, which refers to the link target, and independently the text that is visible to the user. Also document that `Xml.add_paragraph()` isa context manager. --- docs/xml-class.rst | 9 ++++++--- fitz/fitz.i | 10 ++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/xml-class.rst b/docs/xml-class.rst index 9f1ae1364..1f5c688c8 100644 --- a/docs/xml-class.rst +++ b/docs/xml-class.rst @@ -103,9 +103,12 @@ There is no need to ever directly construct an :ref:`Xml` object: after creating :arg width: if provided, either an absolute (int) value, or a percentage string like "30%". A percentage value refers to the width of the specified ``where`` rectangle in :meth:`Story.place`. If this value is provided and ``height`` is omitted, the image will be included keeping its aspect ratio. :arg height: if provided, either an absolute (int) value, or a percentage string like "30%". A percentage value refers to the height of the specified ``where`` rectangle in :meth:`Story.place`. If this value is provided and ``width`` is omitted, the image's aspect ratio will be honored. - .. method:: add_link(link) + .. method:: add_link(href=None, text=None) - Add an :htmlTag:`a` tag. + Add an :htmlTag:`a` tag - inline element, treated like text. + + :arg str href: the URL target. + :arg str text: the text to display. If omitted, the ``href`` text is shown instead. .. method:: add_number_list @@ -113,7 +116,7 @@ There is no need to ever directly construct an :ref:`Xml` object: after creating .. method:: add_paragraph - Add a :htmlTag:`p` tag. + Add a :htmlTag:`p` tag, context manager. .. method:: add_span diff --git a/fitz/fitz.i b/fitz/fitz.i index b639cc0c7..837766641 100644 --- a/fitz/fitz.i +++ b/fitz/fitz.i @@ -13122,10 +13122,16 @@ struct Xml self.append_child(child) return child - def add_link(self, text=None): + def add_link(self, href=None, text=None): """Add a hyperlink ("a" tag)""" child = self.create_element("a") - if type(text) is str: + if not isinstance(href, str): + href = text + if not isinstance(text, str): + text = href + if href: + child.set_attribute("href", href) + if text: child.append_child(self.create_text_node(text)) prev = self.span_bottom() if prev == None: From a730bc6d8e77c2b39586cb826d79c7c70a1030f5 Mon Sep 17 00:00:00 2001 From: "Jorj X. McKie" Date: Fri, 28 Oct 2022 14:11:33 -0400 Subject: [PATCH 04/12] Make "href" a mandatory argument in Xml.add_link() The link target must always be specified. Only the its display in the text is optional. --- docs/xml-class.rst | 2 +- fitz/fitz.i | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/docs/xml-class.rst b/docs/xml-class.rst index 1f5c688c8..491d8b86c 100644 --- a/docs/xml-class.rst +++ b/docs/xml-class.rst @@ -103,7 +103,7 @@ There is no need to ever directly construct an :ref:`Xml` object: after creating :arg width: if provided, either an absolute (int) value, or a percentage string like "30%". A percentage value refers to the width of the specified ``where`` rectangle in :meth:`Story.place`. If this value is provided and ``height`` is omitted, the image will be included keeping its aspect ratio. :arg height: if provided, either an absolute (int) value, or a percentage string like "30%". A percentage value refers to the height of the specified ``where`` rectangle in :meth:`Story.place`. If this value is provided and ``width`` is omitted, the image's aspect ratio will be honored. - .. method:: add_link(href=None, text=None) + .. method:: add_link(href, text=None) Add an :htmlTag:`a` tag - inline element, treated like text. diff --git a/fitz/fitz.i b/fitz/fitz.i index 837766641..7e4289c29 100644 --- a/fitz/fitz.i +++ b/fitz/fitz.i @@ -13122,17 +13122,13 @@ struct Xml self.append_child(child) return child - def add_link(self, href=None, text=None): + def add_link(self, href, text=None): """Add a hyperlink ("a" tag)""" child = self.create_element("a") - if not isinstance(href, str): - href = text if not isinstance(text, str): text = href - if href: - child.set_attribute("href", href) - if text: - child.append_child(self.create_text_node(text)) + child.set_attribute("href", href) + child.append_child(self.create_text_node(text)) prev = self.span_bottom() if prev == None: prev = self From 1a0637701862934043789d75b26e0743036647bb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 5 Dec 2022 16:10:52 +0000 Subject: [PATCH 05/12] Creating file for storing CLA Signatures --- signatures/version1/cla.json | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 signatures/version1/cla.json diff --git a/signatures/version1/cla.json b/signatures/version1/cla.json new file mode 100644 index 000000000..18d5487f3 --- /dev/null +++ b/signatures/version1/cla.json @@ -0,0 +1,3 @@ +{ + "signedContributors": [] +} \ No newline at end of file From a354bd1870dcee2704d5f12f8bb19ca762b4f5fa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 12 Dec 2022 16:31:22 +0000 Subject: [PATCH 06/12] @jamie-lemon has signed the CLA from Pull Request #2118 --- signatures/version1/cla.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/signatures/version1/cla.json b/signatures/version1/cla.json index 18d5487f3..f5aef5a2e 100644 --- a/signatures/version1/cla.json +++ b/signatures/version1/cla.json @@ -1,3 +1,12 @@ { - "signedContributors": [] + "signedContributors": [ + { + "name": "jamie-lemon", + "id": 107279992, + "comment_id": 1346836521, + "created_at": "2022-12-12T16:30:10Z", + "repoId": 6105714, + "pullRequestNo": 2118 + } + ] } \ No newline at end of file From c19423b747423019c626a75c5555b49eacf6d650 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 12 Dec 2022 19:02:26 +0000 Subject: [PATCH 07/12] @julian-smith-artifex-com has signed the CLA from Pull Request #2120 --- signatures/version1/cla.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/signatures/version1/cla.json b/signatures/version1/cla.json index f5aef5a2e..701a979ed 100644 --- a/signatures/version1/cla.json +++ b/signatures/version1/cla.json @@ -7,6 +7,14 @@ "created_at": "2022-12-12T16:30:10Z", "repoId": 6105714, "pullRequestNo": 2118 + }, + { + "name": "julian-smith-artifex-com", + "id": 83358719, + "comment_id": 1347087940, + "created_at": "2022-12-12T18:56:01Z", + "repoId": 6105714, + "pullRequestNo": 2120 } ] } \ No newline at end of file From 8a6721e7c6eefef5688ba1d25724e97aba50e133 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 12 Dec 2022 19:04:24 +0000 Subject: [PATCH 08/12] @julian-smith-artifex-com has signed the CLA from Pull Request #2120 --- signatures/version1/cla.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/signatures/version1/cla.json b/signatures/version1/cla.json index 701a979ed..b971d276d 100644 --- a/signatures/version1/cla.json +++ b/signatures/version1/cla.json @@ -15,6 +15,22 @@ "created_at": "2022-12-12T18:56:01Z", "repoId": 6105714, "pullRequestNo": 2120 + }, + { + "name": "JorjMcKie", + "id": 8290722, + "comment_id": 1347104970, + "created_at": "2022-12-12T19:02:45Z", + "repoId": 6105714, + "pullRequestNo": 2120 + }, + { + "name": "JorjMcKie", + "id": 8290722, + "comment_id": 1347107260, + "created_at": "2022-12-12T19:03:35Z", + "repoId": 6105714, + "pullRequestNo": 2120 } ] } \ No newline at end of file From 7ee6ef25beaacbc5e6f2ecc167cb07b948feb449 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 9 Jan 2023 21:06:50 +0000 Subject: [PATCH 09/12] @arun-mani-j has signed the CLA from Pull Request #2162 --- signatures/version1/cla.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/signatures/version1/cla.json b/signatures/version1/cla.json index b971d276d..751c148e6 100644 --- a/signatures/version1/cla.json +++ b/signatures/version1/cla.json @@ -31,6 +31,14 @@ "created_at": "2022-12-12T19:03:35Z", "repoId": 6105714, "pullRequestNo": 2120 + }, + { + "name": "arun-mani-j", + "id": 49952138, + "comment_id": 1374488387, + "created_at": "2023-01-07T13:50:31Z", + "repoId": 6105714, + "pullRequestNo": 2162 } ] } \ No newline at end of file From 5948fb4100aab224de886641c721a8ae340e9a23 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Mon, 16 Jan 2023 08:47:48 +0000 Subject: [PATCH 10/12] .github/workflows/test_1.21.yml: also test on windows and mac. --- .github/workflows/test_1.21.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_1.21.yml b/.github/workflows/test_1.21.yml index 99712b5d3..cab369aab 100644 --- a/.github/workflows/test_1.21.yml +++ b/.github/workflows/test_1.21.yml @@ -8,15 +8,15 @@ on: jobs: test_branch_121: - # Simple build+test on single platform using latest MuPDF from git. This is - # a cut-down version of `build_wheels` except that we use latest MuPDF from - # git and use a single platform and python version. + # Simple build+test using latest MuPDF branch 1.21 from git. This is a + # cut-down version of `build_wheels` except that we use latest MuPDF from + # git and use a single python version. # name: Test branch 1.21 runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-20.04, windows-2019, macos-10.15] steps: @@ -39,8 +39,8 @@ jobs: # Build for single python version. CIBW_BUILD: "cp311*" - # Don't build for unsupported platforms. - CIBW_SKIP: "pp* *i686 *-musllinux_* cp36*" + # Don't build for unsupported platforms or win32. + CIBW_SKIP: "pp* *i686 *-musllinux_* cp36* *win32*" # Get cibuildwheel to run pytest with each wheel. CIBW_TEST_REQUIRES: "fontTools pytest" From 36f4d69d63c3a250bc8450e17b078ca7968163dc Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Wed, 25 Jan 2023 11:17:12 +0000 Subject: [PATCH 11/12] .github/workflows/test_latest_mupdf.yml: test 1.21 branch with mupdf master. --- .github/workflows/test_latest_mupdf.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_latest_mupdf.yml b/.github/workflows/test_latest_mupdf.yml index 10a016923..09bba2052 100644 --- a/.github/workflows/test_latest_mupdf.yml +++ b/.github/workflows/test_latest_mupdf.yml @@ -21,6 +21,8 @@ jobs: steps: - uses: actions/checkout@v2 + with: + ref: 1.21 - uses: actions/setup-python@v2 # Set up cibuildwheel. @@ -37,8 +39,6 @@ jobs: # CIBW_ENVIRONMENT: PYMUPDF_SETUP_MUPDF_TGZ="" PYMUPDF_SETUP_MUPDF_BUILD="git:--branch master https://github.com/ArtifexSoftware/mupdf.git" - PYMUPDF_SETUP_MUPDF_BUILD: "git:--branch master https://github.com/ArtifexSoftware/mupdf.git" - # Build on single cpu. CIBW_ARCHS_LINUX: x86_64 From b8977102943e07916fc659d9a6971dc99fdc9553 Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Wed, 25 Jan 2023 11:18:00 +0000 Subject: [PATCH 12/12] .github/workflows/test_latest_mupdf.yml: also test on windows ands mac. --- .github/workflows/test_latest_mupdf.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_latest_mupdf.yml b/.github/workflows/test_latest_mupdf.yml index 09bba2052..dd8c2a461 100644 --- a/.github/workflows/test_latest_mupdf.yml +++ b/.github/workflows/test_latest_mupdf.yml @@ -16,7 +16,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest] + os: [ubuntu-20.04, windows-2019, macos-10.15] steps: