BabelDOC 0.1.6rc0__tar.gz → 0.1.8__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 (73) hide show
  1. babeldoc-0.1.8/.github/ISSUE_TEMPLATE/bug_report.yaml +85 -0
  2. babeldoc-0.1.8/.github/ISSUE_TEMPLATE/feature_request.yaml +33 -0
  3. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/.github/workflows/publish-to-pypi.yml +2 -2
  4. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/PKG-INFO +26 -14
  5. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/README.md +24 -12
  6. babeldoc-0.1.8/babeldoc/__init__.py +1 -0
  7. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/backend/pdf_creater.py +10 -3
  8. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/frontend/il_creater.py +1 -1
  9. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/midend/add_debug_information.py +1 -1
  10. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/midend/il_translator.py +26 -3
  11. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/midend/layout_parser.py +1 -1
  12. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/midend/paragraph_finder.py +1 -1
  13. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/midend/remove_descent.py +1 -1
  14. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/midend/styles_and_formulas.py +1 -1
  15. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/midend/typesetting.py +2 -2
  16. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/translator/cache.py +2 -1
  17. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/utils/fontmap.py +1 -1
  18. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/docvision/rpc_doclayout.py +2 -1
  19. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/high_level.py +1 -0
  20. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/main.py +22 -1
  21. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/progress_monitor.py +30 -14
  22. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/translation_config.py +9 -2
  23. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/CONTRIBUTING.md +3 -1
  24. babeldoc-0.1.8/docs/CONTRIBUTOR_REWARD.md +81 -0
  25. babeldoc-0.1.8/docs/images/contributor_reward_example.png +0 -0
  26. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/pyproject.toml +3 -3
  27. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/uv.lock +18 -3
  28. babeldoc-0.1.6rc0/.github/ISSUE_TEMPLATE/bug_report.md +0 -34
  29. babeldoc-0.1.6rc0/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  30. babeldoc-0.1.6rc0/babeldoc/__init__.py +0 -1
  31. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/.github/dependabot.yml +0 -0
  32. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/.github/labels.yml +0 -0
  33. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/.github/release-drafter.yml +0 -0
  34. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/.github/workflows/codeql.yml +0 -0
  35. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/.github/workflows/labeler.yml +0 -0
  36. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/.github/workflows/test.yml +0 -0
  37. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/.gitignore +0 -0
  38. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/.pre-commit-config.yaml +0 -0
  39. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/LICENSE +0 -0
  40. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/asynchronize/__init__.py +0 -0
  41. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/const.py +0 -0
  42. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/converter.py +0 -0
  43. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/__init__.py +0 -0
  44. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/backend/__init__.py +0 -0
  45. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/frontend/__init__.py +0 -0
  46. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/il_version_1.py +0 -0
  47. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/il_version_1.rnc +0 -0
  48. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/il_version_1.rng +0 -0
  49. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/il_version_1.xsd +0 -0
  50. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/midend/__init__.py +0 -0
  51. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/translator/__init__.py +0 -0
  52. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/translator/translator.py +0 -0
  53. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/utils/layout_helper.py +0 -0
  54. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/utils/style_helper.py +0 -0
  55. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/document_il/xml_converter.py +0 -0
  56. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/docvision/README.md +0 -0
  57. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/docvision/__init__.py +0 -0
  58. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/docvision/doclayout.py +0 -0
  59. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/babeldoc/pdfinterp.py +0 -0
  60. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/CODE_OF_CONDUCT.md +0 -0
  61. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/ImplementationDetails/AsyncTranslate/AsyncTranslate.md +0 -0
  62. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/ImplementationDetails/ILTranslator/ILTranslator.md +0 -0
  63. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/ImplementationDetails/PDFCreation/PDFCreation.md +0 -0
  64. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/ImplementationDetails/PDFParsing/PDFParsing.md +0 -0
  65. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/ImplementationDetails/ParagraphFinding/ParagraphFinding.md +0 -0
  66. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/ImplementationDetails/README.md +0 -0
  67. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/ImplementationDetails/StylesAndFormulas/StylesAndFormulas.md +0 -0
  68. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/ImplementationDetails/Typesetting/Typesetting.md +0 -0
  69. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/README.md +0 -0
  70. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/deploy.sh +0 -0
  71. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/images/banner.png +0 -0
  72. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/images/preview.gif +0 -0
  73. {babeldoc-0.1.6rc0 → babeldoc-0.1.8}/docs/intro-to-pdf-object.md +0 -0
@@ -0,0 +1,85 @@
1
+ name: Bug Report
2
+ description: Create a report to help us improve
3
+ labels: ['bug']
4
+ body:
5
+ - type: checkboxes
6
+ id: checks
7
+ attributes:
8
+ label: Before you asking
9
+ options:
10
+ - label: I have searched the existing issues
11
+ required: true
12
+ - label: I spend at least 5 minutes for thinking and preparing
13
+ required: true
14
+ - label: I have carefully checked the issue, and it is unrelated to the network environment.
15
+ required: true
16
+ - type: markdown
17
+ attributes:
18
+ value: |
19
+ Thank you for using this project and providing feedback!
20
+ - type: textarea
21
+ id: environment
22
+ attributes:
23
+ label: Environment
24
+ description: |
25
+ examples:
26
+ - **OS**: Ubuntu 24.10
27
+ - **Python**: 3.12.0
28
+ - **BalbelDOC**: 1.9.0
29
+ value: |
30
+ - OS:
31
+ - Python:
32
+ - BalbelDOC:
33
+ render: markdown
34
+ validations:
35
+ required: false
36
+ - type: textarea
37
+ id: describe
38
+ attributes:
39
+ label: Describe the bug
40
+ description: A clear and concise description of what the bug is.
41
+ validations:
42
+ required: true
43
+ - type: textarea
44
+ id: reproduce
45
+ attributes:
46
+ label: To Reproduce
47
+ description: Steps to reproduce the behavior
48
+ value: |
49
+ 1. Go to '...'
50
+ 2. Click on '....'
51
+ 3. Scroll down to '....'
52
+ 4. See error
53
+ validations:
54
+ required: false
55
+ - type: textarea
56
+ id: expected
57
+ attributes:
58
+ label: Expected behavior
59
+ description: A clear and concise description of what you expected to happen.
60
+ validations:
61
+ required: false
62
+ - type: textarea
63
+ id: logs
64
+ attributes:
65
+ label: Relevant log output and screenshots
66
+ description: Please copy and paste any relevant log output and screenshots. This will be automatically formatted into code, so no need for backticks.
67
+ render: Text
68
+ validations:
69
+ required: false
70
+ - type: textarea
71
+ id: PDFfile
72
+ attributes:
73
+ label: Origin PDF file
74
+ description: |
75
+ if applicable, attach the input PDF file here.
76
+ validations:
77
+ required: false
78
+ - type: textarea
79
+ id: others
80
+ attributes:
81
+ label: Anything else?
82
+ description: |
83
+ Add any other context about the problem here.
84
+ validations:
85
+ required: false
@@ -0,0 +1,33 @@
1
+ name: Feature request
2
+ description: Suggest an idea for this project
3
+ labels: ['enhancement']
4
+ body:
5
+ - type: textarea
6
+ id: describe
7
+ attributes:
8
+ label: Is your feature request related to a problem?
9
+ description: A clear and concise description of what the problem is
10
+ placeholder: Ex. I'm always frustrated when ...
11
+ validations:
12
+ required: false
13
+ - type: textarea
14
+ id: solution
15
+ attributes:
16
+ label: Describe the solution you'd like
17
+ description: A clear and concise description of what you want to happen
18
+ validations:
19
+ required: false
20
+ - type: textarea
21
+ id:
22
+ attributes:
23
+ label: Describe alternatives you've considered
24
+ description: A clear and concise description of any alternative solutions or features you've considered.
25
+ validations:
26
+ required: false
27
+ - type: textarea
28
+ id: additional
29
+ attributes:
30
+ label: Additional context
31
+ description: Add any other projects about the feature request here.
32
+ validations:
33
+ required: false
@@ -82,7 +82,7 @@ jobs:
82
82
  runs-on: ubuntu-latest
83
83
  environment:
84
84
  name: pypi
85
- url: https://pypi.org/p/yadt
85
+ url: https://pypi.org/p/BabelDOC
86
86
 
87
87
  permissions:
88
88
  id-token: write
@@ -106,7 +106,7 @@ jobs:
106
106
  runs-on: ubuntu-latest
107
107
  environment:
108
108
  name: testpypi
109
- url: https://test.pypi.org/p/yadt
109
+ url: https://test.pypi.org/p/BabelDOC
110
110
 
111
111
  permissions:
112
112
  id-token: write
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: BabelDOC
3
- Version: 0.1.6rc0
3
+ Version: 0.1.8
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
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: <3.13,>=3.10
13
13
  Requires-Dist: bitstring>=4.3.0
14
14
  Requires-Dist: configargparse>=1.7
15
- Requires-Dist: httpx>=0.27.0
15
+ Requires-Dist: httpx[socks]>=0.27.0
16
16
  Requires-Dist: huggingface-hub>=0.27.0
17
17
  Requires-Dist: msgpack>=1.1.0
18
18
  Requires-Dist: numpy>=2.0.2
@@ -40,15 +40,15 @@ Description-Content-Type: text/markdown
40
40
 
41
41
  <p>
42
42
  <!-- PyPI -->
43
- <a href="https://pypi.org/project/babeldoc/">
44
- <img src="https://img.shields.io/pypi/v/babeldoc"></a>
45
- <a href="https://pepy.tech/projects/babeldoc">
46
- <img src="https://static.pepy.tech/badge/babeldoc"></a>
47
- <!-- <a href="https://github.com/funstory-ai/babeldoc/pulls">
43
+ <a href="https://pypi.org/project/BabelDOC/">
44
+ <img src="https://img.shields.io/pypi/v/BabelDOC"></a>
45
+ <a href="https://pepy.tech/projects/BabelDOC">
46
+ <img src="https://static.pepy.tech/badge/BabelDOC"></a>
47
+ <!-- <a href="https://github.com/funstory-ai/BabelDOC/pulls">
48
48
  <img src="https://img.shields.io/badge/contributions-welcome-green"></a> -->
49
49
  <!-- License -->
50
50
  <a href="./LICENSE">
51
- <img src="https://img.shields.io/github/license/funstory-ai/babeldoc"></a>
51
+ <img src="https://img.shields.io/github/license/funstory-ai/BabelDOC"></a>
52
52
  <a href="https://t.me/+Z9_SgnxmsmA5NzBl">
53
53
  <img src="https://img.shields.io/badge/Telegram-2CA5E0?style=flat-squeare&logo=telegram&logoColor=white"></a>
54
54
  </p>
@@ -77,7 +77,7 @@ We recommend using the Tool feature of [uv](https://github.com/astral-sh/uv) to
77
77
  2. Use the following command to install yadt:
78
78
 
79
79
  ```bash
80
- uv tool install --python 3.12 babeldoc
80
+ uv tool install --python 3.12 BabelDOC
81
81
 
82
82
  babeldoc --help
83
83
  ```
@@ -101,10 +101,10 @@ We still recommend using [uv](https://github.com/astral-sh/uv) to manage virtual
101
101
 
102
102
  ```bash
103
103
  # clone the project
104
- git clone https://github.com/funstory-ai/yadt
104
+ git clone https://github.com/funstory-ai/BabelDOC
105
105
 
106
106
  # enter the project directory
107
- cd babeldoc
107
+ cd BabelDOC
108
108
 
109
109
  # install dependencies and run babeldoc
110
110
  uv run babeldoc --help
@@ -140,10 +140,14 @@ uv run babeldoc --bing --files example.pdf --files example2.pdf
140
140
  - `--short-line-split-factor`: Split threshold factor (default: 0.8). The actual threshold is the median length of all lines on the current page \* this factor
141
141
  - `--skip-clean`: Skip PDF cleaning step
142
142
  - `--dual-translate-first`: Put translated pages first in dual PDF mode (default: original pages first)
143
+ - `--disable-rich-text-translate`: Disable rich text translation (may help improve compatibility with some PDFs)
144
+ - `--enhance-compatibility`: Enable all compatibility enhancement options (equivalent to --skip-clean --dual-translate-first --disable-rich-text-translate)
143
145
 
144
146
  > [!TIP]
145
147
  > - Both `--skip-clean` and `--dual-translate-first` may help improve compatibility with some PDF readers
148
+ > - `--disable-rich-text-translate` can also help with compatibility by simplifying translation input
146
149
  > - However, using `--skip-clean` will result in larger file sizes
150
+ > - If you encounter any compatibility issues, try using `--enhance-compatibility` first
147
151
 
148
152
  ### Translation Service Options
149
153
 
@@ -167,10 +171,16 @@ uv run babeldoc --bing --files example.pdf --files example2.pdf
167
171
  - `--openai-base-url`: Base URL for OpenAI API
168
172
  - `--openai-api-key`: API key for OpenAI service
169
173
 
174
+ > [!TIP]
175
+ >
176
+ > 1. This tool supports any OpenAI-compatible API endpoints. Just set the correct base URL and API key. (e.g. `https://xxx.custom.xxx/v1`)
177
+ > 2. For local models like Ollama, you can use any value as the API key (e.g. `--openai-api-key a`).
178
+
170
179
  ### Output Control
171
180
 
172
181
  - `--output`, `-o`: Output directory for translated files. If not set, use current working directory.
173
182
  - `--debug`, `-d`: Enable debug logging level and export detailed intermediate results in `~/.cache/yadt/working`.
183
+ - `--report-interval`: Progress report interval in seconds (default: 0.1).
174
184
 
175
185
  ### Configuration File
176
186
 
@@ -264,6 +274,8 @@ We encourage you to contribute to YADT! Please check out the [CONTRIBUTING](http
264
274
 
265
275
  Everyone interacting in YADT and its sub-projects' codebases, issue trackers, chat rooms, and mailing lists is expected to follow the YADT [Code of Conduct](https://github.com/funstory-ai/yadt/blob/main/docs/CODE_OF_CONDUCT.md).
266
276
 
277
+ [Immersive Translation](https://immersivetranslate.com) sponsors monthly Pro membership redemption codes for active contributors to this project, see details at: [CONTRIBUTOR_REWARD.md](https://github.com/funstory-ai/BabelDOC/blob/main/docs/CONTRIBUTOR_REWARD.md)
278
+
267
279
  ## Acknowledgements
268
280
 
269
281
  - [PDFMathTranslate](https://github.com/Byaidu/PDFMathTranslate)
@@ -276,8 +288,8 @@ Everyone interacting in YADT and its sub-projects' codebases, issue trackers, ch
276
288
 
277
289
  <a href="https://star-history.com/#funstory-ai/babeldoc&Date">
278
290
  <picture>
279
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=funstory-ai/yadt&type=Date&theme=dark" />
280
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=funstory-ai/yadt&type=Date" />
281
- <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=funstory-ai/yadt&type=Date"/>
291
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=funstory-ai/babeldoc&type=Date&theme=dark" />
292
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=funstory-ai/babeldoc&type=Date" />
293
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=funstory-ai/babeldoc&type=Date"/>
282
294
  </picture>
283
295
  </a>
@@ -8,15 +8,15 @@
8
8
 
9
9
  <p>
10
10
  <!-- PyPI -->
11
- <a href="https://pypi.org/project/babeldoc/">
12
- <img src="https://img.shields.io/pypi/v/babeldoc"></a>
13
- <a href="https://pepy.tech/projects/babeldoc">
14
- <img src="https://static.pepy.tech/badge/babeldoc"></a>
15
- <!-- <a href="https://github.com/funstory-ai/babeldoc/pulls">
11
+ <a href="https://pypi.org/project/BabelDOC/">
12
+ <img src="https://img.shields.io/pypi/v/BabelDOC"></a>
13
+ <a href="https://pepy.tech/projects/BabelDOC">
14
+ <img src="https://static.pepy.tech/badge/BabelDOC"></a>
15
+ <!-- <a href="https://github.com/funstory-ai/BabelDOC/pulls">
16
16
  <img src="https://img.shields.io/badge/contributions-welcome-green"></a> -->
17
17
  <!-- License -->
18
18
  <a href="./LICENSE">
19
- <img src="https://img.shields.io/github/license/funstory-ai/babeldoc"></a>
19
+ <img src="https://img.shields.io/github/license/funstory-ai/BabelDOC"></a>
20
20
  <a href="https://t.me/+Z9_SgnxmsmA5NzBl">
21
21
  <img src="https://img.shields.io/badge/Telegram-2CA5E0?style=flat-squeare&logo=telegram&logoColor=white"></a>
22
22
  </p>
@@ -45,7 +45,7 @@ We recommend using the Tool feature of [uv](https://github.com/astral-sh/uv) to
45
45
  2. Use the following command to install yadt:
46
46
 
47
47
  ```bash
48
- uv tool install --python 3.12 babeldoc
48
+ uv tool install --python 3.12 BabelDOC
49
49
 
50
50
  babeldoc --help
51
51
  ```
@@ -69,10 +69,10 @@ We still recommend using [uv](https://github.com/astral-sh/uv) to manage virtual
69
69
 
70
70
  ```bash
71
71
  # clone the project
72
- git clone https://github.com/funstory-ai/yadt
72
+ git clone https://github.com/funstory-ai/BabelDOC
73
73
 
74
74
  # enter the project directory
75
- cd babeldoc
75
+ cd BabelDOC
76
76
 
77
77
  # install dependencies and run babeldoc
78
78
  uv run babeldoc --help
@@ -108,10 +108,14 @@ uv run babeldoc --bing --files example.pdf --files example2.pdf
108
108
  - `--short-line-split-factor`: Split threshold factor (default: 0.8). The actual threshold is the median length of all lines on the current page \* this factor
109
109
  - `--skip-clean`: Skip PDF cleaning step
110
110
  - `--dual-translate-first`: Put translated pages first in dual PDF mode (default: original pages first)
111
+ - `--disable-rich-text-translate`: Disable rich text translation (may help improve compatibility with some PDFs)
112
+ - `--enhance-compatibility`: Enable all compatibility enhancement options (equivalent to --skip-clean --dual-translate-first --disable-rich-text-translate)
111
113
 
112
114
  > [!TIP]
113
115
  > - Both `--skip-clean` and `--dual-translate-first` may help improve compatibility with some PDF readers
116
+ > - `--disable-rich-text-translate` can also help with compatibility by simplifying translation input
114
117
  > - However, using `--skip-clean` will result in larger file sizes
118
+ > - If you encounter any compatibility issues, try using `--enhance-compatibility` first
115
119
 
116
120
  ### Translation Service Options
117
121
 
@@ -135,10 +139,16 @@ uv run babeldoc --bing --files example.pdf --files example2.pdf
135
139
  - `--openai-base-url`: Base URL for OpenAI API
136
140
  - `--openai-api-key`: API key for OpenAI service
137
141
 
142
+ > [!TIP]
143
+ >
144
+ > 1. This tool supports any OpenAI-compatible API endpoints. Just set the correct base URL and API key. (e.g. `https://xxx.custom.xxx/v1`)
145
+ > 2. For local models like Ollama, you can use any value as the API key (e.g. `--openai-api-key a`).
146
+
138
147
  ### Output Control
139
148
 
140
149
  - `--output`, `-o`: Output directory for translated files. If not set, use current working directory.
141
150
  - `--debug`, `-d`: Enable debug logging level and export detailed intermediate results in `~/.cache/yadt/working`.
151
+ - `--report-interval`: Progress report interval in seconds (default: 0.1).
142
152
 
143
153
  ### Configuration File
144
154
 
@@ -232,6 +242,8 @@ We encourage you to contribute to YADT! Please check out the [CONTRIBUTING](http
232
242
 
233
243
  Everyone interacting in YADT and its sub-projects' codebases, issue trackers, chat rooms, and mailing lists is expected to follow the YADT [Code of Conduct](https://github.com/funstory-ai/yadt/blob/main/docs/CODE_OF_CONDUCT.md).
234
244
 
245
+ [Immersive Translation](https://immersivetranslate.com) sponsors monthly Pro membership redemption codes for active contributors to this project, see details at: [CONTRIBUTOR_REWARD.md](https://github.com/funstory-ai/BabelDOC/blob/main/docs/CONTRIBUTOR_REWARD.md)
246
+
235
247
  ## Acknowledgements
236
248
 
237
249
  - [PDFMathTranslate](https://github.com/Byaidu/PDFMathTranslate)
@@ -244,8 +256,8 @@ Everyone interacting in YADT and its sub-projects' codebases, issue trackers, ch
244
256
 
245
257
  <a href="https://star-history.com/#funstory-ai/babeldoc&Date">
246
258
  <picture>
247
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=funstory-ai/yadt&type=Date&theme=dark" />
248
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=funstory-ai/yadt&type=Date" />
249
- <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=funstory-ai/yadt&type=Date"/>
259
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=funstory-ai/babeldoc&type=Date&theme=dark" />
260
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=funstory-ai/babeldoc&type=Date" />
261
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=funstory-ai/babeldoc&type=Date"/>
250
262
  </picture>
251
263
  </a>
@@ -0,0 +1 @@
1
+ __version__ = "0.1.8"
@@ -14,7 +14,7 @@ logger = logging.getLogger(__name__)
14
14
 
15
15
 
16
16
  class PDFCreater:
17
- stage_name = "创建PDF文件"
17
+ stage_name = "Create PDF file"
18
18
 
19
19
  def __init__(
20
20
  self,
@@ -176,7 +176,8 @@ class PDFCreater:
176
176
  page_op = BitStream()
177
177
  # q {ops_base}Q 1 0 0 1 {x0} {y0} cm {ops_new}
178
178
  page_op.append(b"q ")
179
- page_op.append(base_op)
179
+ if base_op is not None:
180
+ page_op.append(base_op)
180
181
  page_op.append(b" Q ")
181
182
  page_op.append(
182
183
  f"q Q 1 0 0 1 {page.cropbox.box.x} {page.cropbox.box.y} cm \n".encode(),
@@ -375,7 +376,13 @@ class PDFCreater:
375
376
  dual = pymupdf.open(self.original_pdf_path)
376
377
  if translation_config.debug:
377
378
  translation_config.raise_if_cancelled()
378
- self.write_debug_info(dual, translation_config)
379
+ try:
380
+ self.write_debug_info(dual, translation_config)
381
+ except Exception:
382
+ logger.warning(
383
+ "Failed to write debug info to dual PDF",
384
+ exc_info=True,
385
+ )
379
386
  dual.insert_file(pdf)
380
387
  page_count = pdf.page_count
381
388
  for page_id in range(page_count):
@@ -17,7 +17,7 @@ logger = logging.getLogger(__name__)
17
17
 
18
18
 
19
19
  class ILCreater:
20
- stage_name = "解析PDF并创建中间表示"
20
+ stage_name = "Parse PDF and Create Intermediate Representation"
21
21
 
22
22
  def __init__(self, translation_config: TranslationConfig):
23
23
  self.progress = None
@@ -11,7 +11,7 @@ logger = logging.getLogger(__name__)
11
11
 
12
12
 
13
13
  class AddDebugInformation:
14
- stage_name = "添加DEBUG信息"
14
+ stage_name = "Add Debug Information"
15
15
 
16
16
  def __init__(self, translation_config: TranslationConfig):
17
17
  self.translation_config = translation_config
@@ -2,6 +2,7 @@ import concurrent.futures
2
2
  import json
3
3
  import logging
4
4
  from pathlib import Path
5
+ from typing import List, Union
5
6
 
6
7
  from tqdm import tqdm
7
8
 
@@ -112,7 +113,7 @@ class ParagraphTranslateTracker:
112
113
 
113
114
 
114
115
  class ILTranslator:
115
- stage_name = "翻译段落"
116
+ stage_name = "Translate Paragraphs"
116
117
 
117
118
  def __init__(
118
119
  self,
@@ -178,7 +179,7 @@ class ILTranslator:
178
179
  def __init__(
179
180
  self,
180
181
  unicode: str,
181
- placeholders: [RichTextPlaceholder | FormulaPlaceholder],
182
+ placeholders: List[Union[RichTextPlaceholder, FormulaPlaceholder]],
182
183
  base_style: PdfStyle = None,
183
184
  ):
184
185
  self.unicode = unicode
@@ -230,6 +231,7 @@ class ILTranslator:
230
231
  self,
231
232
  paragraph: PdfParagraph,
232
233
  page_font_map: dict[str, PdfFont] = None,
234
+ disable_rich_text_translate: bool | None = None,
233
235
  ):
234
236
  if not paragraph.pdf_paragraph_composition:
235
237
  return
@@ -256,6 +258,12 @@ class ILTranslator:
256
258
  )
257
259
  return None
258
260
 
261
+ # 如果没有指定 disable_rich_text_translate,使用配置中的值
262
+ if disable_rich_text_translate is None:
263
+ disable_rich_text_translate = (
264
+ self.translation_config.disable_rich_text_translate
265
+ )
266
+
259
267
  placeholder_id = 1
260
268
  placeholders = []
261
269
  chars = []
@@ -275,6 +283,11 @@ class ILTranslator:
275
283
  elif composition.pdf_character:
276
284
  chars.append(composition.pdf_character)
277
285
  elif composition.pdf_same_style_characters:
286
+ if disable_rich_text_translate:
287
+ # 如果禁用富文本翻译,直接添加字符
288
+ chars.extend(composition.pdf_same_style_characters.pdf_character)
289
+ continue
290
+
278
291
  fonta = self.font_mapper.map(
279
292
  page_font_map[
280
293
  composition.pdf_same_style_characters.pdf_style.font_id
@@ -330,6 +343,14 @@ class ILTranslator:
330
343
  )
331
344
  return None
332
345
 
346
+ # 如果占位符数量超过50,且未禁用富文本翻译,则递归调用并禁用富文本翻译
347
+ if len(placeholders) > 50 and not disable_rich_text_translate:
348
+ logger.warning(
349
+ f"Too many placeholders ({len(placeholders)}) in paragraph[{paragraph.debug_id}], "
350
+ "disabling rich text translation for this paragraph",
351
+ )
352
+ return self.get_translate_input(paragraph, page_font_map, True)
353
+
333
354
  text = get_char_unicode_string(chars)
334
355
  return self.TranslateInput(text, placeholders, paragraph.pdf_style)
335
356
 
@@ -467,7 +488,9 @@ class ILTranslator:
467
488
  PdfSameStyleCharacters,
468
489
  ) and text.replace(" ", "") == "".join(
469
490
  x.char_unicode for x in placeholder.composition.pdf_character
470
- ).replace(" ", ""):
491
+ ).replace(
492
+ " ", ""
493
+ ):
471
494
  comp = PdfParagraphComposition(
472
495
  pdf_same_style_characters=placeholder.composition,
473
496
  )
@@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
13
13
 
14
14
 
15
15
  class LayoutParser:
16
- stage_name = "解析页面布局"
16
+ stage_name = "Parse Page Layout"
17
17
 
18
18
  def __init__(self, translation_config: TranslationConfig):
19
19
  self.translation_config = translation_config
@@ -26,7 +26,7 @@ def generate_base58_id(length: int = 5) -> str:
26
26
 
27
27
 
28
28
  class ParagraphFinder:
29
- stage_name = "解析段落"
29
+ stage_name = "Parse Paragraphs"
30
30
 
31
31
  def __init__(self, translation_config: TranslationConfig):
32
32
  self.translation_config = translation_config
@@ -9,7 +9,7 @@ logger = logging.getLogger(__name__)
9
9
 
10
10
 
11
11
  class RemoveDescent:
12
- stage_name = "移除字体下沉"
12
+ stage_name = "Remove Char Descent"
13
13
 
14
14
  def __init__(self, translation_config: TranslationConfig):
15
15
  self.translation_config = translation_config
@@ -22,7 +22,7 @@ from babeldoc.translation_config import TranslationConfig
22
22
 
23
23
 
24
24
  class StylesAndFormulas:
25
- stage_name = "解析公式与样式"
25
+ stage_name = "Parse Formulas and Styles"
26
26
 
27
27
  def __init__(self, translation_config: TranslationConfig):
28
28
  self.translation_config = translation_config
@@ -355,7 +355,7 @@ class TypesettingUnit:
355
355
 
356
356
 
357
357
  class Typesetting:
358
- stage_name = "排版"
358
+ stage_name = "Typesetting"
359
359
 
360
360
  def __init__(self, translation_config: TranslationConfig):
361
361
  self.font_mapper = FontMapper(translation_config)
@@ -397,7 +397,7 @@ class Typesetting:
397
397
  font_size=6,
398
398
  graphic_state=il_version_1.GraphicState(),
399
399
  )
400
- text = "本文档由funstory.ai的开源PDF翻译库yadt(http://yadt.io)翻译,本仓库正在积极的建设当中,欢迎star和关注。"
400
+ text = "本文档由funstory.ai的开源PDF翻译库BabelDOC(http://yadt.io)翻译,本仓库正在积极的建设当中,欢迎star和关注。"
401
401
  if self.translation_config.debug:
402
402
  text += "\n 当前为DEBUG模式,将显示更多辅助信息。请注意,部分框的位置对应原文,但在译文中可能不正确。"
403
403
  page.pdf_paragraph.append(
@@ -8,6 +8,8 @@ from peewee import Model
8
8
  from peewee import SqliteDatabase
9
9
  from peewee import TextField
10
10
 
11
+ from babeldoc.const import CACHE_FOLDER as cache_folder
12
+
11
13
  # we don't init the database here
12
14
  db = SqliteDatabase(None)
13
15
 
@@ -92,7 +94,6 @@ class TranslationCache:
92
94
 
93
95
 
94
96
  def init_db(remove_exists=False):
95
- cache_folder = Path.home() / ".cache" / "pdf2zh"
96
97
  cache_folder.mkdir(parents=True, exist_ok=True)
97
98
  # The current version does not support database migration, so add the version number to the file name.
98
99
  cache_db_path = cache_folder / "cache.v1.db"
@@ -13,7 +13,7 @@ logger = logging.getLogger(__name__)
13
13
 
14
14
 
15
15
  class FontMapper:
16
- stage_name = "添加字体"
16
+ stage_name = "Add Fonts"
17
17
 
18
18
  def __init__(self, translation_config: TranslationConfig):
19
19
  self.font_names = [
@@ -75,7 +75,8 @@ def predict_layout(
75
75
  "Content-Type": "application/msgpack",
76
76
  "Accept": "application/msgpack",
77
77
  },
78
- timeout=30,
78
+ timeout=300,
79
+ follow_redirects=True,
79
80
  )
80
81
 
81
82
  logger.debug(f"Response status: {response.status_code}")
@@ -287,6 +287,7 @@ async def async_translate(translation_config: TranslationConfig):
287
287
  finish_event=finish_event,
288
288
  cancel_event=cancel_event,
289
289
  loop=loop,
290
+ report_interval=translation_config.report_interval,
290
291
  ) as pm:
291
292
  future = loop.run_in_executor(None, do_translate, pm, translation_config)
292
293
  try:
@@ -20,7 +20,7 @@ from babeldoc.document_il.translator.translator import set_translate_rate_limite
20
20
  from babeldoc.translation_config import TranslationConfig
21
21
 
22
22
  logger = logging.getLogger(__name__)
23
- __version__ = "0.1.6.rc0"
23
+ __version__ = "0.1.8"
24
24
 
25
25
 
26
26
  def create_parser():
@@ -158,6 +158,24 @@ def create_parser():
158
158
  action="store_true",
159
159
  help="Put translated pages first in dual PDF mode",
160
160
  )
161
+ translation_params.add_argument(
162
+ "--disable-rich-text-translate",
163
+ default=False,
164
+ action="store_true",
165
+ help="Disable rich text translation (may help improve compatibility with some PDFs)",
166
+ )
167
+ translation_params.add_argument(
168
+ "--enhance-compatibility",
169
+ default=False,
170
+ action="store_true",
171
+ help="Enable all compatibility enhancement options (equivalent to --skip-clean --dual-translate-first --disable-rich-text-translate)",
172
+ )
173
+ translation_params.add_argument(
174
+ "--report-interval",
175
+ type=float,
176
+ default=0.1,
177
+ help="Progress report interval in seconds (default: 0.1)",
178
+ )
161
179
  service_params = translation_params.add_mutually_exclusive_group()
162
180
  service_params.add_argument(
163
181
  "--openai",
@@ -400,6 +418,9 @@ async def main():
400
418
  doc_layout_model=doc_layout_model,
401
419
  skip_clean=args.skip_clean,
402
420
  dual_translate_first=args.dual_translate_first,
421
+ disable_rich_text_translate=args.disable_rich_text_translate,
422
+ enhance_compatibility=args.enhance_compatibility,
423
+ report_interval=args.report_interval,
403
424
  )
404
425
 
405
426
  # Create progress handler
@@ -24,6 +24,7 @@ class ProgressMonitor:
24
24
  self.progress_change_callback = progress_change_callback
25
25
  self.finish_callback = finish_callback
26
26
  self.report_interval = report_interval
27
+ logger.debug(f"report_interval: {self.report_interval}")
27
28
  self.last_report_time = 0
28
29
  self.finish_stage_count = 0
29
30
  self.finish_event = finish_event
@@ -31,6 +32,18 @@ class ProgressMonitor:
31
32
  self.loop = loop
32
33
  if finish_event and not loop:
33
34
  raise ValueError("finish_event requires a loop")
35
+ if self.progress_change_callback:
36
+ self.progress_change_callback(
37
+ type="stage_summary",
38
+ stages=[
39
+ {
40
+ "name": name,
41
+ "percent": 1.0 / len(stages),
42
+ }
43
+ for name in stages
44
+ ],
45
+ )
46
+ self.lock = threading.Lock()
34
47
 
35
48
  def stage_start(self, stage_name: str, total: int):
36
49
  stage = self.stage[stage_name]
@@ -48,7 +61,9 @@ class ProgressMonitor:
48
61
  stage_progress=0.0,
49
62
  stage_current=0,
50
63
  stage_total=total,
64
+ overall_progress=self.calculate_current_progress(),
51
65
  )
66
+ self.last_report_time = 0.0
52
67
  return stage
53
68
 
54
69
  def __enter__(self):
@@ -66,7 +81,7 @@ class ProgressMonitor:
66
81
  self.finish_callback(type="error", error=CancelledError)
67
82
 
68
83
  def stage_done(self, stage):
69
- self.last_report_time = 0
84
+ self.last_report_time = 0.0
70
85
  self.finish_stage_count += 1
71
86
  if (
72
87
  stage.current != stage.total
@@ -94,19 +109,20 @@ class ProgressMonitor:
94
109
  return progress
95
110
 
96
111
  def stage_update(self, stage, n: int):
97
- if (
98
- self.progress_change_callback
99
- and time.time() - self.last_report_time > self.report_interval
100
- ):
101
- self.progress_change_callback(
102
- type="progress_update",
103
- stage=stage.display_name,
104
- stage_progress=stage.current * 100 / stage.total,
105
- stage_current=stage.current,
106
- stage_total=stage.total,
107
- overall_progress=self.calculate_current_progress(stage),
108
- )
109
- self.last_report_time = time.time()
112
+ with self.lock:
113
+ report_time_delta = time.time() - self.last_report_time
114
+ if report_time_delta < self.report_interval:
115
+ return
116
+ if self.progress_change_callback:
117
+ self.progress_change_callback(
118
+ type="progress_update",
119
+ stage=stage.display_name,
120
+ stage_progress=stage.current * 100 / stage.total,
121
+ stage_current=stage.current,
122
+ stage_total=stage.total,
123
+ overall_progress=self.calculate_current_progress(stage),
124
+ )
125
+ self.last_report_time = time.time()
110
126
 
111
127
  def translate_done(self, translate_result):
112
128
  if self.finish_callback:
@@ -33,6 +33,9 @@ class TranslationConfig:
33
33
  doc_layout_model=None,
34
34
  skip_clean: bool = False,
35
35
  dual_translate_first: bool = False,
36
+ disable_rich_text_translate: bool = False, # 是否禁用富文本翻译
37
+ enhance_compatibility: bool = False, # 增强兼容性模式
38
+ report_interval: float = 0.1, # Progress report interval in seconds
36
39
  ):
37
40
  self.input_file = input_file
38
41
  self.translator = translator
@@ -51,8 +54,12 @@ class TranslationConfig:
51
54
  self.short_line_split_factor = short_line_split_factor
52
55
  self.use_rich_pbar = use_rich_pbar
53
56
  self.progress_monitor = progress_monitor
54
- self.skip_clean = skip_clean
55
- self.dual_translate_first = dual_translate_first
57
+ self.skip_clean = skip_clean or enhance_compatibility
58
+ self.dual_translate_first = dual_translate_first or enhance_compatibility
59
+ self.disable_rich_text_translate = (
60
+ disable_rich_text_translate or enhance_compatibility
61
+ )
62
+ self.report_interval = report_interval
56
63
  if progress_monitor:
57
64
  if progress_monitor.cancel_event is None:
58
65
  progress_monitor.cancel_event = threading.Event()
@@ -40,7 +40,7 @@ Please pay special attention to:
40
40
 
41
41
 
42
42
  1. Fork this repository and clone it locally.
43
- 2. Use `doc/deploy.sh` to set up the development environment.
43
+ 2. Use `doc/deploy.sh` to set up the development environment.
44
44
  3. Create a new branch and make code changes on that branch. `git checkout -b feature/<feature-name>`
45
45
  4. Perform development and ensure the code meets the requirements.
46
46
 
@@ -72,6 +72,8 @@ git commit -m "<semantic commit message>"
72
72
 
73
73
  - Use the `uv run yadt` command for development and testing.
74
74
 
75
+ - When you need print log, please use `log.debug()` to print info. **DO NOT USE `print()`**
76
+
75
77
  - Code formatting
76
78
 
77
79
  3. Dependency Updates
@@ -0,0 +1,81 @@
1
+ # BabelDOC/PDFMathTranslate 贡献者奖励规则
2
+
3
+ ### **月度活跃贡献者奖励规则**
4
+ **一、资格标准**
5
+ 1. **贡献类型要求**
6
+ - 需提交 **至少 1 个有效 PR**(Pull Request),或进行 **PR 审核、文档编写** 等贡献。
7
+ - 有效贡献定义:
8
+ - 非简单的文档错别字修复
9
+ - 非简单的代码格式化调整(如仅调整缩进、空格等)
10
+ - 需做出实质性贡献(如功能开发、Bug 修复、性能优化、架构调整、技术文档编写、PR 审核等)
11
+ - 示例合格贡献:新增功能模块、修复逻辑错误、优化算法效率、编写技术文档等
12
+
13
+ 2. **时间范围**
14
+ - 每月 1 日至月末最后一天合并的 PR 计入当月统计
15
+
16
+ **二、申请流程**
17
+ 1. **申请条件**
18
+ - PR 需被成功合并至[funstory-ai/BabelDOC](https://github.com/funstory-ai/BabelDOC/pulls) 仓库或 [Byaidu/PDFMathTranslate](https://github.com/Byaidu/PDFMathTranslate/pulls)的主分支。
19
+ - 审核 PR、撰写 wiki 等贡献也必须是以上两个仓库。
20
+ - 同一贡献者每月仅可申请一次(无论提交 PR 数量)
21
+ - 同一贡献者每月最多可以获得 1 个兑换码
22
+ - 对于 PR,只有发起者可以申请兑换码
23
+ - 仅可使用当月的贡献申请兑换码(特殊情况请联系 aw@funstory.ai 说明)
24
+
25
+ 2. **申请方式**
26
+ - 发送邮件至 **aw@funstory.ai**
27
+ - 邮件标题格式:`[贡献者会员兑换码申请] GitHub用户名-月份`(例:`[贡献者会员兑换码申请] awwaawwa-2024-07`)
28
+ - 邮件正文需包含:
29
+ - GitHub 用户名
30
+ - 合并 PR 的完整链接
31
+ - 附件要求:
32
+ - PR 页面完整截图(需包含合并状态、仓库名称及点击头像后弹出来的侧边栏,如下图所示)
33
+
34
+ ![附件示例](images/contributor_reward_example.png)
35
+
36
+ 3. **奖励说明**
37
+ - 奖励内容:[沉浸式翻译(Immersive Translate)](https://immersivetranslate.com/zh-Hans/pricing/)月度会员兑换码
38
+ - 兑换码使用:在[沉浸式翻译官网兑换页](https://immersivetranslate.com/zh-Hans/exchange)输入即可激活
39
+ - 会员权益:沉浸式翻译 Pro 会员一个月(详见[官网价格页](https://immersivetranslate.com/zh-Hans/pricing/)说明)
40
+ - 兑换码为专属福利,不可转让
41
+
42
+ **三、审核与发放**
43
+ 1. **审核周期**
44
+ - 我们会尽力在收到申请邮件后 1 个工作日内完成审核
45
+ - 审核时间可能因申请数量、审核复杂度等因素有所延长
46
+ - 审核通过后,兑换码将通过邮件方式发送
47
+ - 若审核未通过,我们会通过邮件说明原因
48
+
49
+ 2. 兑换码规则:
50
+ - 使用方式:[官网兑换页](https://immersivetranslate.com/zh-Hans/exchange)输入兑换码激活
51
+ - 权益内容:月度会员(具体权益见[官网价格页](https://immersivetranslate.com/zh-Hans/pricing/)说明)
52
+ - 不可转让
53
+
54
+ **四、注意事项**
55
+ 1. **禁止行为**
56
+ - 将完整功能拆分为多个无关 PR 提交
57
+ - 提交质量不合格或具有潜在危害的代码
58
+ - 提供虚假或误导性的申请材料
59
+
60
+ 2. **特别说明**
61
+ - funstory.ai 保留对贡献价值的评估权、规则的最终解释权等所有必要权利
62
+ - 规则如有更新,将提前 1 天在 [BabelDOC GitHub PR](https://github.com/funstory-ai/BabelDOC/pulls) 公告
63
+ - 过期未使用的兑换码不予补发
64
+ - 自 2025 年 2 月 1 日起的贡献可以申请兑换码
65
+ - 为了确认您是 Pull Request (PR) 的发起者,防止他人冒领,我们可能会要求您使用发起者账号在 PR 下方留言指定的随机数字。
66
+
67
+
68
+ ---
69
+ ### **常见问题解答(FAQ)**
70
+
71
+ Q:如何判断文档翻译贡献是否有效?
72
+ A:系统性的人工翻译(如完整章节的翻译并经过人工校对)视为有效贡献。零散段落翻译或仅依赖机器翻译的内容不计入有效贡献。
73
+
74
+ Q:兑换码过期了可以补发吗?
75
+ A:为确保公平性,过期的兑换码将不予补发,请在有效期内及时使用。
76
+
77
+ Q:为什么这个文档是中文的?
78
+ A:因为目前应该是中文贡献者多吧,所以就先写中文的。后面再撰写英文版的。
79
+
80
+ ---
81
+ **规则公示**:本规则文档存放于 BabelDOC 仓库 [CONTRIBUTOR_REWARD.md](https://github.com/funstory-ai/BabelDOC/blob/main/docs/CONTRIBUTOR_REWARD.md)。
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "BabelDOC"
3
- version = "0.1.6.rc0"
3
+ version = "0.1.8"
4
4
  description = "Yet Another Document Translator"
5
5
  license = "AGPL-3.0"
6
6
  readme = "README.md"
@@ -13,7 +13,7 @@ keywords = ["PDF"]
13
13
  dependencies = [
14
14
  "bitstring>=4.3.0",
15
15
  "configargparse>=1.7",
16
- "httpx>=0.27.0",
16
+ "httpx[socks]>=0.27.0",
17
17
  "huggingface-hub>=0.27.0",
18
18
  "numpy>=2.0.2",
19
19
  "onnx>=1.17.0",
@@ -117,7 +117,7 @@ dev = [
117
117
  ]
118
118
 
119
119
  [bumpver]
120
- current_version = "0.1.6.rc0"
120
+ current_version = "0.1.8"
121
121
  version_pattern = "MAJOR.MINOR.PATCH[.PYTAGNUM]"
122
122
 
123
123
  [bumpver.file_patterns]
@@ -1,4 +1,5 @@
1
1
  version = 1
2
+ revision = 1
2
3
  requires-python = ">=3.10, <3.13"
3
4
  resolution-markers = [
4
5
  "python_full_version >= '3.12' and sys_platform == 'darwin'",
@@ -38,12 +39,12 @@ wheels = [
38
39
 
39
40
  [[package]]
40
41
  name = "babeldoc"
41
- version = "0.1.6rc0"
42
+ version = "0.1.8"
42
43
  source = { editable = "." }
43
44
  dependencies = [
44
45
  { name = "bitstring" },
45
46
  { name = "configargparse" },
46
- { name = "httpx" },
47
+ { name = "httpx", extra = ["socks"] },
47
48
  { name = "huggingface-hub" },
48
49
  { name = "msgpack" },
49
50
  { name = "numpy" },
@@ -72,7 +73,7 @@ dev = [
72
73
  requires-dist = [
73
74
  { name = "bitstring", specifier = ">=4.3.0" },
74
75
  { name = "configargparse", specifier = ">=1.7" },
75
- { name = "httpx", specifier = ">=0.27.0" },
76
+ { name = "httpx", extras = ["socks"], specifier = ">=0.27.0" },
76
77
  { name = "huggingface-hub", specifier = ">=0.27.0" },
77
78
  { name = "msgpack", specifier = ">=1.1.0" },
78
79
  { name = "numpy", specifier = ">=2.0.2" },
@@ -489,6 +490,11 @@ wheels = [
489
490
  { url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517 },
490
491
  ]
491
492
 
493
+ [package.optional-dependencies]
494
+ socks = [
495
+ { name = "socksio" },
496
+ ]
497
+
492
498
  [[package]]
493
499
  name = "huggingface-hub"
494
500
  version = "0.27.1"
@@ -1245,6 +1251,15 @@ wheels = [
1245
1251
  { url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235 },
1246
1252
  ]
1247
1253
 
1254
+ [[package]]
1255
+ name = "socksio"
1256
+ version = "1.0.0"
1257
+ source = { registry = "https://pypi.org/simple" }
1258
+ sdist = { url = "https://files.pythonhosted.org/packages/f8/5c/48a7d9495be3d1c651198fd99dbb6ce190e2274d0f28b9051307bdec6b85/socksio-1.0.0.tar.gz", hash = "sha256:f88beb3da5b5c38b9890469de67d0cb0f9d494b78b106ca1845f96c10b91c4ac", size = 19055 }
1259
+ wheels = [
1260
+ { url = "https://files.pythonhosted.org/packages/37/c3/6eeb6034408dac0fa653d126c9204ade96b819c936e136c5e8a6897eee9c/socksio-1.0.0-py3-none-any.whl", hash = "sha256:95dc1f15f9b34e8d7b16f06d74b8ccf48f609af32ab33c608d08761c5dcbb1f3", size = 12763 },
1261
+ ]
1262
+
1248
1263
  [[package]]
1249
1264
  name = "sympy"
1250
1265
  version = "1.13.3"
@@ -1,34 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- title: ''
5
- labels: 'bug'
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Describe the bug**
11
- A clear and concise description of what the bug is.
12
-
13
- **To Reproduce**
14
- Steps to reproduce the behavior:
15
- 1. Go to '...'
16
- 2. Click on '....'
17
- 3. Scroll down to '....'
18
- 4. See error
19
-
20
- **Expected behavior**
21
- A clear and concise description of what you expected to happen.
22
-
23
- **Screenshots**
24
- If applicable, add screenshots to help explain your problem.
25
-
26
- **Desktop (please complete the following information):**
27
- - OS: [e.g. macOS Sequoia 15.3, Windows 11]
28
- - Version [e.g. 0.1.0]
29
-
30
- **Input PDF file:**
31
- if applicable, attach the input PDF file here.
32
-
33
- **Additional context**
34
- Add any other context about the problem here.
@@ -1,20 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for this project
4
- title: ''
5
- labels: 'enhancement'
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Is your feature request related to a problem? Please describe.**
11
- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
-
13
- **Describe the solution you'd like**
14
- A clear and concise description of what you want to happen.
15
-
16
- **Describe alternatives you've considered**
17
- A clear and concise description of any alternative solutions or features you've considered.
18
-
19
- **Additional context**
20
- Add any other context or screenshots about the feature request here.
@@ -1 +0,0 @@
1
- __version__ = "0.1.6.rc0"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes