txt2ebook 0.1.143__tar.gz → 0.1.144__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.
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/.pre-commit-config.yaml +1 -1
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/CHANGELOG.md +9 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/PKG-INFO +1 -1
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/noxfile.py +20 -6
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/pyproject.toml +20 -21
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/models/book.py +1 -3
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/massage.py +3 -1
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/uv.lock +331 -185
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/.coveragerc +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/.gitignore +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/.python-version +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/CONTRIBUTING.md +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/LICENSE.md +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/README.md +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/Makefile +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/make.bat +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/CHANGELOG.md +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/CONTRIBUTING.md +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/LICENSE.md +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/README.md +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/_static/logo.png +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/conf.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/index.rst +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/txt2ebook.formats.rst +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/txt2ebook.helpers.rst +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/txt2ebook.models.rst +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/txt2ebook.parsers.rst +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/docs/source/txt2ebook.rst +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/__init__.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/__main__.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/cli.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/exceptions.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/__init__.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/base.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/epub.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/gmi.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/md.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/pdf.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/templates/__init__.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/templates/epub/__init__.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/templates/epub/clean.css +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/templates/epub/condense.css +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/templates/epub/noindent.css +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/tex.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/txt.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/formats/typ.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/helpers/__init__.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/languages/__init__.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/languages/en.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/languages/zh_cn.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/languages/zh_tw.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.mo +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.po +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/txt2ebook.pot +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.mo +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.po +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.mo +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.po +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/models/__init__.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/models/chapter.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/models/volume.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/parser.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/__init__.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/env.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/epub.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/gmi.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/md.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/parse.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/pdf.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/tex.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/subcommands/typ.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/tokenizer.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/src/txt2ebook/zh_utils.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/__init__.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/conftest.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/empty_file.txt +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/missing_chapters.txt +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample.txt +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample_all_headers.txt +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample_long_headers.txt +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample_remove_wrapping.txt +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample_unsorted_headers.txt +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample_with_issues.txt +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/fixtures/sample_with_metadata.txt +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_epub_writer.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_filename_format_flag.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_format_option.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_header_number_flag.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_input_file_arg.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_language_option.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_output_file_arg.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_overwrite_flag.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_parser.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_purge_flag.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_quiet_flag.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_raise_warnings.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_sort_volume_and_chapter_flag.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_split_volume_and_chapter_flag.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_subcommand_env.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_subcommand_epub.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_subcommand_massage.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_test_parsing_flag.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_tokenizer.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_translator_option.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_txt2ebook.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_verbose_flag.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_volume_page_flag.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_zh_utils_zh_halfwidth_to_fullwidth.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_zh_utils_zh_numeric.py +0 -0
- {txt2ebook-0.1.143 → txt2ebook-0.1.144}/tests/test_zh_utils_zh_words_to_numbers.py +0 -0
@@ -7,6 +7,15 @@ and this project adheres to [0-based versioning](https://0ver.org/).
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## v0.1.144 (2025-06-15)
|
11
|
+
|
12
|
+
- Bump deps
|
13
|
+
- Bump `pre-commit` hook for `ruff`
|
14
|
+
- Fix deps upgrade and relax deps requirements
|
15
|
+
- Fix incorrect type in args
|
16
|
+
- Fix missing langconf to parser class
|
17
|
+
- Resolve `uv` not using nox's `venv` warning
|
18
|
+
|
10
19
|
## v0.1.143 (2025-06-08)
|
11
20
|
|
12
21
|
- Add `ruff` to `pre-commit` hook
|
@@ -25,11 +25,10 @@ nox.options.default_venv_backend = "uv"
|
|
25
25
|
@nox.session(python="3.9")
|
26
26
|
def deps(session: nox.Session) -> None:
|
27
27
|
"""Update pre-commit hooks and deps."""
|
28
|
-
session
|
28
|
+
_uv_install(session)
|
29
29
|
session.run("pre-commit", "autoupdate", *session.posargs)
|
30
30
|
|
31
31
|
|
32
|
-
@nox.session()
|
33
32
|
@nox.session(python="3.13")
|
34
33
|
def lint(session: nox.Session) -> None:
|
35
34
|
"""Run pre-commit tasks.
|
@@ -216,10 +215,6 @@ def release(session: nox.Session) -> None:
|
|
216
215
|
session.run("uv", "publish")
|
217
216
|
|
218
217
|
|
219
|
-
def _uv_install(session: nox.Session) -> None:
|
220
|
-
session.run("uv", "sync", "--active")
|
221
|
-
|
222
|
-
|
223
218
|
def _search_and_replace(file, search, replace) -> None:
|
224
219
|
with open(file, "r+", encoding="utf8") as f:
|
225
220
|
content = f.read()
|
@@ -227,3 +222,22 @@ def _search_and_replace(file, search, replace) -> None:
|
|
227
222
|
f.seek(0)
|
228
223
|
f.write(content)
|
229
224
|
f.truncate()
|
225
|
+
|
226
|
+
|
227
|
+
def _uv_install(session: nox.Session) -> None:
|
228
|
+
"""Install the project and its development dependencies using uv.
|
229
|
+
|
230
|
+
This also resolves the following error:
|
231
|
+
warning: `VIRTUAL_ENV=.nox/lint` does not match the project environment
|
232
|
+
path `.venv` and will be ignored
|
233
|
+
|
234
|
+
See https://nox.thea.codes/en/stable/cookbook.html#using-a-lockfile
|
235
|
+
"""
|
236
|
+
session.run_install(
|
237
|
+
"uv",
|
238
|
+
"sync",
|
239
|
+
"--upgrade",
|
240
|
+
"--all-packages",
|
241
|
+
f"--python={session.virtualenv.location}",
|
242
|
+
env={"UV_PROJECT_ENVIRONMENT": session.virtualenv.location},
|
243
|
+
)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "txt2ebook"
|
3
|
-
version = "0.1.
|
3
|
+
version = "0.1.144"
|
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
|
61
|
-
"bandit
|
62
|
-
"flake8-simplify
|
63
|
-
"mypy
|
64
|
-
"myst-parser
|
65
|
-
"nox
|
66
|
-
"
|
67
|
-
"
|
68
|
-
"
|
69
|
-
"
|
70
|
-
"pytest-
|
71
|
-
"pytest-
|
72
|
-
"pytest
|
73
|
-
"
|
74
|
-
"
|
75
|
-
"
|
76
|
-
"sphinx-
|
77
|
-
"sphinx
|
78
|
-
"
|
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]
|
@@ -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:
|
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:
|