txt2ebook 0.1.143__tar.gz → 0.1.145__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 (111) hide show
  1. txt2ebook-0.1.145/.pre-commit-config.yaml +49 -0
  2. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/CHANGELOG.md +16 -0
  3. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/PKG-INFO +1 -1
  4. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/noxfile.py +24 -6
  5. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/pyproject.toml +20 -21
  6. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.po +6 -6
  7. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/locales/txt2ebook.pot +6 -6
  8. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.po +6 -6
  9. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.po +6 -6
  10. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/models/book.py +1 -3
  11. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/subcommands/massage.py +3 -1
  12. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/uv.lock +411 -274
  13. txt2ebook-0.1.143/.pre-commit-config.yaml +0 -117
  14. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/.coveragerc +0 -0
  15. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/.gitignore +0 -0
  16. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/.python-version +0 -0
  17. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/CONTRIBUTING.md +0 -0
  18. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/LICENSE.md +0 -0
  19. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/README.md +0 -0
  20. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/Makefile +0 -0
  21. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/make.bat +0 -0
  22. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/source/CHANGELOG.md +0 -0
  23. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/source/CONTRIBUTING.md +0 -0
  24. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/source/LICENSE.md +0 -0
  25. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/source/README.md +0 -0
  26. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/source/_static/logo.png +0 -0
  27. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/source/conf.py +0 -0
  28. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/source/index.rst +0 -0
  29. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/source/txt2ebook.formats.rst +0 -0
  30. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/source/txt2ebook.helpers.rst +0 -0
  31. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/source/txt2ebook.models.rst +0 -0
  32. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/source/txt2ebook.parsers.rst +0 -0
  33. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/docs/source/txt2ebook.rst +0 -0
  34. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/__init__.py +0 -0
  35. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/__main__.py +0 -0
  36. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/cli.py +0 -0
  37. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/exceptions.py +0 -0
  38. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/__init__.py +0 -0
  39. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/base.py +0 -0
  40. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/epub.py +0 -0
  41. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/gmi.py +0 -0
  42. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/md.py +0 -0
  43. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/pdf.py +0 -0
  44. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/templates/__init__.py +0 -0
  45. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/templates/epub/__init__.py +0 -0
  46. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/templates/epub/clean.css +0 -0
  47. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/templates/epub/condense.css +0 -0
  48. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/templates/epub/noindent.css +0 -0
  49. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/tex.py +0 -0
  50. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/txt.py +0 -0
  51. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/formats/typ.py +0 -0
  52. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/helpers/__init__.py +0 -0
  53. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/languages/__init__.py +0 -0
  54. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/languages/en.py +0 -0
  55. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/languages/zh_cn.py +0 -0
  56. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/languages/zh_tw.py +0 -0
  57. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.mo +0 -0
  58. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.mo +0 -0
  59. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.mo +0 -0
  60. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/models/__init__.py +0 -0
  61. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/models/chapter.py +0 -0
  62. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/models/volume.py +0 -0
  63. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/parser.py +0 -0
  64. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/subcommands/__init__.py +0 -0
  65. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/subcommands/env.py +0 -0
  66. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/subcommands/epub.py +0 -0
  67. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/subcommands/gmi.py +0 -0
  68. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/subcommands/md.py +0 -0
  69. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/subcommands/parse.py +0 -0
  70. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/subcommands/pdf.py +0 -0
  71. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/subcommands/tex.py +0 -0
  72. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/subcommands/typ.py +0 -0
  73. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/tokenizer.py +0 -0
  74. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/src/txt2ebook/zh_utils.py +0 -0
  75. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/__init__.py +0 -0
  76. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/conftest.py +0 -0
  77. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/fixtures/empty_file.txt +0 -0
  78. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/fixtures/missing_chapters.txt +0 -0
  79. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/fixtures/sample.txt +0 -0
  80. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/fixtures/sample_all_headers.txt +0 -0
  81. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/fixtures/sample_long_headers.txt +0 -0
  82. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/fixtures/sample_remove_wrapping.txt +0 -0
  83. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/fixtures/sample_unsorted_headers.txt +0 -0
  84. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/fixtures/sample_with_issues.txt +0 -0
  85. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/fixtures/sample_with_metadata.txt +0 -0
  86. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_epub_writer.py +0 -0
  87. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_filename_format_flag.py +0 -0
  88. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_format_option.py +0 -0
  89. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_header_number_flag.py +0 -0
  90. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_input_file_arg.py +0 -0
  91. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_language_option.py +0 -0
  92. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_output_file_arg.py +0 -0
  93. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_overwrite_flag.py +0 -0
  94. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_parser.py +0 -0
  95. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_purge_flag.py +0 -0
  96. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_quiet_flag.py +0 -0
  97. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_raise_warnings.py +0 -0
  98. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_sort_volume_and_chapter_flag.py +0 -0
  99. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_split_volume_and_chapter_flag.py +0 -0
  100. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_subcommand_env.py +0 -0
  101. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_subcommand_epub.py +0 -0
  102. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_subcommand_massage.py +0 -0
  103. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_test_parsing_flag.py +0 -0
  104. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_tokenizer.py +0 -0
  105. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_translator_option.py +0 -0
  106. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_txt2ebook.py +0 -0
  107. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_verbose_flag.py +0 -0
  108. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_volume_page_flag.py +0 -0
  109. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_zh_utils_zh_halfwidth_to_fullwidth.py +0 -0
  110. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_zh_utils_zh_numeric.py +0 -0
  111. {txt2ebook-0.1.143 → txt2ebook-0.1.145}/tests/test_zh_utils_zh_words_to_numbers.py +0 -0
@@ -0,0 +1,49 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v5.0.0
6
+ hooks:
7
+ - id: check-case-conflict
8
+ - id: check-merge-conflict
9
+ - id: check-toml
10
+ - id: check-yaml
11
+ - id: debug-statements
12
+ - id: detect-private-key
13
+ - id: end-of-file-fixer
14
+ exclude: "locales/.*$"
15
+ - id: mixed-line-ending
16
+ - id: trailing-whitespace
17
+
18
+ - repo: https://github.com/abravalheri/validate-pyproject
19
+ rev: v0.24.1
20
+ hooks:
21
+ - id: validate-pyproject
22
+ name: validate pyproject
23
+
24
+ - repo: https://github.com/codespell-project/codespell
25
+ rev: v2.4.1
26
+ hooks:
27
+ - id: codespell
28
+ args:
29
+ - --skip=uv.lock
30
+
31
+ - repo: https://github.com/pre-commit/mirrors-prettier
32
+ rev: v4.0.0-alpha.8
33
+ hooks:
34
+ - id: prettier
35
+ exclude: (poetry.lock)
36
+
37
+ - repo: https://github.com/astral-sh/ruff-pre-commit
38
+ rev: v0.12.0
39
+ hooks:
40
+ - id: ruff-check
41
+ args:
42
+ - --fix
43
+ - --exit-non-zero-on-fix
44
+
45
+ - repo: https://github.com/pre-commit/mirrors-mypy
46
+ rev: v1.16.1
47
+ hooks:
48
+ - id: mypy
49
+ exclude: docs/
@@ -7,6 +7,22 @@ and this project adheres to [0-based versioning](https://0ver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## v0.1.145 (2025-06-22)
11
+
12
+ - Bump deps and `pre-commit` hooks
13
+ - Clear previous release builds before releasing
14
+ - Remove other lint tools from `pre-commit`
15
+ - Update translations
16
+
17
+ ## v0.1.144 (2025-06-15)
18
+
19
+ - Bump deps
20
+ - Bump `pre-commit` hook for `ruff`
21
+ - Fix deps upgrade and relax deps requirements
22
+ - Fix incorrect type in args
23
+ - Fix missing langconf to parser class
24
+ - Resolve `uv` not using nox's `venv` warning
25
+
10
26
  ## v0.1.143 (2025-06-08)
11
27
 
12
28
  - Add `ruff` to `pre-commit` hook
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: txt2ebook
3
- Version: 0.1.143
3
+ Version: 0.1.145
4
4
  Summary: CLI tool to convert txt file to ebook format
5
5
  Project-URL: Homepage, https://github.com/kianmeng/txt2ebook
6
6
  Project-URL: Repository, https://github.com/kianmeng/txt2ebook
@@ -15,6 +15,8 @@
15
15
 
16
16
  """Nox configuration."""
17
17
 
18
+ import os
19
+ import shutil
18
20
  import datetime
19
21
 
20
22
  import nox
@@ -25,11 +27,10 @@ nox.options.default_venv_backend = "uv"
25
27
  @nox.session(python="3.9")
26
28
  def deps(session: nox.Session) -> None:
27
29
  """Update pre-commit hooks and deps."""
28
- session.run("uv", "sync", "-U", "--active")
30
+ _uv_install(session)
29
31
  session.run("pre-commit", "autoupdate", *session.posargs)
30
32
 
31
33
 
32
- @nox.session()
33
34
  @nox.session(python="3.13")
34
35
  def lint(session: nox.Session) -> None:
35
36
  """Run pre-commit tasks.
@@ -212,14 +213,12 @@ def release(session: nox.Session) -> None:
212
213
 
213
214
  prompt = "Build and publish package to pypi? (y/n): "
214
215
  if input(prompt).lower() in ["y", "yes"]:
216
+ dist_dir = os.path.join(os.getcwd(), "dist")
217
+ shutil.rmtree(dist_dir)
215
218
  session.run("uv", "build")
216
219
  session.run("uv", "publish")
217
220
 
218
221
 
219
- def _uv_install(session: nox.Session) -> None:
220
- session.run("uv", "sync", "--active")
221
-
222
-
223
222
  def _search_and_replace(file, search, replace) -> None:
224
223
  with open(file, "r+", encoding="utf8") as f:
225
224
  content = f.read()
@@ -227,3 +226,22 @@ def _search_and_replace(file, search, replace) -> None:
227
226
  f.seek(0)
228
227
  f.write(content)
229
228
  f.truncate()
229
+
230
+
231
+ def _uv_install(session: nox.Session) -> None:
232
+ """Install the project and its development dependencies using uv.
233
+
234
+ This also resolves the following error:
235
+ warning: `VIRTUAL_ENV=.nox/lint` does not match the project environment
236
+ path `.venv` and will be ignored
237
+
238
+ See https://nox.thea.codes/en/stable/cookbook.html#using-a-lockfile
239
+ """
240
+ session.run_install(
241
+ "uv",
242
+ "sync",
243
+ "--upgrade",
244
+ "--all-packages",
245
+ f"--python={session.virtualenv.location}",
246
+ env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
247
+ )
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "txt2ebook"
3
- version = "0.1.143"
3
+ version = "0.1.145"
4
4
  description = "CLI tool to convert txt file to ebook format"
5
5
  authors = [{ name = "Kian-Meng Ang", email = "kianmeng@cpan.org" }]
6
6
  requires-python = "~=3.9"
@@ -57,26 +57,25 @@ tte = "txt2ebook.cli:main"
57
57
 
58
58
  [dependency-groups]
59
59
  dev = [
60
- "babel>=2.17.0",
61
- "bandit~=1.7.1",
62
- "flake8-simplify>=0.21.0,<0.22",
63
- "mypy>=1.10.0,<2",
64
- "myst-parser>=3.0.1,<4",
65
- "nox-poetry>=1.0.3,<2",
66
- "nox>=2024.4.15,<2025",
67
- "pep8-naming>=0.13.3,<0.14",
68
- "pre-commit>=4.2.0",
69
- "pylint>=3.2.0,<4",
70
- "pytest-cov>=5.0.0,<6",
71
- "pytest-randomly>=3.15.0,<4",
72
- "pytest-xdist>=3.6.1,<4",
73
- "pytest>=8.2.0,<9",
74
- "ruff>=0.11.12",
75
- "scripttest~=1.3",
76
- "sphinx-autodoc-typehints>=2.2.2,<3",
77
- "sphinx-copybutton>=0.5.2,<0.6",
78
- "sphinx>=7.3.7,<8",
79
- "vulture~=2.11",
60
+ "babel",
61
+ "bandit",
62
+ "flake8-simplify",
63
+ "mypy",
64
+ "myst-parser",
65
+ "nox",
66
+ "pep8-naming",
67
+ "pre-commit",
68
+ "pylint",
69
+ "pytest-cov",
70
+ "pytest-randomly",
71
+ "pytest-xdist",
72
+ "pytest",
73
+ "ruff",
74
+ "scripttest",
75
+ "sphinx-autodoc-typehints",
76
+ "sphinx-copybutton",
77
+ "sphinx",
78
+ "vulture",
80
79
  ]
81
80
 
82
81
  [build-system]
@@ -1,26 +1,26 @@
1
- #: src/txt2ebook/formats/base.py:140
1
+ #: src/txt2ebook/formats/base.py:137
2
2
  msgid "title:"
3
3
  msgstr "Title:"
4
4
 
5
- #: src/txt2ebook/formats/base.py:141
5
+ #: src/txt2ebook/formats/base.py:138
6
6
  msgid "author:"
7
7
  msgstr "Author:"
8
8
 
9
- #: src/txt2ebook/formats/base.py:142
9
+ #: src/txt2ebook/formats/base.py:139
10
10
  msgid "translator:"
11
11
  msgstr "Translator:"
12
12
 
13
- #: src/txt2ebook/formats/base.py:143
13
+ #: src/txt2ebook/formats/base.py:140
14
14
  msgid "tag:"
15
15
  msgstr "Tag:"
16
16
 
17
- #: src/txt2ebook/formats/base.py:154 src/txt2ebook/formats/gmi.py:62
17
+ #: src/txt2ebook/formats/base.py:146 src/txt2ebook/formats/gmi.py:62
18
18
  #: src/txt2ebook/formats/md.py:61 src/txt2ebook/formats/pdf.py:130
19
19
  #: src/txt2ebook/formats/txt.py:71
20
20
  msgid "toc"
21
21
  msgstr "Table of Content"
22
22
 
23
- #: src/txt2ebook/formats/epub.py:147
23
+ #: src/txt2ebook/formats/epub.py:141
24
24
  msgid "cover"
25
25
  msgstr "Cover"
26
26
 
@@ -1,26 +1,26 @@
1
- #: src/txt2ebook/formats/base.py:140
1
+ #: src/txt2ebook/formats/base.py:137
2
2
  msgid "title:"
3
3
  msgstr ""
4
4
 
5
- #: src/txt2ebook/formats/base.py:141
5
+ #: src/txt2ebook/formats/base.py:138
6
6
  msgid "author:"
7
7
  msgstr ""
8
8
 
9
- #: src/txt2ebook/formats/base.py:142
9
+ #: src/txt2ebook/formats/base.py:139
10
10
  msgid "translator:"
11
11
  msgstr ""
12
12
 
13
- #: src/txt2ebook/formats/base.py:143
13
+ #: src/txt2ebook/formats/base.py:140
14
14
  msgid "tag:"
15
15
  msgstr ""
16
16
 
17
- #: src/txt2ebook/formats/base.py:154 src/txt2ebook/formats/gmi.py:62
17
+ #: src/txt2ebook/formats/base.py:146 src/txt2ebook/formats/gmi.py:62
18
18
  #: src/txt2ebook/formats/md.py:61 src/txt2ebook/formats/pdf.py:130
19
19
  #: src/txt2ebook/formats/txt.py:71
20
20
  msgid "toc"
21
21
  msgstr ""
22
22
 
23
- #: src/txt2ebook/formats/epub.py:147
23
+ #: src/txt2ebook/formats/epub.py:141
24
24
  msgid "cover"
25
25
  msgstr ""
26
26
 
@@ -1,26 +1,26 @@
1
- #: src/txt2ebook/formats/base.py:140
1
+ #: src/txt2ebook/formats/base.py:137
2
2
  msgid "title:"
3
3
  msgstr "书名:"
4
4
 
5
- #: src/txt2ebook/formats/base.py:141
5
+ #: src/txt2ebook/formats/base.py:138
6
6
  msgid "author:"
7
7
  msgstr "作者:"
8
8
 
9
- #: src/txt2ebook/formats/base.py:142
9
+ #: src/txt2ebook/formats/base.py:139
10
10
  msgid "translator:"
11
11
  msgstr "翻译:"
12
12
 
13
- #: src/txt2ebook/formats/base.py:143
13
+ #: src/txt2ebook/formats/base.py:140
14
14
  msgid "tag:"
15
15
  msgstr "票签:"
16
16
 
17
- #: src/txt2ebook/formats/base.py:154 src/txt2ebook/formats/gmi.py:62
17
+ #: src/txt2ebook/formats/base.py:146 src/txt2ebook/formats/gmi.py:62
18
18
  #: src/txt2ebook/formats/md.py:61 src/txt2ebook/formats/pdf.py:130
19
19
  #: src/txt2ebook/formats/txt.py:71
20
20
  msgid "toc"
21
21
  msgstr "目录"
22
22
 
23
- #: src/txt2ebook/formats/epub.py:147
23
+ #: src/txt2ebook/formats/epub.py:141
24
24
  msgid "cover"
25
25
  msgstr "封面"
26
26
 
@@ -1,26 +1,26 @@
1
- #: src/txt2ebook/formats/base.py:140
1
+ #: src/txt2ebook/formats/base.py:137
2
2
  msgid "title:"
3
3
  msgstr "书名:"
4
4
 
5
- #: src/txt2ebook/formats/base.py:141
5
+ #: src/txt2ebook/formats/base.py:138
6
6
  msgid "author:"
7
7
  msgstr "作者:"
8
8
 
9
- #: src/txt2ebook/formats/base.py:142
9
+ #: src/txt2ebook/formats/base.py:139
10
10
  msgid "translator:"
11
11
  msgstr "翻译:"
12
12
 
13
- #: src/txt2ebook/formats/base.py:143
13
+ #: src/txt2ebook/formats/base.py:140
14
14
  msgid "tag:"
15
15
  msgstr "标签:"
16
16
 
17
- #: src/txt2ebook/formats/base.py:154 src/txt2ebook/formats/gmi.py:62
17
+ #: src/txt2ebook/formats/base.py:146 src/txt2ebook/formats/gmi.py:62
18
18
  #: src/txt2ebook/formats/md.py:61 src/txt2ebook/formats/pdf.py:130
19
19
  #: src/txt2ebook/formats/txt.py:71
20
20
  msgid "toc"
21
21
  msgstr "目录"
22
22
 
23
- #: src/txt2ebook/formats/epub.py:147
23
+ #: src/txt2ebook/formats/epub.py:141
24
24
  msgid "cover"
25
25
  msgstr "封面"
26
26
 
@@ -20,8 +20,6 @@ from collections import Counter
20
20
  from dataclasses import dataclass, field
21
21
  from typing import List, Union
22
22
 
23
- from typing_extensions import Literal
24
-
25
23
  from txt2ebook.models.chapter import Chapter
26
24
  from txt2ebook.models.volume import Volume
27
25
 
@@ -52,7 +50,7 @@ class Book:
52
50
  logger.debug("Book stats: %s", repr(stats))
53
51
  return stats
54
52
 
55
- def filename_format(self, filename_format: Union[str, Literal[True]]) -> str:
53
+ def filename_format(self, filename_format: int) -> str:
56
54
  """Generate the filename format based on the available selection."""
57
55
  authors = ", ".join(self.authors)
58
56
  format_options = {
@@ -202,8 +202,10 @@ def run(args: argparse.Namespace) -> None:
202
202
  """
203
203
  massaged_txt = massage_txt(args)
204
204
  args.language = detect_and_expect_language(massaged_txt, args.language)
205
+ config_lang = args.language.replace("-", "_")
206
+ langconf = import_module(f"txt2ebook.languages.{config_lang}")
205
207
  args.with_toc = False
206
- parser = Parser(massaged_txt, args)
208
+ parser = Parser(massaged_txt, args, langconf)
207
209
  book = parser.parse()
208
210
 
209
211
  if args.debug: