BabelDOC 0.1.24__tar.gz → 0.1.26__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. {babeldoc-0.1.24 → babeldoc-0.1.26}/.github/workflows/docs.yml +1 -1
  2. {babeldoc-0.1.24 → babeldoc-0.1.26}/.github/workflows/publish-to-pypi.yml +3 -3
  3. {babeldoc-0.1.24 → babeldoc-0.1.26}/.github/workflows/test.yml +1 -1
  4. {babeldoc-0.1.24 → babeldoc-0.1.26}/PKG-INFO +13 -3
  5. {babeldoc-0.1.24 → babeldoc-0.1.26}/README.md +12 -2
  6. babeldoc-0.1.26/babeldoc/__init__.py +1 -0
  7. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/const.py +1 -1
  8. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/backend/pdf_creater.py +6 -2
  9. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/midend/styles_and_formulas.py +3 -1
  10. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/midend/typesetting.py +6 -1
  11. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/utils/fontmap.py +11 -4
  12. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/docvision/doclayout.py +1 -1
  13. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/high_level.py +107 -0
  14. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/main.py +20 -6
  15. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/progress_monitor.py +33 -0
  16. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/translation_config.py +54 -0
  17. babeldoc-0.1.26/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.png +0 -0
  18. babeldoc-0.1.26/docs/images/babeldoc-big-logo-darkmode-with-transparent-background.svg +16 -0
  19. babeldoc-0.1.26/docs/images/babeldoc-big-logo-with-transparent-background.png +0 -0
  20. babeldoc-0.1.26/docs/images/babeldoc-big-logo-with-transparent-background.svg +16 -0
  21. babeldoc-0.1.26/docs/images/babeldoc-big-logo.png +0 -0
  22. babeldoc-0.1.26/docs/images/babeldoc-small-logo-with-transparent-background.png +0 -0
  23. babeldoc-0.1.26/docs/images/babeldoc-small-logo-with-transparent-background.svg +15 -0
  24. babeldoc-0.1.26/docs/images/babeldoc-small-logo.png +0 -0
  25. {babeldoc-0.1.24 → babeldoc-0.1.26}/mkdocs.yml +3 -3
  26. {babeldoc-0.1.24 → babeldoc-0.1.26}/pyproject.toml +2 -2
  27. {babeldoc-0.1.24 → babeldoc-0.1.26}/uv.lock +4 -4
  28. babeldoc-0.1.24/babeldoc/__init__.py +0 -1
  29. {babeldoc-0.1.24 → babeldoc-0.1.26}/.cursorignore +0 -0
  30. {babeldoc-0.1.24 → babeldoc-0.1.26}/.github/ISSUE_TEMPLATE/bug_report.yaml +0 -0
  31. {babeldoc-0.1.24 → babeldoc-0.1.26}/.github/ISSUE_TEMPLATE/feature_request.yaml +0 -0
  32. {babeldoc-0.1.24 → babeldoc-0.1.26}/.github/dependabot.yml +0 -0
  33. {babeldoc-0.1.24 → babeldoc-0.1.26}/.github/labels.yml +0 -0
  34. {babeldoc-0.1.24 → babeldoc-0.1.26}/.github/release-drafter.yml +0 -0
  35. {babeldoc-0.1.24 → babeldoc-0.1.26}/.github/workflows/codeql.yml +0 -0
  36. {babeldoc-0.1.24 → babeldoc-0.1.26}/.github/workflows/labeler.yml +0 -0
  37. {babeldoc-0.1.24 → babeldoc-0.1.26}/.gitignore +0 -0
  38. {babeldoc-0.1.24 → babeldoc-0.1.26}/.pre-commit-config.yaml +0 -0
  39. {babeldoc-0.1.24 → babeldoc-0.1.26}/LICENSE +0 -0
  40. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/assets/assets.py +0 -0
  41. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/assets/embedding_assets_metadata.py +0 -0
  42. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/asynchronize/__init__.py +0 -0
  43. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/converter.py +0 -0
  44. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/__init__.py +0 -0
  45. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/babeldoc_exception/BabelDOCException.py +0 -0
  46. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/backend/__init__.py +0 -0
  47. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/frontend/__init__.py +0 -0
  48. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/frontend/il_creater.py +0 -0
  49. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/il_version_1.py +0 -0
  50. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/il_version_1.rnc +0 -0
  51. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/il_version_1.rng +0 -0
  52. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/il_version_1.xsd +0 -0
  53. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/midend/__init__.py +0 -0
  54. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/midend/add_debug_information.py +0 -0
  55. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/midend/detect_scanned_file.py +0 -0
  56. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/midend/il_translator.py +0 -0
  57. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/midend/layout_parser.py +0 -0
  58. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/midend/paragraph_finder.py +0 -0
  59. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/midend/remove_descent.py +0 -0
  60. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/translator/__init__.py +0 -0
  61. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/translator/cache.py +0 -0
  62. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/translator/translator.py +0 -0
  63. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/utils/layout_helper.py +0 -0
  64. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/utils/style_helper.py +0 -0
  65. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/document_il/xml_converter.py +0 -0
  66. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/docvision/README.md +0 -0
  67. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/docvision/__init__.py +0 -0
  68. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/docvision/rpc_doclayout.py +0 -0
  69. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/pdfinterp.py +0 -0
  70. {babeldoc-0.1.24 → babeldoc-0.1.26}/babeldoc/tools/generate_font_metadata.py +0 -0
  71. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/CODE_OF_CONDUCT.md +0 -0
  72. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/CONTRIBUTING.md +0 -0
  73. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/CONTRIBUTOR_REWARD.md +0 -0
  74. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/ImplementationDetails/AsyncTranslate/AsyncTranslate.md +0 -0
  75. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/ImplementationDetails/ILTranslator/ILTranslator.md +0 -0
  76. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/ImplementationDetails/PDFCreation/PDFCreation.md +0 -0
  77. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/ImplementationDetails/PDFParsing/PDFParsing.md +0 -0
  78. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/ImplementationDetails/ParagraphFinding/ParagraphFinding.md +0 -0
  79. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/ImplementationDetails/README.md +0 -0
  80. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/ImplementationDetails/StylesAndFormulas/StylesAndFormulas.md +0 -0
  81. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/ImplementationDetails/Typesetting/Typesetting.md +0 -0
  82. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/README.md +0 -0
  83. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/deploy.sh +0 -0
  84. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/images/babeldoc-banner.png +0 -0
  85. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/images/babeldoc-contributor_reward_example.png +0 -0
  86. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/images/babeldoc-preview.gif +0 -0
  87. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/index.md +0 -0
  88. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/intro-to-pdf-object.md +0 -0
  89. {babeldoc-0.1.24 → babeldoc-0.1.26}/docs/requirements.txt +0 -0
  90. {babeldoc-0.1.24 → babeldoc-0.1.26}/tests/test_translation_config.py +0 -0
@@ -17,7 +17,7 @@ jobs:
17
17
  git config user.name github-actions[bot]
18
18
  git config user.email 41898282+github-actions[bot]@users.noreply.github.com
19
19
  - name: Setup uv with Python 3.12
20
- uses: astral-sh/setup-uv@1edb52594c857e2b5b13128931090f0640537287 # v5.3.0
20
+ uses: astral-sh/setup-uv@f94ec6bedd8674c4426838e6b50417d36b6ab231 # v5.3.1
21
21
  with:
22
22
  python-version: "3.12"
23
23
  enable-cache: true
@@ -35,7 +35,7 @@ jobs:
35
35
  token: ${{ secrets.GITHUB_TOKEN }}
36
36
 
37
37
  - name: Setup uv with Python 3.12
38
- uses: astral-sh/setup-uv@1edb52594c857e2b5b13128931090f0640537287 # v5.3.0
38
+ uses: astral-sh/setup-uv@f94ec6bedd8674c4426838e6b50417d36b6ab231 # v5.3.1
39
39
  with:
40
40
  python-version: "3.12"
41
41
  enable-cache: true
@@ -89,7 +89,7 @@ jobs:
89
89
 
90
90
  steps:
91
91
  - name: Download all the dists
92
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
92
+ uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
93
93
  with:
94
94
  name: python-package-distributions
95
95
  path: dist/
@@ -113,7 +113,7 @@ jobs:
113
113
 
114
114
  steps:
115
115
  - name: Download all the dists
