txt2ebook 0.1.144__tar.gz → 0.1.146__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.146/.pre-commit-config.yaml +49 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/CHANGELOG.md +17 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/PKG-INFO +7 -13
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/README.md +5 -11
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/noxfile.py +4 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/pyproject.toml +6 -1
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/languages/en.py +3 -2
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.po +6 -6
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/locales/txt2ebook.pot +6 -6
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.po +6 -6
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.po +6 -6
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/subcommands/massage.py +40 -12
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/conftest.py +25 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/uv.lock +84 -93
- txt2ebook-0.1.144/.pre-commit-config.yaml +0 -117
- txt2ebook-0.1.144/tests/test_epub_writer.py +0 -28
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/.coveragerc +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/.gitignore +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/.python-version +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/CONTRIBUTING.md +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/LICENSE.md +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/Makefile +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/make.bat +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/source/CHANGELOG.md +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/source/CONTRIBUTING.md +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/source/LICENSE.md +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/source/README.md +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/source/_static/logo.png +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/source/conf.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/source/index.rst +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/source/txt2ebook.formats.rst +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/source/txt2ebook.helpers.rst +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/source/txt2ebook.models.rst +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/source/txt2ebook.parsers.rst +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/docs/source/txt2ebook.rst +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/__init__.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/__main__.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/cli.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/exceptions.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/__init__.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/base.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/epub.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/gmi.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/md.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/pdf.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/templates/__init__.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/templates/epub/__init__.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/templates/epub/clean.css +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/templates/epub/condense.css +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/templates/epub/noindent.css +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/tex.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/txt.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/formats/typ.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/helpers/__init__.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/languages/__init__.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/languages/zh_cn.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/languages/zh_tw.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.mo +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.mo +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.mo +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/models/__init__.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/models/book.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/models/chapter.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/models/volume.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/parser.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/subcommands/__init__.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/subcommands/env.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/subcommands/epub.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/subcommands/gmi.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/subcommands/md.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/subcommands/parse.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/subcommands/pdf.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/subcommands/tex.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/subcommands/typ.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/tokenizer.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/zh_utils.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/__init__.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/fixtures/empty_file.txt +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/fixtures/missing_chapters.txt +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/fixtures/sample.txt +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/fixtures/sample_all_headers.txt +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/fixtures/sample_long_headers.txt +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/fixtures/sample_remove_wrapping.txt +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/fixtures/sample_unsorted_headers.txt +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/fixtures/sample_with_issues.txt +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/fixtures/sample_with_metadata.txt +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_filename_format_flag.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_format_option.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_header_number_flag.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_input_file_arg.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_language_option.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_output_file_arg.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_overwrite_flag.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_parser.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_purge_flag.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_quiet_flag.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_raise_warnings.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_sort_volume_and_chapter_flag.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_split_volume_and_chapter_flag.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_subcommand_env.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_subcommand_epub.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_subcommand_massage.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_test_parsing_flag.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_tokenizer.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_translator_option.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_txt2ebook.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_verbose_flag.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_volume_page_flag.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_zh_utils_zh_halfwidth_to_fullwidth.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/tests/test_zh_utils_zh_numeric.py +0 -0
- {txt2ebook-0.1.144 → txt2ebook-0.1.146}/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.1
|
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,23 @@ and this project adheres to [0-based versioning](https://0ver.org/).
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## v0.1.146 (2025-06-29)
|
11
|
+
|
12
|
+
- Bump deps and `pre-commit` hook for `ruff`
|
13
|
+
- Fix `massage` subcommand did not retain the original content
|
14
|
+
- Fix missing regex for translator for en language
|
15
|
+
- Move fixture to the right file
|
16
|
+
- Update help message in readme
|
17
|
+
- Update installation step using `uv` tool
|
18
|
+
- Update project classifier keywords
|
19
|
+
|
20
|
+
## v0.1.145 (2025-06-22)
|
21
|
+
|
22
|
+
- Bump deps and `pre-commit` hooks
|
23
|
+
- Clear previous release builds before releasing
|
24
|
+
- Remove other lint tools from `pre-commit`
|
25
|
+
- Update translations
|
26
|
+
|
10
27
|
## v0.1.144 (2025-06-15)
|
11
28
|
|
12
29
|
- Bump deps
|
@@ -1,13 +1,13 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: txt2ebook
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.146
|
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
|
7
7
|
Author-email: Kian-Meng Ang <kianmeng@cpan.org>
|
8
8
|
License-Expression: AGPL-3.0-or-later
|
9
9
|
License-File: LICENSE.md
|
10
|
-
Keywords: cjk,ebook,epub,txt
|
10
|
+
Keywords: cjk,ebook,epub,gmi,latex,md,pdf,txt,typst
|
11
11
|
Classifier: Development Status :: 4 - Beta
|
12
12
|
Classifier: Environment :: Console
|
13
13
|
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
|
@@ -50,19 +50,13 @@ A console tool to convert txt file to different ebook formats.
|
|
50
50
|
Stable version From PyPI:
|
51
51
|
|
52
52
|
```console
|
53
|
-
|
53
|
+
uv tool install txt2ebook
|
54
54
|
```
|
55
55
|
|
56
56
|
Upgrade to latest stable version:
|
57
57
|
|
58
58
|
```console
|
59
|
-
|
60
|
-
```
|
61
|
-
|
62
|
-
Latest development version from GitHub:
|
63
|
-
|
64
|
-
```console
|
65
|
-
python3 -m pip install -e git+https://github.com/kianmeng/txt2ebook.git
|
59
|
+
uv tool upgrade txt2ebook
|
66
60
|
```
|
67
61
|
|
68
62
|
## Usage
|
@@ -108,12 +102,12 @@ positional arguments:
|
|
108
102
|
typ
|
109
103
|
generate ebook in Typst format
|
110
104
|
|
111
|
-
|
112
|
-
-of
|
105
|
+
options:
|
106
|
+
-of, --output-folder OUTPUT_FOLDER
|
113
107
|
set default output folder (default: 'output')
|
114
108
|
-p, --purge
|
115
109
|
remove converted ebooks specified by --output-folder option (default: 'False')
|
116
|
-
-l
|
110
|
+
-l, --language LANGUAGE
|
117
111
|
language of the ebook (default: 'None')
|
118
112
|
-rw, --raise-on-warning
|
119
113
|
raise exception and stop parsing upon warning
|
@@ -7,19 +7,13 @@ A console tool to convert txt file to different ebook formats.
|
|
7
7
|
Stable version From PyPI:
|
8
8
|
|
9
9
|
```console
|
10
|
-
|
10
|
+
uv tool install txt2ebook
|
11
11
|
```
|
12
12
|
|
13
13
|
Upgrade to latest stable version:
|
14
14
|
|
15
15
|
```console
|
16
|
-
|
17
|
-
```
|
18
|
-
|
19
|
-
Latest development version from GitHub:
|
20
|
-
|
21
|
-
```console
|
22
|
-
python3 -m pip install -e git+https://github.com/kianmeng/txt2ebook.git
|
16
|
+
uv tool upgrade txt2ebook
|
23
17
|
```
|
24
18
|
|
25
19
|
## Usage
|
@@ -65,12 +59,12 @@ positional arguments:
|
|
65
59
|
typ
|
66
60
|
generate ebook in Typst format
|
67
61
|
|
68
|
-
|
69
|
-
-of
|
62
|
+
options:
|
63
|
+
-of, --output-folder OUTPUT_FOLDER
|
70
64
|
set default output folder (default: 'output')
|
71
65
|
-p, --purge
|
72
66
|
remove converted ebooks specified by --output-folder option (default: 'False')
|
73
|
-
-l
|
67
|
+
-l, --language LANGUAGE
|
74
68
|
language of the ebook (default: 'None')
|
75
69
|
-rw, --raise-on-warning
|
76
70
|
raise exception and stop parsing upon warning
|
@@ -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
|
@@ -211,6 +213,8 @@ def release(session: nox.Session) -> None:
|
|
211
213
|
|
212
214
|
prompt = "Build and publish package to pypi? (y/n): "
|
213
215
|
if input(prompt).lower() in ["y", "yes"]:
|
216
|
+
dist_dir = os.path.join(os.getcwd(), "dist")
|
217
|
+
shutil.rmtree(dist_dir)
|
214
218
|
session.run("uv", "build")
|
215
219
|
session.run("uv", "publish")
|
216
220
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "txt2ebook"
|
3
|
-
version = "0.1.
|
3
|
+
version = "0.1.146"
|
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"
|
@@ -10,7 +10,12 @@ keywords = [
|
|
10
10
|
"cjk",
|
11
11
|
"ebook",
|
12
12
|
"epub",
|
13
|
+
"gmi",
|
14
|
+
"latex",
|
15
|
+
"md",
|
16
|
+
"pdf",
|
13
17
|
"txt",
|
18
|
+
"typst",
|
14
19
|
]
|
15
20
|
classifiers = [
|
16
21
|
"Development Status :: 4 - Beta",
|
@@ -17,7 +17,8 @@
|
|
17
17
|
|
18
18
|
DEFAULT_RE_TITLE = r"Title:(.*)"
|
19
19
|
DEFAULT_RE_AUTHOR = r"Author:(.*)"
|
20
|
-
DEFAULT_RE_TAG = r"Tags
|
21
|
-
DEFAULT_RE_INDEX = r"Index
|
20
|
+
DEFAULT_RE_TAG = r"Tags:(.*)"
|
21
|
+
DEFAULT_RE_INDEX = r"Index:(.*)"
|
22
22
|
DEFAULT_RE_VOLUME = r"(Volume.*)"
|
23
23
|
DEFAULT_RE_CHAPTER = r"(Chapter.*)"
|
24
|
+
DEFAULT_RE_TRANSLATOR = r"Translator:(.*)"
|
@@ -1,26 +1,26 @@
|
|
1
|
-
#: src/txt2ebook/formats/base.py:
|
1
|
+
#: src/txt2ebook/formats/base.py:137
|
2
2
|
msgid "title:"
|
3
3
|
msgstr "Title:"
|
4
4
|
|
5
|
-
#: src/txt2ebook/formats/base.py:
|
5
|
+
#: src/txt2ebook/formats/base.py:138
|
6
6
|
msgid "author:"
|
7
7
|
msgstr "Author:"
|
8
8
|
|
9
|
-
#: src/txt2ebook/formats/base.py:
|
9
|
+
#: src/txt2ebook/formats/base.py:139
|
10
10
|
msgid "translator:"
|
11
11
|
msgstr "Translator:"
|
12
12
|
|
13
|
-
#: src/txt2ebook/formats/base.py:
|
13
|
+
#: src/txt2ebook/formats/base.py:140
|
14
14
|
msgid "tag:"
|
15
15
|
msgstr "Tag:"
|
16
16
|
|
17
|
-
#: src/txt2ebook/formats/base.py:
|
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:
|
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:
|
1
|
+
#: src/txt2ebook/formats/base.py:137
|
2
2
|
msgid "title:"
|
3
3
|
msgstr ""
|
4
4
|
|
5
|
-
#: src/txt2ebook/formats/base.py:
|
5
|
+
#: src/txt2ebook/formats/base.py:138
|
6
6
|
msgid "author:"
|
7
7
|
msgstr ""
|
8
8
|
|
9
|
-
#: src/txt2ebook/formats/base.py:
|
9
|
+
#: src/txt2ebook/formats/base.py:139
|
10
10
|
msgid "translator:"
|
11
11
|
msgstr ""
|
12
12
|
|
13
|
-
#: src/txt2ebook/formats/base.py:
|
13
|
+
#: src/txt2ebook/formats/base.py:140
|
14
14
|
msgid "tag:"
|
15
15
|
msgstr ""
|
16
16
|
|
17
|
-
#: src/txt2ebook/formats/base.py:
|
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:
|
23
|
+
#: src/txt2ebook/formats/epub.py:141
|
24
24
|
msgid "cover"
|
25
25
|
msgstr ""
|
26
26
|
|
{txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.po
RENAMED
@@ -1,26 +1,26 @@
|
|
1
|
-
#: src/txt2ebook/formats/base.py:
|
1
|
+
#: src/txt2ebook/formats/base.py:137
|
2
2
|
msgid "title:"
|
3
3
|
msgstr "书名:"
|
4
4
|
|
5
|
-
#: src/txt2ebook/formats/base.py:
|
5
|
+
#: src/txt2ebook/formats/base.py:138
|
6
6
|
msgid "author:"
|
7
7
|
msgstr "作者:"
|
8
8
|
|
9
|
-
#: src/txt2ebook/formats/base.py:
|
9
|
+
#: src/txt2ebook/formats/base.py:139
|
10
10
|
msgid "translator:"
|
11
11
|
msgstr "翻译:"
|
12
12
|
|
13
|
-
#: src/txt2ebook/formats/base.py:
|
13
|
+
#: src/txt2ebook/formats/base.py:140
|
14
14
|
msgid "tag:"
|
15
15
|
msgstr "票签:"
|
16
16
|
|
17
|
-
#: src/txt2ebook/formats/base.py:
|
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:
|
23
|
+
#: src/txt2ebook/formats/epub.py:141
|
24
24
|
msgid "cover"
|
25
25
|
msgstr "封面"
|
26
26
|
|
{txt2ebook-0.1.144 → txt2ebook-0.1.146}/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.po
RENAMED
@@ -1,26 +1,26 @@
|
|
1
|
-
#: src/txt2ebook/formats/base.py:
|
1
|
+
#: src/txt2ebook/formats/base.py:137
|
2
2
|
msgid "title:"
|
3
3
|
msgstr "书名:"
|
4
4
|
|
5
|
-
#: src/txt2ebook/formats/base.py:
|
5
|
+
#: src/txt2ebook/formats/base.py:138
|
6
6
|
msgid "author:"
|
7
7
|
msgstr "作者:"
|
8
8
|
|
9
|
-
#: src/txt2ebook/formats/base.py:
|
9
|
+
#: src/txt2ebook/formats/base.py:139
|
10
10
|
msgid "translator:"
|
11
11
|
msgstr "翻译:"
|
12
12
|
|
13
|
-
#: src/txt2ebook/formats/base.py:
|
13
|
+
#: src/txt2ebook/formats/base.py:140
|
14
14
|
msgid "tag:"
|
15
15
|
msgstr "标签:"
|
16
16
|
|
17
|
-
#: src/txt2ebook/formats/base.py:
|
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:
|
23
|
+
#: src/txt2ebook/formats/epub.py:141
|
24
24
|
msgid "cover"
|
25
25
|
msgstr "封面"
|
26
26
|
|
@@ -19,6 +19,7 @@ import argparse
|
|
19
19
|
import logging
|
20
20
|
import sys
|
21
21
|
from importlib import import_module
|
22
|
+
from pathlib import Path
|
22
23
|
|
23
24
|
import cjkwrap
|
24
25
|
import regex as re
|
@@ -201,21 +202,48 @@ def run(args: argparse.Namespace) -> None:
|
|
201
202
|
None
|
202
203
|
"""
|
203
204
|
massaged_txt = massage_txt(args)
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
205
|
+
if args.overwrite:
|
206
|
+
_overwrite_file(args, massaged_txt)
|
207
|
+
else:
|
208
|
+
_new_file(args, massaged_txt)
|
209
|
+
|
210
|
+
# args.language = detect_and_expect_language(massaged_txt, args.language)
|
211
|
+
# config_lang = args.language.replace("-", "_")
|
212
|
+
# langconf = import_module(f"txt2ebook.languages.{config_lang}")
|
213
|
+
# args.with_toc = False
|
214
|
+
# parser = Parser(massaged_txt, args, langconf)
|
215
|
+
# book = parser.parse()
|
216
|
+
|
217
|
+
# if args.debug:
|
218
|
+
# book.debug(args.verbose)
|
219
|
+
|
220
|
+
# if args.header_number:
|
221
|
+
# book = header_number(args, book)
|
222
|
+
|
223
|
+
# writer = TxtWriter(book, args)
|
224
|
+
# writer.write()
|
210
225
|
|
211
|
-
if args.debug:
|
212
|
-
book.debug(args.verbose)
|
213
226
|
|
214
|
-
|
215
|
-
|
227
|
+
def _overwrite_file(args, massaged_txt) -> None:
|
228
|
+
txt_filename = Path(args.input_file.name)
|
229
|
+
|
230
|
+
with open(txt_filename, "w", encoding="utf8") as file:
|
231
|
+
file.write(massaged_txt)
|
232
|
+
logger.info("Overwrite txt file: %s", txt_filename.resolve())
|
233
|
+
|
234
|
+
|
235
|
+
def _new_file(args, massaged_txt) -> None:
|
236
|
+
txt_filename = Path(args.input_file.name)
|
237
|
+
export_filename = Path(
|
238
|
+
txt_filename.resolve().parent.joinpath(
|
239
|
+
args.output_folder, txt_filename.name
|
240
|
+
)
|
241
|
+
)
|
242
|
+
export_filename.parent.mkdir(parents=True, exist_ok=True)
|
216
243
|
|
217
|
-
|
218
|
-
|
244
|
+
with open(export_filename, "w", encoding="utf8") as file:
|
245
|
+
file.write(massaged_txt)
|
246
|
+
logger.info("New txt file: %s", export_filename.resolve())
|
219
247
|
|
220
248
|
|
221
249
|
def header_number(args: argparse.Namespace, book: Book) -> Book:
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# pylint: disable=C0114,C0116,W0621
|
2
2
|
|
3
|
+
import argparse
|
3
4
|
import os
|
4
5
|
from pathlib import Path
|
5
6
|
from shutil import copyfile
|
@@ -55,3 +56,27 @@ def fixture_outfile(tmpdir):
|
|
55
56
|
return Path(tmpdir, filename)
|
56
57
|
|
57
58
|
return outfile
|
59
|
+
|
60
|
+
|
61
|
+
@pytest.fixture(name="config")
|
62
|
+
def fixture_config():
|
63
|
+
return argparse.Namespace(
|
64
|
+
**{
|
65
|
+
"title": False,
|
66
|
+
"author": False,
|
67
|
+
"cover": None,
|
68
|
+
"paragraph_separator": "\n\n",
|
69
|
+
"re_delete": False,
|
70
|
+
"re_replace": False,
|
71
|
+
"re_delete_line": False,
|
72
|
+
"re_volume_chapter": (),
|
73
|
+
"re_volume": (),
|
74
|
+
"re_chapter": (),
|
75
|
+
"re_title": (),
|
76
|
+
"re_author": (),
|
77
|
+
"no_wrapping": False,
|
78
|
+
"raise_on_warning": False,
|
79
|
+
"width": False,
|
80
|
+
"language": "zh-cn",
|
81
|
+
}
|
82
|
+
)
|