Skip to content

Commit ff68e24

Browse files
authored
Merge pull request #2234 from strictdoc-project/stanislaw/html2pdf4doc
pyproject.toml: switch to html2pdf4doc
2 parents 29db18f + a1a4b18 commit ff68e24

File tree

11 files changed

+18
-17
lines changed

11 files changed

+18
-17
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# https://stackoverflow.com/a/64473931/598057
22
from PyInstaller.utils.hooks import collect_data_files
33

4-
# The following ensures that the HTML2PDF.js file is present in the
4+
# The following ensures that the HTML2PDF4Doc.js file is present in the
55
# PyInstaller bundle of StrictDoc.
6-
datas = collect_data_files("html2print")
6+
datas = collect_data_files("html2pdf4doc")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ dependencies = [
8888
"WebSockets",
8989

9090
# HTML2PDF dependencies
91-
"html2print >= 0.0.17",
91+
"html2pdf4doc >= 0.0.17",
9292
]
9393
# @sdoc[/SDOC-SRS-89]
9494

strictdoc/export/html/html_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pathlib import Path
55
from typing import Dict, List, Optional, Tuple
66

7-
from html2print.html2print import PATH_TO_HTML2PDF_JS
7+
from html2pdf4doc.html2pdf4doc import PATH_TO_HTML2PDF4DOC_JS
88

99
from strictdoc.backend.sdoc.models.document import SDocDocument
1010
from strictdoc.core.asset_manager import AssetDir
@@ -241,7 +241,7 @@ def export_assets(
241241
# Export HTML2PDF
242242
if project_config.is_feature_activated(ProjectFeature.HTML2PDF):
243243
sync_dir(
244-
os.path.dirname(PATH_TO_HTML2PDF_JS),
244+
os.path.dirname(PATH_TO_HTML2PDF4DOC_JS),
245245
output_html_static_files,
246246
message="Copying HTML2PDF.js",
247247
)

strictdoc/export/html/templates/screens/document/pdf/index.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
data-page-break-before-selectors='H2'
3434
data-no-break-selectors='sdoc-section-title sdoc-meta sdoc-requirement-title .pdf-toc-row'
3535
data-no-hanging-selectors='sdoc-section-title sdoc-meta .admonition-title sdoc-requirement-title sdoc-requirement-field-label strong:only-child'
36-
src="{{ view_object.render_static_url('html2pdf.min.js') }}"></script>
36+
src="{{ view_object.render_static_url('html2pdf4doc.min.js') }}"></script>
3737
{%- endif -%}
3838

3939
{{ super() }}

strictdoc/export/html2pdf/pdf_print_driver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ def get_pdf_from_html(
1313
paths_to_print: List[Tuple[str, str]],
1414
) -> None:
1515
assert isinstance(paths_to_print, list), paths_to_print
16-
path_to_html2print_cache = os.path.join(
16+
path_to_html2pdf4doc_cache = os.path.join(
1717
project_config.get_path_to_cache_dir(), "html2pdf"
1818
)
1919
cmd: List[str] = [
2020
# Using sys.executable instead of "python" is important because
2121
# venv subprocess call to python resolves to wrong interpreter,
2222
# https://github.com/python/cpython/issues/86207
23-
# Switching back to calling html2print directly because the
23+
# Switching back to calling html2pdf4doc directly because the
2424
# python -m doesn't work well with PyInstaller.
2525
# sys.executable, "-m"
26-
"html2print",
26+
"html2pdf4doc",
2727
"print",
2828
"--cache-dir",
29-
path_to_html2print_cache,
29+
path_to_html2pdf4doc_cache,
3030
]
3131
if project_config.chromedriver is not None:
3232
cmd.extend(

tests/integration/features/html2pdf/01_empty_document/test.itest

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
REQUIRES: TEST_HTML2PDF
22

33
RUN: %strictdoc export %S --formats=html2pdf --output-dir Output | filecheck %s --dump-input=fail
4-
CHECK: html2print: JS logs from the print session
4+
CHECK: html2pdf4doc: ChromeDriver available at path: {{.*}}
5+
CHECK: html2pdf4doc: JS logs from the print session
56

67
RUN: %check_exists --file %S/Output/html2pdf/pdf/input.pdf
78

tests/integration/features/html2pdf/02_three_top_level_requirements/test.itest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
REQUIRES: TEST_HTML2PDF
22

33
RUN: %strictdoc export %S --formats=html2pdf --output-dir Output | filecheck %s --dump-input=fail
4-
CHECK: html2print: JS logs from the print session
4+
CHECK: html2pdf4doc: JS logs from the print session
55

66
RUN: %check_exists --file %S/Output/html2pdf/pdf/input.pdf
77
RUN: %check_exists --file %S/Output/html2pdf/pdf/nested/input2.pdf

tests/integration/features/html2pdf/03_three_documents_with_assets/test.itest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
REQUIRES: TEST_HTML2PDF
22

33
RUN: %strictdoc export %S --formats=html2pdf --output-dir Output | filecheck %s --dump-input=fail
4-
CHECK: html2print: JS logs from the print session
4+
CHECK: html2pdf4doc: JS logs from the print session
55

66
RUN: %check_exists --file %S/Output/html2pdf/html/03_three_documents_with_assets/input.html
77
RUN: %check_exists --file %S/Output/html2pdf/html/03_three_documents_with_assets/nested/input2.html

tests/integration/features/html2pdf/04_composable_document_with_assets/test.itest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
REQUIRES: TEST_HTML2PDF
22

33
RUN: %strictdoc export %S --formats=html2pdf --included-documents --output-dir Output | filecheck %s --dump-input=fail
4-
CHECK: html2print: JS logs from the print session
4+
CHECK: html2pdf4doc: JS logs from the print session
55

66
RUN: %check_exists --file %S/Output/html2pdf/html/04_composable_document_with_assets/input.html
77
RUN: %check_exists --file %S/Output/html2pdf/html/04_composable_document_with_assets/nested/input2.html

tests/integration/features/html2pdf/05_generate_bundle_document/test.itest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
REQUIRES: TEST_HTML2PDF
22

33
RUN: %strictdoc export %S --formats=html2pdf --generate-bundle-document --output-dir Output | filecheck %s --dump-input=fail
4-
CHECK: html2print: JS logs from the print session
4+
CHECK: html2pdf4doc: JS logs from the print session
55

66
RUN: %check_exists --file %S/Output/html2pdf/html/bundle.html
77
RUN: %check_exists --file %S/Output/html2pdf/html/%THIS_TEST_FOLDER/input.html

tests/integration/features/html2pdf/06_system_chromedriver/test.itest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ REQUIRES: SYSTEM_CHROMEDRIVER
44
# GitHub images provide a chromedriver and export installed location, see
55
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#browsers-and-drivers
66
RUN: %strictdoc export %S --formats=html2pdf --chromedriver="%chromedriver" --output-dir Output | filecheck %s --dump-input=fail
7-
CHECK: html2print: JS logs from the print session
8-
CHECK-NOT: HTML2PDF: Chrome Driver available at path: {{.*}}strictdoc_cache{{.*}}
7+
CHECK: html2pdf4doc: JS logs from the print session
8+
CHECK-NOT: html2pdf4doc: ChromeDriver available at path: {{.*}}strictdoc_cache{{.*}}
99

1010
RUN: %check_exists --file %S/Output/html2pdf/pdf/input.pdf
1111

0 commit comments

Comments
 (0)