116
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
116
+ uses: actions/download-artifact@cc203385981b70ca67e1cc392babf9cc229d5806 # v4.1.9
117
117
  with:
118
118
  name: python-package-distributions
119
119
  path: dist/
@@ -28,7 +28,7 @@ jobs:
28
28
  path: ~/.cache/babeldoc
29
29
  key: babeldoc-assets-${{ hashFiles('babeldoc/assets/embedding_assets_metadata.py') }}
30
30
  - name: Setup uv with Python ${{ matrix.python-version }}
31
- uses: astral-sh/setup-uv@1edb52594c857e2b5b13128931090f0640537287 # v5.3.0
31
+ uses: astral-sh/setup-uv@f94ec6bedd8674c4426838e6b50417d36b6ab231 # v5.3.1
32
32
  with:
33
33
  python-version: ${{ matrix.python-version }}
34
34
  enable-cache: true
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: BabelDOC
3
- Version: 0.1.24
3
+ Version: 0.1.26
4
4
  Summary: Yet Another Document Translator
5
5
  Project-URL: Homepage, https://github.com/funstory-ai/BabelDOC
6
6
  Project-URL: Issues, https://github.com/funstory-ai/BabelDOC/issues
@@ -36,10 +36,16 @@ Description-Content-Type: text/markdown
36
36
  <!-- # Yet Another Document Translator -->
37
37
 
38
38
  <div align="center">
39
- <img src="https://s.immersivetranslate.com/assets/r2-uploads/images/babeldoc-banner.png" width="320px" alt="YADT"/>
39
+ <!-- <img src="https://s.immersivetranslate.com/assets/r2-uploads/images/babeldoc-banner.png" width="320px" alt="YADT"/> -->
40
40
 
41
+ <br/>
41
42
 
42
- <h2 id="title">BabelDOC</h2>
43
+ <picture>
44
+ <source media="(prefers-color-scheme: dark)" srcset="https://s.immersivetranslate.com/assets/uploads/babeldoc-big-logo-darkmode-with-transparent-background-IKuNO1.svg" width="320px" alt="BabelDOC"/>
45
+ <img src="https://s.immersivetranslate.com/assets/uploads/babeldoc-big-logo-with-transparent-background-2xweBr.svg" width="320px" alt="BabelDOC"/>
46
+ </picture>
47
+
48
+ <!-- <h2 id="title">BabelDOC</h2> -->
43
49
 
44
50
  <p>
45
51
  <!-- PyPI -->
@@ -151,6 +157,8 @@ uv run babeldoc --bing --files example.pdf --files example2.pdf
151
157
  - `--disable-rich-text-translate`: Disable rich text translation (may help improve compatibility with some PDFs)
152
158
  - `--enhance-compatibility`: Enable all compatibility enhancement options (equivalent to --skip-clean --dual-translate-first --disable-rich-text-translate)
153
159
  - `--use-alternating-pages-dual`: Use alternating pages mode for dual PDF. When enabled, original and translated pages are arranged in alternate order. When disabled (default), original and translated pages are shown side by side on the same page.
160
+ - `--watermark-output-mode`: Control watermark output mode: 'watermarked' (default) adds watermark to translated PDF, 'no_watermark' doesn't add watermark, 'both' outputs both versions.
161
+ - `--no-watermark`: [DEPRECATED] Use --watermark-output-mode=no_watermark instead.
154
162
 
155
163
  > [!TIP]
156
164
  > - Both `--skip-clean` and `--dual-translate-first` may help improve compatibility with some PDF readers
@@ -256,6 +264,8 @@ skip-clean = false
256
264
  dual-translate-first = false
257
265
  disable-rich-text-translate = false
258
266
  use-alternating-pages-dual = false
267
+ watermark-output-mode = "watermarked" # Choices: "watermarked", "no_watermark", "both"
268
+ # no-watermark = false # DEPRECATED: Use watermark-output-mode instead
259
269
 
260
270
  # Output control
261
271
  no-dual = false
@@ -1,10 +1,16 @@
1
1
  <!-- # Yet Another Document Translator -->
2
2
 
3
3
  <div align="center">
4
- <img src="https://s.immersivetranslate.com/assets/r2-uploads/images/babeldoc-banner.png" width="320px" alt="YADT"/>
4
+ <!-- <img src="https://s.immersivetranslate.com/assets/r2-uploads/images/babeldoc-banner.png" width="320px" alt="YADT"/> -->
5
5
 
6
+ <br/>
6
7
 
7
- <h2 id="title">BabelDOC</h2>
8
+ <picture>
9
+ <source media="(prefers-color-scheme: dark)" srcset="https://s.immersivetranslate.com/assets/uploads/babeldoc-big-logo-darkmode-with-transparent-background-IKuNO1.svg" width="320px" alt="BabelDOC"/>
10
+ <img src="https://s.immersivetranslate.com/assets/uploads/babeldoc-big-logo-with-transparent-background-2xweBr.svg" width="320px" alt="BabelDOC"/>
11
+ </picture>
12
+
13
+ <!-- <h2 id="title">BabelDOC</h2> -->
8
14
 
9
15
  <p>
10
16
  <!-- PyPI -->
@@ -116,6 +122,8 @@ uv run babeldoc --bing --files example.pdf --files example2.pdf
116
122
  - `--disable-rich-text-translate`: Disable rich text translation (may help improve compatibility with some PDFs)
117
123
  - `--enhance-compatibility`: Enable all compatibility enhancement options (equivalent to --skip-clean --dual-translate-first --disable-rich-text-translate)
118
124
  - `--use-alternating-pages-dual`: Use alternating pages mode for dual PDF. When enabled, original and translated pages are arranged in alternate order. When disabled (default), original and translated pages are shown side by side on the same page.
125
+ - `--watermark-output-mode`: Control watermark output mode: 'watermarked' (default) adds watermark to translated PDF, 'no_watermark' doesn't add watermark, 'both' outputs both versions.
126
+ - `--no-watermark`: [DEPRECATED] Use --watermark-output-mode=no_watermark instead.
119
127
 
120
128
  > [!TIP]
121
129
  > - Both `--skip-clean` and `--dual-translate-first` may help improve compatibility with some PDF readers
@@ -221,6 +229,8 @@ skip-clean = false
221
229
  dual-translate-first = false
222
230
  disable-rich-text-translate = false
223
231
  use-alternating-pages-dual = false
232
+ watermark-output-mode = "watermarked" # Choices: "watermarked", "no_watermark", "both"
233
+ # no-watermark = false # DEPRECATED: Use watermark-output-mode instead
224
234
 
225
235
  # Output control
226
236
  no-dual = false
@@ -0,0 +1 @@
1
+ __version__ = "0.1.26"
@@ -2,7 +2,7 @@ import shutil
2
2
  import subprocess
3
3
  from pathlib import Path
4
4
 
5
- __version__ = "0.1.24"
5
+ __version__ = "0.1.26"
6
6
 
7
7
  CACHE_FOLDER = Path.home() / ".cache" / "babeldoc"
8
8
 
@@ -12,6 +12,7 @@ from babeldoc.document_il import il_version_1
12
12
  from babeldoc.document_il.utils.fontmap import FontMapper
13
13
  from babeldoc.translation_config import TranslateResult
14
14
  from babeldoc.translation_config import TranslationConfig
15
+ from babeldoc.translation_config import WatermarkOutputMode
15
16
 
16
17
  logger = logging.getLogger(__name__)
17
18
 
@@ -416,8 +417,9 @@ class PDFCreater:
416
417
  pdf = self.subset_fonts_in_subprocess(pdf, translation_config, tag="debug")
417
418
  return pdf
418
419
 
420
+ @staticmethod
419
421
  def subset_fonts_in_subprocess(
420
- self, pdf: pymupdf.Document, translation_config: TranslationConfig, tag: str
422
+ pdf: pymupdf.Document, translation_config: TranslationConfig, tag: str
421
423
  ) -> pymupdf.Document:
422
424
  """Run font subsetting in a subprocess with timeout.
423
425
 
@@ -489,8 +491,8 @@ class PDFCreater:
489
491
  )
490
492
  return original_pdf
491
493
 
494
+ @staticmethod
492
495
  def save_pdf_with_timeout(
493
- self,
494
496
  pdf: pymupdf.Document,
495
497
  output_path: str,
496
498
  translation_config: TranslationConfig,
@@ -634,6 +636,8 @@ class PDFCreater:
634
636
  def write(self, translation_config: TranslationConfig) -> TranslateResult:
635
637
  basename = Path(translation_config.input_file).stem
636
638
  debug_suffix = ".debug" if translation_config.debug else ""
639
+ if translation_config.watermark_output_mode != WatermarkOutputMode.Watermarked:
640
+ debug_suffix += ".no_watermark"
637
641
  mono_out_path = translation_config.get_output_file_path(
638
642
  f"{basename}{debug_suffix}.{translation_config.lang_out}.mono.pdf",
639
643
  )
@@ -479,7 +479,9 @@ class StylesAndFormulas:
479
479
  return bool(re.match(r"^[0-9, ]+$", text))
480
480
 
481
481
  def is_formulas_font(self, font_name: str) -> bool:
482
- pattern2 = r"^(Cambria|Cambria-BoldItalic|Cambria-Bold|Cambria-Italic)$"
482
+ pattern2 = (
483
+ r"^(Cambria|Cambria-BoldItalic|Cambria-Bold|Cambria-Italic|EUAlbertina.+)$"
484
+ )
483
485
  if self.translation_config.formular_font_pattern:
484
486
  pattern = self.translation_config.formular_font_pattern
485
487
  else:
@@ -15,6 +15,7 @@ from babeldoc.document_il import PdfStyle
15
15
  from babeldoc.document_il import il_version_1
16
16
  from babeldoc.document_il.utils.fontmap import FontMapper
17
17
  from babeldoc.translation_config import TranslationConfig
18
+ from babeldoc.translation_config import WatermarkOutputMode
18
19
 
19
20
  logger = logging.getLogger(__name__)
20
21
 
@@ -450,7 +451,11 @@ class Typesetting:
450
451
  fonts[xobj.xobj_id] = page_fonts.copy()
451
452
  for font in xobj.pdf_font:
452
453
  fonts[xobj.xobj_id][font.font_id] = font
453
- if page.page_number == 0:
454
+ if (
455
+ page.page_number == 0
456
+ and self.translation_config.watermark_output_mode
457
+ == WatermarkOutputMode.Watermarked
458
+ ):
454
459
  self.add_watermark(page)
455
460
  # 开始实际的渲染过程
456
461
  for paragraph in page.pdf_paragraph:
@@ -33,7 +33,14 @@ class FontMapper:
33
33
  if font_file_name in self.fontid2fontpath:
34
34
  continue
35
35
  font_path, font_metadata = assets.get_font_and_metadata(font_file_name)
36
- self.fonts[font_file_name] = pymupdf.Font(fontfile=str(font_path))
36
+ pymupdf_font = pymupdf.Font(fontfile=str(font_path))
37
+ pymupdf_font.has_glyph = functools.lru_cache(maxsize=10240, typed=True)(
38
+ pymupdf_font.has_glyph,
39
+ )
40
+ pymupdf_font.char_lengths = functools.lru_cache(maxsize=10240, typed=True)(
41
+ pymupdf_font.char_lengths,
42
+ )
43
+ self.fonts[font_file_name] = pymupdf_font
37
44
  self.fontid2fontpath[font_file_name] = font_path
38
45
  self.fonts[font_file_name].font_id = font_file_name
39
46
  self.fonts[font_file_name].font_path = font_path
@@ -106,12 +113,12 @@ class FontMapper:
106
113
  for font in self.type2font[font_type]:
107
114
  if not font.has_glyph(current_char):
108
115
  continue
109
- if bold != font.is_bold:
116
+ if bool(bold) != bool(font.is_bold):
110
117
  continue
111
118
  # 不知道什么原因,思源黑体的 serif 属性为 1,先 workaround
112
- if serif == 1 and "serif" not in font.font_id.lower():
119
+ if bool(serif) and "serif" not in font.font_id.lower():
113
120
  continue
114
- if serif == 0 and "serif" in font.font_id.lower():
121
+ if not bool(serif) and "serif" in font.font_id.lower():
115
122
  continue
116
123
  return font
117
124
 
@@ -192,7 +192,7 @@ class OnnxModel(DocLayoutModel):
192
192
  boxes[..., :4] = (boxes[..., :4] - [pad_x, pad_y, pad_x, pad_y]) / gain
193
193
  return boxes
194
194
 
195
- def predict(self, image, imgsz=1024, batch_size=16, **kwargs):
195
+ def predict(self, image, imgsz=800, batch_size=16, **kwargs):
196
196
  """
197
197
  Predict the layout of document pages.
198
198
 
@@ -1,6 +1,9 @@
1
1
  import asyncio
2
+ import copy
2
3
  import hashlib
4
+ import io
3
5
  import logging
6
+ import pathlib
4
7
  import threading
5
8
  import time
6
9
  from asyncio import CancelledError
@@ -19,6 +22,7 @@ from babeldoc import asynchronize
19
22
  from babeldoc.assets.assets import warmup
20
23
  from babeldoc.const import CACHE_FOLDER
21
24
  from babeldoc.converter import TranslateConverter
25
+ from babeldoc.document_il import il_version_1
22
26
  from babeldoc.document_il.backend.pdf_creater import SAVE_PDF_STAGE_NAME
23
27
  from babeldoc.document_il.backend.pdf_creater import SUBSET_FONT_STAGE_NAME
24
28
  from babeldoc.document_il.backend.pdf_creater import PDFCreater
@@ -37,6 +41,7 @@ from babeldoc.pdfinterp import PDFPageInterpreterEx
37
41
  from babeldoc.progress_monitor import ProgressMonitor
38
42
  from babeldoc.translation_config import TranslateResult
39
43
  from babeldoc.translation_config import TranslationConfig
44
+ from babeldoc.translation_config import WatermarkOutputMode
40
45
 
41
46
  logger = logging.getLogger(__name__)
42
47
 
@@ -365,6 +370,13 @@ def do_translate(pm, translation_config):
365
370
  docs,
366
371
  translation_config.get_working_file_path("add_debug_information.json"),
367
372
  )
373
+ mono_watermark_first_page_doc_bytes = None
374
+ dual_watermark_first_page_doc_bytes = None
375
+
376
+ if translation_config.watermark_output_mode == WatermarkOutputMode.Both:
377
+ mono_watermark_first_page_doc_bytes, dual_watermark_first_page_doc_bytes = (
378
+ generate_first_page_with_watermark(doc_input, translation_config, docs)
379
+ )
368
380
 
369
381
  Typesetting(translation_config).typsetting_document(docs)
370
382
  logger.debug(f"finish typsetting from {temp_pdf_path}")
@@ -377,6 +389,22 @@ def do_translate(pm, translation_config):
377
389
  # docs2 = xml_converter.deepcopy(docs)
378
390
  pdf_creater = PDFCreater(temp_pdf_path, docs, translation_config)
379
391
  result = pdf_creater.write(translation_config)
392
+
393
+ if mono_watermark_first_page_doc_bytes:
394
+ mono_watermark_pdf = merge_watermark_doc(
395
+ result.mono_pdf_path,
396
+ mono_watermark_first_page_doc_bytes,
397
+ translation_config,
398
+ )
399
+ result.mono_pdf_path = mono_watermark_pdf
400
+ if dual_watermark_first_page_doc_bytes:
401
+ dual_watermark_pdf = merge_watermark_doc(
402
+ result.dual_pdf_path,
403
+ dual_watermark_first_page_doc_bytes,
404
+ translation_config,
405
+ )
406
+ result.dual_pdf_path = dual_watermark_pdf
407
+
380
408
  finish_time = time.time()
381
409
  result.original_pdf_path = original_pdf_path
382
410
  result.total_seconds = finish_time - start_time
@@ -395,6 +423,85 @@ def do_translate(pm, translation_config):
395
423
  translation_config.cleanup_temp_files()
396
424
 
397
425
 
426
+ def generate_first_page_with_watermark(
427
+ mupdf: Document,
428
+ translation_config: TranslationConfig,
429
+ doc_il: il_version_1.Document,
430
+ ) -> (io.BytesIO, io.BytesIO):
431
+ first_page_doc = Document()
432
+ first_page_doc.insert_pdf(mupdf, from_page=0, to_page=0)
433
+
434
+ il_only_first_page_doc = il_version_1.Document()
435
+ il_only_first_page_doc.total_pages = 1
436
+ il_only_first_page_doc.page = [copy.deepcopy(doc_il.page[0])]
437
+
438
+ watermarked_config = copy.copy(translation_config)
439
+ watermarked_config.watermark_output_mode = WatermarkOutputMode.Watermarked
440
+ watermarked_config.progress_monitor.disable = True
441
+ watermarked_temp_pdf_path = watermarked_config.get_working_file_path(
442
+ "watermarked_temp_input.pdf"
443
+ )
444
+ first_page_doc.save(watermarked_temp_pdf_path)
445
+
446
+ Typesetting(watermarked_config).typsetting_document(il_only_first_page_doc)
447
+ pdf_creater = PDFCreater(
448
+ watermarked_temp_pdf_path.as_posix(), il_only_first_page_doc, watermarked_config
449
+ )
450
+ result = pdf_creater.write(watermarked_config)
451
+ watermarked_config.progress_monitor.disable = False
452
+ mono_pdf_bytes = None
453
+ dual_pdf_bytes = None
454
+ if result.mono_pdf_path:
455
+ mono_pdf_bytes = io.BytesIO()
456
+ with Path(result.mono_pdf_path).open("rb") as f:
457
+ mono_pdf_bytes.write(f.read())
458
+ result.mono_pdf_path.unlink()
459
+ mono_pdf_bytes.seek(0)
460
+
461
+ if result.dual_pdf_path:
462
+ dual_pdf_bytes = io.BytesIO()
463
+ with Path(result.dual_pdf_path).open("rb") as f:
464
+ dual_pdf_bytes.write(f.read())
465
+ result.dual_pdf_path.unlink()
466
+ dual_pdf_bytes.seek(0)
467
+
468
+ return mono_pdf_bytes, dual_pdf_bytes
469
+
470
+
471
+ def merge_watermark_doc(
472
+ no_watermark_pdf_path: pathlib.PosixPath,
473
+ watermark_first_page_pdf_bytes: io.BytesIO,
474
+ translation_config: TranslationConfig,
475
+ ) -> pathlib.PosixPath:
476
+ if not no_watermark_pdf_path.exists():
477
+ raise FileNotFoundError(
478
+ f"no_watermark_pdf_path not found: {no_watermark_pdf_path}"
479
+ )
480
+ if not watermark_first_page_pdf_bytes:
481
+ raise FileNotFoundError(
482
+ f"watermark_first_page_pdf_bytes not found: {watermark_first_page_pdf_bytes}"
483
+ )
484
+
485
+ no_watermark_pdf = Document(no_watermark_pdf_path.as_posix())
486
+ no_watermark_pdf.delete_page(0)
487
+
488
+ watermark_first_page_pdf = Document("pdf", watermark_first_page_pdf_bytes)
489
+ no_watermark_pdf.insert_pdf(
490
+ watermark_first_page_pdf, from_page=0, to_page=0, start_at=0
491
+ )
492
+
493
+ new_save_path = no_watermark_pdf_path.with_name(
494
+ no_watermark_pdf_path.name.replace(".no_watermark", "")
495
+ )
496
+
497
+ PDFCreater.save_pdf_with_timeout(
498
+ no_watermark_pdf,
499
+ new_save_path.as_posix(),
500
+ translation_config=translation_config,
501
+ )
502
+ return new_save_path
503
+
504
+
398
505
  def download_font_assets():
399
506
  warmup()
400
507
 
@@ -21,9 +21,10 @@ from babeldoc.document_il.translator.translator import set_translate_rate_limite
21
21
  from babeldoc.docvision.doclayout import DocLayoutModel
22
22
  from babeldoc.docvision.rpc_doclayout import RpcDocLayoutModel
23
23
  from babeldoc.translation_config import TranslationConfig
24
+ from babeldoc.translation_config import WatermarkOutputMode
24
25
 
25
26
  logger = logging.getLogger(__name__)
26
- __version__ = "0.1.24"
27
+ __version__ = "0.1.26"
27
28
 
28
29
 
29
30
  def create_parser():
@@ -169,6 +170,18 @@ def create_parser():
169
170
  action="store_true",
170
171
  help="Use alternating pages mode for dual PDF. When enabled, original and translated pages are arranged in alternate order.",
171
172
  )
173
+ translation_group.add_argument(
174
+ "--watermark-output-mode",
175
+ type=str,
176
+ choices=["watermarked", "no_watermark", "both"],
177
+ default="watermarked",
178
+ help="Control watermark output mode: 'watermarked' (default) adds watermark to translated PDF, 'no_watermark' doesn't add watermark, 'both' outputs both versions.",
179
+ )
180
+ translation_group.add_argument(
181
+ "--no-watermark",
182
+ action="store_true",
183
+ help="[DEPRECATED] Use --watermark-output-mode=no_watermark instead. Do not add watermark to the translated PDF.",
184
+ )
172
185
  translation_group.add_argument(
173
186
  "--report-interval",
174
187
  type=float,
@@ -336,6 +349,11 @@ async def main():
336
349
  use_alternating_pages_dual=args.use_alternating_pages_dual,
337
350
  report_interval=args.report_interval,
338
351
  min_text_length=args.min_text_length,
352
+ watermark_output_mode=(
353
+ WatermarkOutputMode.NoWatermark
354
+ if args.no_watermark
355
+ else getattr(WatermarkOutputMode, args.watermark_output_mode.title())
356
+ ),
339
357
  )
340
358
 
341
359
  # Create progress handler
@@ -349,11 +367,7 @@ async def main():
349
367
  logger.debug(event)
350
368
  if event["type"] == "finish":
351
369
  result = event["translate_result"]
352
- logger.info("Translation Result:")
353
- logger.info(f" Original PDF: {result.original_pdf_path}")
354
- logger.info(f" Time Cost: {result.total_seconds:.2f}s")
355
- logger.info(f" Mono PDF: {result.mono_pdf_path or 'None'}")
356
- logger.info(f" Dual PDF: {result.dual_pdf_path or 'None'}")
370
+ logger.info(str(result))
357
371
  break
358
372
 
359
373
 
@@ -35,6 +35,7 @@ class ProgressMonitor:
35
35
  self.finish_event = finish_event
36
36
  self.cancel_event = cancel_event
37
37
  self.loop = loop
38
+ self.disable = False
38
39
  if finish_event and not loop:
39
40
  raise ValueError("finish_event requires a loop")
40
41
  if self.progress_change_callback:
@@ -51,6 +52,8 @@ class ProgressMonitor:
51
52
  self.lock = threading.Lock()
52
53
 
53
54
  def stage_start(self, stage_name: str, total: int):
55
+ if self.disable:
56
+ return DummyTranslationStage(stage_name, total, self, 0)
54
57
  stage = self.stage[stage_name]
55
58
  stage.run_time += 1
56
59
  stage.name = stage_name
@@ -78,6 +81,8 @@ class ProgressMonitor:
78
81
  logger.debug("ProgressMonitor __exit__")
79
82
 
80
83
  def on_finish(self):
84
+ if self.disable:
85
+ return
81
86
  if self.cancel_event:
82
87
  self.cancel_event.set()
83
88
  if self.finish_event and self.loop:
@@ -86,6 +91,8 @@ class ProgressMonitor:
86
91
  self.finish_callback(type="error", error=CancelledError)
87
92
 
88
93
  def stage_done(self, stage):
94
+ if self.disable:
95
+ return
89
96
  self.last_report_time = 0.0
90
97
  self.finish_stage_count += 1
91
98
  if (
@@ -128,6 +135,8 @@ class ProgressMonitor:
128
135
  return progress
129
136
 
130
137
  def stage_update(self, stage, n: int):
138
+ if self.disable:
139
+ return
131
140
  with self.lock:
132
141
  report_time_delta = time.time() - self.last_report_time
133
142
  if report_time_delta < self.report_interval and stage.total > 3:
@@ -144,10 +153,14 @@ class ProgressMonitor:
144
153
  self.last_report_time = time.time()
145
154
 
146
155
  def translate_done(self, translate_result):
156
+ if self.disable:
157
+ return
147
158
  if self.finish_callback:
148
159
  self.finish_callback(type="finish", translate_result=translate_result)
149
160
 
150
161
  def translate_error(self, error):
162
+ if self.disable:
163
+ return
151
164
  if self.finish_callback:
152
165
  self.finish_callback(type="error", error=error)
153
166
 
@@ -156,6 +169,8 @@ class ProgressMonitor:
156
169
  raise asyncio.CancelledError
157
170
 
158
171
  def cancel(self):
172
+ if self.disable:
173
+ return
159
174
  if self.cancel_event:
160
175
  logger.info("Translation canceled")
161
176
  self.cancel_event.set()
@@ -180,3 +195,21 @@ class TranslationStage:
180
195
  def advance(self, n: int = 1):
181
196
  self.current += n
182
197
  self.pm.stage_update(self, n)
198
+
199
+
200
+ class DummyTranslationStage:
201
+ def __init__(self, name: str, total: int, pm: ProgressMonitor, weight: float):
202
+ self.name = name
203
+ self.display_name = name
204
+ self.current = 0
205
+ self.total = total
206
+ self.pm = pm
207
+
208
+ def __enter__(self):
209
+ return self
210
+
211
+ def __exit__(self, exc_type, exc_val, exc_tb):
212
+ pass
213
+
214
+ def advance(self, n: int = 1):
215
+ pass
@@ -1,3 +1,4 @@
1
+ import enum
1
2
  import logging
2
3
  import shutil
3
4
  import tempfile
@@ -12,6 +13,12 @@ from babeldoc.progress_monitor import ProgressMonitor
12
13
  logger = logging.getLogger(__name__)
13
14
 
14
15
 
16
+ class WatermarkOutputMode(enum.Enum):
17
+ Watermarked = "watermarked"
18
+ NoWatermark = "no_watermark"
19
+ Both = "both"
20
+
21
+
15
22
  class TranslationConfig:
16
23
  def __init__(
17
24
  self,
@@ -43,6 +50,7 @@ class TranslationConfig:
43
50
  min_text_length: int = 5,
44
51
  use_side_by_side_dual: bool = True, # Deprecated: 是否使用拼版式双语 PDF(并排显示原文和译文) 向下兼容选项,已停用。
45
52
  use_alternating_pages_dual: bool = False,
53
+ watermark_output_mode: WatermarkOutputMode = WatermarkOutputMode.Watermarked,
46
54
  ):
47
55
  self.translator = translator
48
56
 
@@ -55,6 +63,7 @@ class TranslationConfig:
55
63
  self.pages = pages
56
64
  self.page_ranges = self._parse_pages(pages) if pages else None
57
65
  self.debug = debug
66
+ self.watermark_output_mode = watermark_output_mode
58
67
 
59
68
  self.output_dir = output_dir
60
69
  self.working_dir = working_dir
@@ -175,7 +184,52 @@ class TranslateResult:
175
184
  total_seconds: float
176
185
  mono_pdf_path: str | None
177
186
  dual_pdf_path: str | None
187
+ no_watermark_mono_pdf_path: str | None
188
+ no_watermark_dual_pdf_path: str | None
178
189
 
179
190
  def __init__(self, mono_pdf_path: str | None, dual_pdf_path: str | None):
180
191
  self.mono_pdf_path = mono_pdf_path
181
192
  self.dual_pdf_path = dual_pdf_path
193
+
194
+ # For compatibility considerations, if only a non-watermarked PDF is generated,
195
+ # the values of mono_pdf_path and no_watermark_mono_pdf_path are the same.
196
+ self.no_watermark_mono_pdf_path = mono_pdf_path
197
+ self.no_watermark_dual_pdf_path = dual_pdf_path
198
+
199
+ def __str__(self):
200
+ """Return a human-readable string representation of the translation result."""
201
+ result = []
202
+ if hasattr(self, "original_pdf_path") and self.original_pdf_path:
203
+ result.append(f"\tOriginal PDF: {self.original_pdf_path}")
204
+
205
+ if hasattr(self, "total_seconds") and self.total_seconds:
206
+ result.append(f"\tTotal time: {self.total_seconds:.2f} seconds")
207
+
208
+ if self.mono_pdf_path:
209
+ result.append(f"\tMonolingual PDF: {self.mono_pdf_path}")
210
+
211
+ if self.dual_pdf_path:
212
+ result.append(f"\tDual-language PDF: {self.dual_pdf_path}")
213
+
214
+ if (
215
+ hasattr(self, "no_watermark_mono_pdf_path")
216
+ and self.no_watermark_mono_pdf_path
217
+ and self.no_watermark_mono_pdf_path != self.mono_pdf_path
218
+ ):
219
+ result.append(
220
+ f"\tNo-watermark Monolingual PDF: {self.no_watermark_mono_pdf_path}"
221
+ )
222
+
223
+ if (
224
+ hasattr(self, "no_watermark_dual_pdf_path")
225
+ and self.no_watermark_dual_pdf_path
226
+ and self.no_watermark_dual_pdf_path != self.dual_pdf_path
227
+ ):
228
+ result.append(
229
+ f"\tNo-watermark Dual-language PDF: {self.no_watermark_dual_pdf_path}"
230
+ )
231
+
232
+ if result:
233
+ result.insert(0, "Translation results:")
234
+
235
+ return "\n".join(result) if result else "No translation results available"
@@ -0,0 +1,16 @@
1
+ <svg width="3033" height="1024" viewBox="0 0 3033 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M545.97 191.828L7.28418 333.753L176.393 975.617L715.079 833.692L545.97 191.828Z" fill="#D7DAE6"/>
3
+ <path d="M1023.27 162.578L572.766 44.2217L416.264 639.924L866.77 758.28L1023.27 162.578Z" fill="#D7DAE6"/>
4
+ <path d="M777.884 119.796H220.815V904.673H777.884V119.796Z" fill="#024AFF"/>
5
+ <path d="M571.439 253.802H99.1982V483.38H571.439V253.802Z" fill="white"/>
6
+ <path d="M279.087 328.642H152.667V353.926H279.087V328.642Z" fill="#024AFF"/>
7
+ <path d="M234.84 379.209H152.667V404.493H234.84V379.209Z" fill="#024AFF"/>
8
+ <path d="M902.217 541.153H429.976V770.732H902.217V541.153Z" fill="#FFBE19"/>
9
+ <path d="M669.862 512.262C669.862 513.463 669.799 514.664 669.799 515.865H695.083C695.083 514.664 695.146 513.463 695.146 512.262C695.146 439.697 655.45 376.298 596.729 342.48V372.379C640.912 403.225 669.862 454.425 669.862 512.262Z" fill="white"/>
10
+ <path d="M404.693 654.049C358.929 623.455 328.778 571.307 328.778 512.269C328.778 511.068 328.841 509.867 328.841 508.666H303.557C303.557 509.867 303.494 511.068 303.494 512.269C303.494 585.972 344.391 650.256 404.693 683.631V654.049Z" fill="#FFBD14"/>
11
+ <path d="M866.938 619.407H740.519V644.691H866.938V619.407Z" fill="#024AFF"/>
12
+ <path d="M866.938 669.975H784.766V695.259H866.938V669.975Z" fill="#024AFF"/>
13
+ <path d="M454.76 304.9H523.33V408.135H454.76V465.023H424.419V408.135H354.938V304.9H424.419V271.753L454.76 272.815V304.9ZM385.052 334.862V378.628H424.343V334.862H385.052ZM454.76 378.552H493.216V334.786H454.76V378.552Z" fill="#024AFF"/>
14
+ <path d="M550.839 695.334L539.385 728.861H500.321L554.935 581.48H605.452L659.61 728.861H619.712L608.486 695.334H550.914H550.839ZM598.17 664.69L581.179 613.945H578.6L561.154 664.69H598.094H598.17Z" fill="#024AFF"/>
15
+ <path d="M1189.6 740.358V305.79H1307.38C1338.99 305.79 1361.95 313.527 1376.27 329C1390.76 344.309 1398 369.659 1398 405.05V424.062C1398 444.474 1394.3 461.017 1386.89 473.692C1379.65 486.367 1368.54 494.679 1353.56 498.63C1373.14 503.568 1386.23 515.173 1392.81 533.445C1399.56 551.552 1402.94 573.692 1402.94 599.865C1402.94 628.013 1400.3 652.622 1395.04 673.692C1389.77 694.762 1380.22 711.14 1366.4 722.828C1352.57 734.515 1332.9 740.358 1307.38 740.358H1189.6ZM1274.54 469.494H1292.32C1300.39 469.494 1305.57 466.367 1307.88 460.111C1310.18 453.856 1311.33 446.367 1311.33 437.642V393.939C1311.33 379.947 1305.16 372.951 1292.81 372.951H1274.54V469.494ZM1283.19 663.815C1305.74 663.815 1317.01 653.116 1317.01 631.716V577.395C1317.01 565.05 1315.12 555.338 1311.33 548.26C1307.71 541.017 1300.8 537.395 1290.59 537.395H1274.54V663.321C1278.16 663.651 1281.05 663.815 1283.19 663.815ZM1497.51 744.309C1476.93 744.309 1461.21 739.535 1450.35 729.988C1439.65 720.441 1432.32 707.354 1428.37 690.729C1424.42 674.103 1422.44 655.256 1422.44 634.186C1422.44 611.634 1424.67 593.198 1429.11 578.877C1433.56 564.391 1441.13 552.539 1451.83 543.321C1462.69 534.103 1477.59 526.284 1496.52 519.865L1551.33 501.099V463.074C1551.33 443.157 1544.83 433.198 1531.83 433.198C1519.98 433.198 1514.05 441.264 1514.05 457.395V479.618H1428.12C1427.96 478.301 1427.88 476.655 1427.88 474.679C1427.88 472.539 1427.88 470.153 1427.88 467.519C1427.88 430.646 1436.52 404.556 1453.8 389.247C1471.25 373.774 1498.82 366.037 1536.52 366.037C1556.27 366.037 1573.97 369.577 1589.6 376.655C1605.24 383.568 1617.59 393.856 1626.64 407.519C1635.86 421.181 1640.47 438.054 1640.47 458.136V740.358H1552.57V696.408C1548.29 711.881 1541.21 723.733 1531.33 731.963C1521.46 740.194 1510.18 744.309 1497.51 744.309ZM1532.32 675.667C1539.56 675.667 1544.5 672.622 1547.14 666.531C1549.77 660.441 1551.09 653.856 1551.09 646.778V543.568C1538.91 548.507 1529.44 554.762 1522.69 562.334C1515.94 569.741 1512.57 580.688 1512.57 595.173V642.828C1512.57 664.721 1519.15 675.667 1532.32 675.667ZM1822.44 744.309C1807.96 744.309 1796.19 740.77 1787.14 733.692C1778.08 726.449 1770.84 715.502 1765.41 700.852V740.358H1675.53V305.79H1765.41V409.494C1770.84 395.832 1778.33 385.214 1787.88 377.642C1797.59 369.906 1811.42 366.037 1829.36 366.037C1853.56 366.037 1870.59 374.844 1880.47 392.457C1890.51 410.07 1895.53 433.116 1895.53 461.593V643.815C1895.53 662.745 1892.9 679.865 1887.63 695.173C1882.53 710.317 1874.54 722.334 1863.68 731.223C1852.98 739.947 1839.23 744.309 1822.44 744.309ZM1785.9 675.42C1795.28 675.42 1800.96 670.811 1802.94 661.593C1804.91 652.375 1805.9 641.017 1805.9 627.519V482.828C1805.9 469.165 1804.91 457.807 1802.94 448.753C1800.96 439.535 1795.37 434.926 1786.15 434.926C1776.6 434.926 1770.76 439.618 1768.62 449C1766.48 458.218 1765.41 469.494 1765.41 482.828V627.519C1765.41 640.852 1766.48 652.21 1768.62 661.593C1770.76 670.811 1776.52 675.42 1785.9 675.42ZM2032.07 744.309C2005.74 744.309 1984.75 739.371 1969.11 729.494C1953.47 719.618 1942.28 705.379 1935.53 686.778C1928.78 668.177 1925.41 645.79 1925.41 619.618V470.729C1925.41 436.325 1935.28 410.317 1955.04 392.704C1974.79 374.926 2001.95 366.037 2036.52 366.037C2107.63 366.037 2143.19 400.935 2143.19 470.729V497.642C2143.19 530.235 2142.86 552.128 2142.2 563.321H2013.8V634.926C2013.8 641.511 2014.21 648.013 2015.04 654.432C2015.86 660.688 2017.67 665.873 2020.47 669.988C2023.43 674.103 2028.12 676.161 2034.54 676.161C2043.76 676.161 2049.52 672.21 2051.83 664.309C2054.13 656.243 2055.28 645.79 2055.28 632.951V597.395H2143.19V618.383C2143.19 646.037 2139.73 669.247 2132.81 688.013C2126.07 706.614 2114.54 720.688 2098.25 730.235C2082.12 739.618 2060.06 744.309 2032.07 744.309ZM2013.31 519.371H2055.28V469.494C2055.28 456.161 2053.64 446.614 2050.35 440.852C2047.05 434.926 2042.12 431.963 2035.53 431.963C2028.45 431.963 2022.94 434.762 2018.99 440.358C2015.2 445.955 2013.31 455.667 2013.31 469.494V519.371ZM2175.28 740.358V305.79H2265.16V740.358H2175.28ZM2302.2 740.358V305.79H2421.7C2452.98 305.79 2476.52 314.515 2492.32 331.963C2508.12 349.247 2516.02 374.597 2516.02 408.013V611.47C2516.02 652.622 2508.78 684.391 2494.3 706.778C2479.98 729.165 2454.79 740.358 2418.74 740.358H2302.2ZM2389.61 663.568H2404.67C2420.63 663.568 2428.62 655.832 2428.62 640.358V416.161C2428.62 401.675 2426.64 392.375 2422.69 388.26C2418.91 383.98 2411.09 381.84 2399.23 381.84H2389.61V663.568ZM2657.75 744.309C2584.01 744.309 2547.14 706.037 2547.14 629.494V480.852C2547.14 445.955 2556.93 418.136 2576.52 397.395C2596.11 376.49 2623.19 366.037 2657.75 366.037C2692.49 366.037 2719.65 376.49 2739.23 397.395C2758.82 418.136 2768.62 445.955 2768.62 480.852V629.494C2768.62 706.037 2731.66 744.309 2657.75 744.309ZM2657.75 676.161C2665.16 676.161 2670.43 673.527 2673.56 668.26C2676.85 662.828 2678.49 655.996 2678.49 647.766V466.778C2678.49 445.214 2671.58 434.432 2657.75 434.432C2643.93 434.432 2637.01 445.214 2637.01 466.778V647.766C2637.01 655.996 2638.58 662.828 2641.7 668.26C2645 673.527 2650.35 676.161 2657.75 676.161ZM2912.81 744.309C2871.33 744.309 2841.87 733.692 2824.42 712.457C2807.14 691.223 2798.49 660.029 2798.49 618.877V504.803C2798.49 473.856 2801.79 448.095 2808.37 427.519C2814.95 406.943 2826.48 391.552 2842.94 381.346C2859.4 371.14 2882.28 366.037 2911.58 366.037C2931.99 366.037 2950.26 369.659 2966.4 376.902C2982.69 384.144 2995.53 394.762 3004.91 408.753C3014.3 422.745 3018.99 439.865 3018.99 460.111V516.655H2928.86V464.803C2928.86 456.243 2927.63 449.083 2925.16 443.321C2922.69 437.395 2917.34 434.432 2909.11 434.432C2894.63 434.432 2887.38 444.721 2887.38 465.297V644.803C2887.38 652.375 2889.03 659.371 2892.32 665.79C2895.61 672.046 2901.05 675.173 2908.62 675.173C2916.35 675.173 2921.7 672.128 2924.67 666.037C2927.79 659.782 2929.36 652.539 2929.36 644.309V582.087H3018.99V646.778C3018.99 667.19 3014.38 684.721 3005.16 699.371C2996.11 713.856 2983.6 724.967 2967.63 732.704C2951.66 740.441 2933.39 744.309 2912.81 744.309Z" fill="white"/>
16
+ </svg>
@@ -0,0 +1,16 @@
1
+ <svg width="3033" height="1024" viewBox="0 0 3033 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M545.97 191.828L7.28418 333.753L176.393 975.617L715.079 833.692L545.97 191.828Z" fill="#D7DAE6"/>
3
+ <path d="M1023.27 162.578L572.766 44.2217L416.264 639.924L866.77 758.28L1023.27 162.578Z" fill="#D7DAE6"/>
4
+ <path d="M777.884 119.796H220.815V904.673H777.884V119.796Z" fill="#024AFF"/>
5
+ <path d="M571.439 253.802H99.1982V483.38H571.439V253.802Z" fill="white"/>
6
+ <path d="M279.087 328.642H152.667V353.926H279.087V328.642Z" fill="#024AFF"/>
7
+ <path d="M234.84 379.209H152.667V404.493H234.84V379.209Z" fill="#024AFF"/>
8
+ <path d="M902.217 541.153H429.976V770.732H902.217V541.153Z" fill="#FFBE19"/>
9
+ <path d="M669.862 512.262C669.862 513.463 669.799 514.664 669.799 515.865H695.083C695.083 514.664 695.146 513.463 695.146 512.262C695.146 439.697 655.45 376.298 596.729 342.48V372.379C640.912 403.225 669.862 454.425 669.862 512.262Z" fill="white"/>
10
+ <path d="M404.693 654.049C358.929 623.455 328.778 571.307 328.778 512.269C328.778 511.068 328.841 509.867 328.841 508.666H303.557C303.557 509.867 303.494 511.068 303.494 512.269C303.494 585.972 344.391 650.256 404.693 683.631V654.049Z" fill="#FFBD14"/>
11
+ <path d="M866.938 619.407H740.519V644.691H866.938V619.407Z" fill="#024AFF"/>
12
+ <path d="M866.938 669.975H784.766V695.259H866.938V669.975Z" fill="#024AFF"/>
13
+ <path d="M454.76 304.9H523.33V408.135H454.76V465.023H424.419V408.135H354.938V304.9H424.419V271.753L454.76 272.815V304.9ZM385.052 334.862V378.628H424.343V334.862H385.052ZM454.76 378.552H493.216V334.786H454.76V378.552Z" fill="#024AFF"/>
14
+ <path d="M550.839 695.334L539.385 728.861H500.321L554.935 581.48H605.452L659.61 728.861H619.712L608.486 695.334H550.914H550.839ZM598.17 664.69L581.179 613.945H578.6L561.154 664.69H598.094H598.17Z" fill="#024AFF"/>
15
+ <path d="M1189.6 740.358V305.79H1307.38C1338.99 305.79 1361.95 313.527 1376.27 329C1390.76 344.309 1398 369.659 1398 405.05V424.062C1398 444.474 1394.3 461.017 1386.89 473.692C1379.65 486.367 1368.54 494.679 1353.56 498.63C1373.14 503.568 1386.23 515.173 1392.81 533.445C1399.56 551.552 1402.94 573.692 1402.94 599.865C1402.94 628.013 1400.3 652.622 1395.04 673.692C1389.77 694.762 1380.22 711.14 1366.4 722.828C1352.57 734.515 1332.9 740.358 1307.38 740.358H1189.6ZM1274.54 469.494H1292.32C1300.39 469.494 1305.57 466.367 1307.88 460.111C1310.18 453.856 1311.33 446.367 1311.33 437.642V393.939C1311.33 379.947 1305.16 372.951 1292.81 372.951H1274.54V469.494ZM1283.19 663.815C1305.74 663.815 1317.01 653.116 1317.01 631.716V577.395C1317.01 565.05 1315.12 555.338 1311.33 548.26C1307.71 541.017 1300.8 537.395 1290.59 537.395H1274.54V663.321C1278.16 663.651 1281.05 663.815 1283.19 663.815ZM1497.51 744.309C1476.93 744.309 1461.21 739.535 1450.35 729.988C1439.65 720.441 1432.32 707.354 1428.37 690.729C1424.42 674.103 1422.44 655.256 1422.44 634.186C1422.44 611.634 1424.67 593.198 1429.11 578.877C1433.56 564.391 1441.13 552.539 1451.83 543.321C1462.69 534.103 1477.59 526.284 1496.52 519.865L1551.33 501.099V463.074C1551.33 443.157 1544.83 433.198 1531.83 433.198C1519.98 433.198 1514.05 441.264 1514.05 457.395V479.618H1428.12C1427.96 478.301 1427.88 476.655 1427.88 474.679C1427.88 472.539 1427.88 470.153 1427.88 467.519C1427.88 430.646 1436.52 404.556 1453.8 389.247C1471.25 373.774 1498.82 366.037 1536.52 366.037C1556.27 366.037 1573.97 369.577 1589.6 376.655C1605.24 383.568 1617.59 393.856 1626.64 407.519C1635.86 421.181 1640.47 438.054 1640.47 458.136V740.358H1552.57V696.408C1548.29 711.881 1541.21 723.733 1531.33 731.963C1521.46 740.194 1510.18 744.309 1497.51 744.309ZM1532.32 675.667C1539.56 675.667 1544.5 672.622 1547.14 666.531C1549.77 660.441 1551.09 653.856 1551.09 646.778V543.568C1538.91 548.507 1529.44 554.762 1522.69 562.334C1515.94 569.741 1512.57 580.688 1512.57 595.173V642.828C1512.57 664.721 1519.15 675.667 1532.32 675.667ZM1822.44 744.309C1807.96 744.309 1796.19 740.77 1787.14 733.692C1778.08 726.449 1770.84 715.502 1765.41 700.852V740.358H1675.53V305.79H1765.41V409.494C1770.84 395.832 1778.33 385.214 1787.88 377.642C1797.59 369.906 1811.42 366.037 1829.36 366.037C1853.56 366.037 1870.59 374.844 1880.47 392.457C1890.51 410.07 1895.53 433.116 1895.53 461.593V643.815C1895.53 662.745 1892.9 679.865 1887.63 695.173C1882.53 710.317 1874.54 722.334 1863.68 731.223C1852.98 739.947 1839.23 744.309 1822.44 744.309ZM1785.9 675.42C1795.28 675.42 1800.96 670.811 1802.94 661.593C1804.91 652.375 1805.9 641.017 1805.9 627.519V482.828C1805.9 469.165 1804.91 457.807 1802.94 448.753C1800.96 439.535 1795.37 434.926 1786.15 434.926C1776.6 434.926 1770.76 439.618 1768.62 449C1766.48 458.218 1765.41 469.494 1765.41 482.828V627.519C1765.41 640.852 1766.48 652.21 1768.62 661.593C1770.76 670.811 1776.52 675.42 1785.9 675.42ZM2032.07 744.309C2005.74 744.309 1984.75 739.371 1969.11 729.494C1953.47 719.618 1942.28 705.379 1935.53 686.778C1928.78 668.177 1925.41 645.79 1925.41 619.618V470.729C1925.41 436.325 1935.28 410.317 1955.04 392.704C1974.79 374.926 2001.95 366.037 2036.52 366.037C2107.63 366.037 2143.19 400.935 2143.19 470.729V497.642C2143.19 530.235 2142.86 552.128 2142.2 563.321H2013.8V634.926C2013.8 641.511 2014.21 648.013 2015.04 654.432C2015.86 660.688 2017.67 665.873 2020.47 669.988C2023.43 674.103 2028.12 676.161 2034.54 676.161C2043.76 676.161 2049.52 672.21 2051.83 664.309C2054.13 656.243 2055.28 645.79 2055.28 632.951V597.395H2143.19V618.383C2143.19 646.037 2139.73 669.247 2132.81 688.013C2126.07 706.614 2114.54 720.688 2098.25 730.235C2082.12 739.618 2060.06 744.309 2032.07 744.309ZM2013.31 519.371H2055.28V469.494C2055.28 456.161 2053.64 446.614 2050.35 440.852C2047.05 434.926 2042.12 431.963 2035.53 431.963C2028.45 431.963 2022.94 434.762 2018.99 440.358C2015.2 445.955 2013.31 455.667 2013.31 469.494V519.371ZM2175.28 740.358V305.79H2265.16V740.358H2175.28ZM2302.2 740.358V305.79H2421.7C2452.98 305.79 2476.52 314.515 2492.32 331.963C2508.12 349.247 2516.02 374.597 2516.02 408.013V611.47C2516.02 652.622 2508.78 684.391 2494.3 706.778C2479.98 729.165 2454.79 740.358 2418.74 740.358H2302.2ZM2389.61 663.568H2404.67C2420.63 663.568 2428.62 655.832 2428.62 640.358V416.161C2428.62 401.675 2426.64 392.375 2422.69 388.26C2418.91 383.98 2411.09 381.84 2399.23 381.84H2389.61V663.568ZM2657.75 744.309C2584.01 744.309 2547.14 706.037 2547.14 629.494V480.852C2547.14 445.955 2556.93 418.136 2576.52 397.395C2596.11 376.49 2623.19 366.037 2657.75 366.037C2692.49 366.037 2719.65 376.49 2739.23 397.395C2758.82 418.136 2768.62 445.955 2768.62 480.852V629.494C2768.62 706.037 2731.66 744.309 2657.75 744.309ZM2657.75 676.161C2665.16 676.161 2670.43 673.527 2673.56 668.26C2676.85 662.828 2678.49 655.996 2678.49 647.766V466.778C2678.49 445.214 2671.58 434.432 2657.75 434.432C2643.93 434.432 2637.01 445.214 2637.01 466.778V647.766C2637.01 655.996 2638.58 662.828 2641.7 668.26C2645 673.527 2650.35 676.161 2657.75 676.161ZM2912.81 744.309C2871.33 744.309 2841.87 733.692 2824.42 712.457C2807.14 691.223 2798.49 660.029 2798.49 618.877V504.803C2798.49 473.856 2801.79 448.095 2808.37 427.519C2814.95 406.943 2826.48 391.552 2842.94 381.346C2859.4 371.14 2882.28 366.037 2911.58 366.037C2931.99 366.037 2950.26 369.659 2966.4 376.902C2982.69 384.144 2995.53 394.762 3004.91 408.753C3014.3 422.745 3018.99 439.865 3018.99 460.111V516.655H2928.86V464.803C2928.86 456.243 2927.63 449.083 2925.16 443.321C2922.69 437.395 2917.34 434.432 2909.11 434.432C2894.63 434.432 2887.38 444.721 2887.38 465.297V644.803C2887.38 652.375 2889.03 659.371 2892.32 665.79C2895.61 672.046 2901.05 675.173 2908.62 675.173C2916.35 675.173 2921.7 672.128 2924.67 666.037C2927.79 659.782 2929.36 652.539 2929.36 644.309V582.087H3018.99V646.778C3018.99 667.19 3014.38 684.721 3005.16 699.371C2996.11 713.856 2983.6 724.967 2967.63 732.704C2951.66 740.441 2933.39 744.309 2912.81 744.309Z" fill="#333333"/>
16
+ </svg>
@@ -0,0 +1,15 @@
1
+ <svg width="1024" height="1024" viewBox="0 0 1024 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M545.008 191.828L6.32129 333.753L175.43 975.617L714.116 833.692L545.008 191.828Z" fill="#D7DAE6"/>
3
+ <path d="M1022.31 162.578L571.803 44.2217L415.301 639.924L865.807 758.28L1022.31 162.578Z" fill="#D7DAE6"/>
4
+ <path d="M776.921 119.796H219.853V904.673H776.921V119.796Z" fill="#024AFF"/>
5
+ <path d="M570.476 253.802H98.2354V483.38H570.476V253.802Z" fill="white"/>
6
+ <path d="M278.124 328.642H151.704V353.926H278.124V328.642Z" fill="#024AFF"/>
7
+ <path d="M233.877 379.209H151.704V404.493H233.877V379.209Z" fill="#024AFF"/>
8
+ <path d="M901.254 541.153H429.013V770.732H901.254V541.153Z" fill="#FFBE19"/>
9
+ <path d="M668.899 512.262C668.899 513.463 668.836 514.664 668.836 515.865H694.12C694.12 514.664 694.183 513.463 694.183 512.262C694.183 439.697 654.488 376.298 595.766 342.48V372.379C639.949 403.225 668.899 454.425 668.899 512.262Z" fill="white"/>
10
+ <path d="M403.73 654.049C357.966 623.455 327.815 571.307 327.815 512.269C327.815 511.068 327.878 509.867 327.878 508.666H302.594C302.594 509.867 302.531 511.068 302.531 512.269C302.531 585.972 343.428 650.256 403.73 683.631V654.049Z" fill="#FFBD14"/>
11
+ <path d="M865.976 619.407H739.557V644.691H865.976V619.407Z" fill="#024AFF"/>
12
+ <path d="M865.976 669.975H783.803V695.259H865.976V669.975Z" fill="#024AFF"/>
13
+ <path d="M453.797 304.9H522.367V408.135H453.797V465.023H423.456V408.135H353.976V304.9H423.456V271.753L453.797 272.815V304.9ZM384.089 334.862V378.628H423.38V334.862H384.089ZM453.797 378.552H492.254V334.786H453.797V378.552Z" fill="#024AFF"/>
14
+ <path d="M549.876 695.334L538.422 728.861H499.358L553.972 581.48H604.489L658.647 728.861H618.749L607.523 695.334H549.952H549.876ZM597.207 664.69L580.217 613.945H577.638L560.192 664.69H597.131H597.207Z" fill="#024AFF"/>
15
+ </svg>
@@ -88,9 +88,9 @@ theme:
88
88
  font:
89
89
  text: Roboto
90
90
  code: Roboto Mono
91
- favicon: assets/favicon.png
92
- icon:
93
- logo: logo
91
+ # favicon: assets/favicon.png
92
+ favicon: images/babeldoc-small-logo-with-transparent-background.svg
93
+ logo: images/babeldoc-small-logo-with-transparent-background.svg
94
94
 
95
95
  # Plugins
96
96
  plugins:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "BabelDOC"
3
- version = "0.1.24"
3
+ version = "0.1.26"
4
4
  description = "Yet Another Document Translator"
5
5
  license = "AGPL-3.0"
6
6
  readme = "README.md"
@@ -133,7 +133,7 @@ pythonpath = [".", "src"]
133
133
  testpaths = ["tests"]
134
134
 
135
135
  [bumpver]
136
- current_version = "0.1.24"
136
+ current_version = "0.1.26"
137
137
  version_pattern = "MAJOR.MINOR.PATCH[.PYTAGNUM]"
138
138
 
139
139
  [bumpver.file_patterns]
@@ -48,7 +48,7 @@ wheels = [
48
48
 
49
49
  [[package]]
50
50
  name = "babeldoc"
51
- version = "0.1.24"
51
+ version = "0.1.26"
52
52
  source = { editable = "." }
53
53
  dependencies = [
54
54
  { name = "bitstring" },
@@ -1014,7 +1014,7 @@ wheels = [
1014
1014
 
1015
1015
  [[package]]
1016
1016
  name = "mkdocs-material"
1017
- version = "9.6.6"
1017
+ version = "9.6.7"
1018
1018
  source = { registry = "https://pypi.org/simple" }
1019
1019
  dependencies = [
1020
1020
  { name = "babel" },
@@ -1029,9 +1029,9 @@ dependencies = [
1029
1029
  { name = "pymdown-extensions" },
1030
1030
  { name = "requests" },
1031
1031
  ]
1032
- sdist = { url = "https://files.pythonhosted.org/packages/26/b2/4244c578bf00f88181c55a76e484efb429159a1a49db60eaf6b696783760/mkdocs_material-9.6.6.tar.gz", hash = "sha256:06141bd720b0b235829bd59e8afc11d5587c35ae7fc340612d2b3f554e6a69d8", size = 3947396 }
1032
+ sdist = { url = "https://files.pythonhosted.org/packages/9b/d7/93e19c9587e5f4ed25647890555d58cf484a4d412be7037dc17b9c9179d9/mkdocs_material-9.6.7.tar.gz", hash = "sha256:3e2c1fceb9410056c2d91f334a00cdea3215c28750e00c691c1e46b2a33309b4", size = 3947458 }
1033
1033
  wheels = [
1034
- { url = "https://files.pythonhosted.org/packages/a4/2d/c71b689cbccef26806cea4f3dd98f1555cb5894e374c8c5ca6d2106d7fd4/mkdocs_material-9.6.6-py3-none-any.whl", hash = "sha256:904c422ec86086144495831cee2614bb8a0092572ef579af6392b8080309d3a3", size = 8696753 },
1034
+ { url = "https://files.pythonhosted.org/packages/aa/d3/12f22de41bdd9e576ddc459b38c651d68edfb840b32acaa1f46ae36845e3/mkdocs_material-9.6.7-py3-none-any.whl", hash = "sha256:8a159e45e80fcaadd9fbeef62cbf928569b93df954d4dc5ba76d46820caf7b47", size = 8696755 },
1035
1035
  ]
1036
1036
 
1037
1037
  [package.optional-dependencies]
@@ -1 +0,0 @@
1
- __version__ = "0.1.24"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes