txt2ebook 0.1.25__py3-none-any.whl → 0.1.26__py3-none-any.whl
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.
- CHANGELOG.md +13 -0
- CONTRIBUTING.md +7 -1
- txt2ebook/__init__.py +1 -1
- txt2ebook/locales/en/LC_MESSAGES/txt2ebook.po +6 -6
- txt2ebook/locales/txt2ebook.pot +6 -6
- txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.po +6 -6
- txt2ebook/txt2ebook.py +0 -1
- txt2ebook/zh_utils.py +12 -2
- {txt2ebook-0.1.25.dist-info → txt2ebook-0.1.26.dist-info}/METADATA +5 -4
- {txt2ebook-0.1.25.dist-info → txt2ebook-0.1.26.dist-info}/RECORD +15 -15
- /txt2ebook/formats/templates/epub/{clean_no_paragraph_space.css → condense.css} +0 -0
- /txt2ebook/formats/templates/epub/{clean_no_indent.css → noindent.css} +0 -0
- {txt2ebook-0.1.25.dist-info → txt2ebook-0.1.26.dist-info}/LICENSE.md +0 -0
- {txt2ebook-0.1.25.dist-info → txt2ebook-0.1.26.dist-info}/WHEEL +0 -0
- {txt2ebook-0.1.25.dist-info → txt2ebook-0.1.26.dist-info}/entry_points.txt +0 -0
CHANGELOG.md
CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [0-based versioning](https://0ver.org/).
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## v0.1.26 - 2023-03-12
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
|
14
|
+
- Rename epub template names, `clean_no_indent` to `noindent`, and
|
15
|
+
`clean_no_paragraph_space` to `condense`
|
16
|
+
- Raise warnings for invalid prepend length for `zh_words_to_numbers` function
|
17
|
+
|
18
|
+
### Fixed
|
19
|
+
|
20
|
+
- Fix missing translations
|
21
|
+
- Fix missing EPUB template names not showing in help message
|
22
|
+
|
10
23
|
## v0.1.25 - 2023-03-05
|
11
24
|
|
12
25
|
### Added
|
CONTRIBUTING.md
CHANGED
@@ -53,11 +53,17 @@ tox -e py37,py38,py39,py310,py311 -- tests/test_tokenizer.py
|
|
53
53
|
For code lint, we're using `pre-commit`:
|
54
54
|
|
55
55
|
```bash
|
56
|
-
pre-commit install
|
56
|
+
pre-commit install # run once
|
57
57
|
pre-commit clean
|
58
58
|
pre-commit run --all-files
|
59
59
|
```
|
60
60
|
|
61
|
+
Or specific hook:
|
62
|
+
|
63
|
+
```bash
|
64
|
+
pre-commit run pylint -a
|
65
|
+
```
|
66
|
+
|
61
67
|
We're using zero-based versioning.
|
62
68
|
|
63
69
|
For patches or bug fixes:
|
txt2ebook/__init__.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
msgid ""
|
6
6
|
msgstr ""
|
7
7
|
"Project-Id-Version: PACKAGE VERSION\n"
|
8
|
-
"POT-Creation-Date: 2023-
|
8
|
+
"POT-Creation-Date: 2023-03-06 04:02+0800\n"
|
9
9
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
10
10
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
11
11
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
@@ -15,22 +15,22 @@ msgstr ""
|
|
15
15
|
"Content-Transfer-Encoding: 8bit\n"
|
16
16
|
"Generated-By: pygettext.py 1.5\n"
|
17
17
|
|
18
|
-
#: src/txt2ebook/formats/epub.py:
|
18
|
+
#: src/txt2ebook/formats/epub.py:199
|
19
19
|
msgid "cover"
|
20
20
|
msgstr "Cover"
|
21
21
|
|
22
|
-
#: src/txt2ebook/formats/txt.py:
|
22
|
+
#: src/txt2ebook/formats/txt.py:84
|
23
23
|
msgid "metadata"
|
24
24
|
msgstr "metadata"
|
25
25
|
|
26
|
-
#: src/txt2ebook/formats/txt.py:
|
26
|
+
#: src/txt2ebook/formats/txt.py:154
|
27
27
|
msgid "title:"
|
28
28
|
msgstr "Title:"
|
29
29
|
|
30
|
-
#: src/txt2ebook/formats/txt.py:
|
30
|
+
#: src/txt2ebook/formats/txt.py:155
|
31
31
|
msgid "author:"
|
32
32
|
msgstr "Author:"
|
33
33
|
|
34
|
-
#: src/txt2ebook/formats/txt.py:
|
34
|
+
#: src/txt2ebook/formats/txt.py:156
|
35
35
|
msgid "tag:"
|
36
36
|
msgstr "Tag:"
|
txt2ebook/locales/txt2ebook.pot
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
msgid ""
|
6
6
|
msgstr ""
|
7
7
|
"Project-Id-Version: PACKAGE VERSION\n"
|
8
|
-
"POT-Creation-Date: 2023-
|
8
|
+
"POT-Creation-Date: 2023-03-06 04:02+0800\n"
|
9
9
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
10
10
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
11
11
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
@@ -15,23 +15,23 @@ msgstr ""
|
|
15
15
|
"Generated-By: pygettext.py 1.5\n"
|
16
16
|
|
17
17
|
|
18
|
-
#: src/txt2ebook/formats/epub.py:
|
18
|
+
#: src/txt2ebook/formats/epub.py:199
|
19
19
|
msgid "cover"
|
20
20
|
msgstr ""
|
21
21
|
|
22
|
-
#: src/txt2ebook/formats/txt.py:
|
22
|
+
#: src/txt2ebook/formats/txt.py:84
|
23
23
|
msgid "metadata"
|
24
24
|
msgstr ""
|
25
25
|
|
26
|
-
#: src/txt2ebook/formats/txt.py:
|
26
|
+
#: src/txt2ebook/formats/txt.py:154
|
27
27
|
msgid "title:"
|
28
28
|
msgstr ""
|
29
29
|
|
30
|
-
#: src/txt2ebook/formats/txt.py:
|
30
|
+
#: src/txt2ebook/formats/txt.py:155
|
31
31
|
msgid "author:"
|
32
32
|
msgstr ""
|
33
33
|
|
34
|
-
#: src/txt2ebook/formats/txt.py:
|
34
|
+
#: src/txt2ebook/formats/txt.py:156
|
35
35
|
msgid "tag:"
|
36
36
|
msgstr ""
|
37
37
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
msgid ""
|
6
6
|
msgstr ""
|
7
7
|
"Project-Id-Version: \n"
|
8
|
-
"POT-Creation-Date: 2023-
|
8
|
+
"POT-Creation-Date: 2023-03-06 04:02+0800\n"
|
9
9
|
"PO-Revision-Date: 2023-01-14 18:07+0800\n"
|
10
10
|
"Last-Translator: \n"
|
11
11
|
"Language-Team: \n"
|
@@ -16,22 +16,22 @@ msgstr ""
|
|
16
16
|
"Generated-By: pygettext.py 1.5\n"
|
17
17
|
"X-Generator: Poedit 3.1.1\n"
|
18
18
|
|
19
|
-
#: src/txt2ebook/formats/epub.py:
|
19
|
+
#: src/txt2ebook/formats/epub.py:199
|
20
20
|
msgid "cover"
|
21
21
|
msgstr "封面"
|
22
22
|
|
23
|
-
#: src/txt2ebook/formats/txt.py:
|
23
|
+
#: src/txt2ebook/formats/txt.py:84
|
24
24
|
msgid "metadata"
|
25
25
|
msgstr "元数据"
|
26
26
|
|
27
|
-
#: src/txt2ebook/formats/txt.py:
|
27
|
+
#: src/txt2ebook/formats/txt.py:154
|
28
28
|
msgid "title:"
|
29
29
|
msgstr "书名:"
|
30
30
|
|
31
|
-
#: src/txt2ebook/formats/txt.py:
|
31
|
+
#: src/txt2ebook/formats/txt.py:155
|
32
32
|
msgid "author:"
|
33
33
|
msgstr "作者:"
|
34
34
|
|
35
|
-
#: src/txt2ebook/formats/txt.py:
|
35
|
+
#: src/txt2ebook/formats/txt.py:156
|
36
36
|
msgid "tag:"
|
37
37
|
msgstr "票签:"
|
txt2ebook/txt2ebook.py
CHANGED
txt2ebook/zh_utils.py
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
"""String helper functions for handling zh related text."""
|
17
17
|
|
18
18
|
import re
|
19
|
+
import warnings
|
19
20
|
from typing import Any
|
20
21
|
from unicodedata import numeric
|
21
22
|
|
@@ -131,9 +132,18 @@ def zh_words_to_numbers(words: str, length: int = 0) -> str:
|
|
131
132
|
header_nums += int(zh_numeric(word_grp))
|
132
133
|
|
133
134
|
padded_header_nums = str(header_nums)
|
134
|
-
|
135
|
+
|
135
136
|
if length > 0:
|
136
|
-
|
137
|
+
word_length = len(padded_header_nums)
|
138
|
+
if word_length < length:
|
139
|
+
padded_header_nums = padded_header_nums.rjust(length, "0")
|
140
|
+
else:
|
141
|
+
warnings.warn(
|
142
|
+
(
|
143
|
+
"prepend zero length less than word length, "
|
144
|
+
f"word length: {word_length}, prepend length: {length}"
|
145
|
+
)
|
146
|
+
)
|
137
147
|
|
138
148
|
replaced_words = words.replace(header_words, padded_header_nums)
|
139
149
|
return replaced_words
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: txt2ebook
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.26
|
4
4
|
Summary: CLI tool to convert txt file to ebook format
|
5
5
|
Home-page: https://github.com/kianmeng/txt2ebook
|
6
6
|
License: AGPL-3.0-or-later
|
@@ -66,8 +66,9 @@ txt2ebook --help
|
|
66
66
|
usage: txt2ebook [-f {epub,txt}] [-t TITLE] [-l LANGUAGE] [-a AUTHOR]
|
67
67
|
[-c IMAGE_FILENAME] [-w WIDTH] [-ps SEPARATOR] [-rd REGEX]
|
68
68
|
[-rvc REGEX] [-rv REGEX] [-rc REGEX] [-rt REGEX] [-ra REGEX]
|
69
|
-
[-rl REGEX] [-rr REGEX REGEX] [-et
|
70
|
-
[-sp] [-hn] [-fw] [-rw] [-ob] [-ow] [-v] [-d]
|
69
|
+
[-rl REGEX] [-rr REGEX REGEX] [-et {clean,noindent,condense}]
|
70
|
+
[-vp] [-tp] [-sp] [-hn] [-fw] [-rw] [-ob] [-ow] [-v] [-d]
|
71
|
+
[-h] [-V]
|
71
72
|
TXT_FILENAME [EBOOK_FILENAME]
|
72
73
|
|
73
74
|
txt2ebook/tte is a cli tool to convert txt file to ebook format.
|
@@ -111,7 +112,7 @@ optional arguments:
|
|
111
112
|
regex to delete whole line (default: '[]')
|
112
113
|
-rr REGEX REGEX, --regex-replace REGEX REGEX
|
113
114
|
regex to search and replace (default: '[]')
|
114
|
-
-et
|
115
|
+
-et {clean,noindent,condense}, --epub-template {clean,noindent,condense}
|
115
116
|
CSS template for epub ebook (default: 'clean')
|
116
117
|
-vp, --volume-page
|
117
118
|
generate each volume as separate page (only 'epub' format)
|
@@ -1,7 +1,7 @@
|
|
1
|
-
CHANGELOG.md,sha256=
|
2
|
-
CONTRIBUTING.md,sha256=
|
1
|
+
CHANGELOG.md,sha256=LaLINjcPErTzsFwx4fZrHrO4oQYV7RyJ1B_EnwPf-A8,13434
|
2
|
+
CONTRIBUTING.md,sha256=DZ3pLVwymnPhcMNY6F2lIPmOnHsNFItOHy7zWlhp2n0,1408
|
3
3
|
LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
4
|
-
txt2ebook/__init__.py,sha256=
|
4
|
+
txt2ebook/__init__.py,sha256=CYBYlRWiEeUCAWfrP4gaWtk5eDG9yfkJp3-BFgkrNfA,1646
|
5
5
|
txt2ebook/__main__.py,sha256=69yaheH-Fv2VIPS0T9kiVmiMluSgLGvwo1fa7badX2I,845
|
6
6
|
txt2ebook/exceptions.py,sha256=Y6rqjXhiKIxNeKWVqvAqsUAOaBFKxlUE5Tm5EBcoi9w,837
|
7
7
|
txt2ebook/formats/__init__.py,sha256=z24b6RWphrEVGC-ISw3KHxgkh7ZTsHEQRP_s86kvh4c,1897
|
@@ -9,8 +9,8 @@ txt2ebook/formats/epub.py,sha256=iXhq3EWT0NxMTiZJuZs2UbYAJBftUXK75f5DlLsq6mY,850
|
|
9
9
|
txt2ebook/formats/templates/__init__.py,sha256=0Hhm7Dayb7eB9h2cFo2103H4Tr6ie0ySMZ5gR01q6ag,750
|
10
10
|
txt2ebook/formats/templates/epub/__init__.py,sha256=O2sdWRhkuamReBR20WedGWosLp8Dt8NZ33aXzyNQuLQ,756
|
11
11
|
txt2ebook/formats/templates/epub/clean.css,sha256=AnEwMckzUSKcjKsDiWtJW1oaceuklt2tyuS1VbpVK1s,462
|
12
|
-
txt2ebook/formats/templates/epub/
|
13
|
-
txt2ebook/formats/templates/epub/
|
12
|
+
txt2ebook/formats/templates/epub/condense.css,sha256=Fz80ZqkPsFRmGdURduAxqMV8drD0CCUlrv41P8rUsm8,477
|
13
|
+
txt2ebook/formats/templates/epub/noindent.css,sha256=_O5Tv90TKyyPBRdgjuNKFwtKFbdheh2V9PtDhgRUg3U,483
|
14
14
|
txt2ebook/formats/txt.py,sha256=Efb_zU3oMJ4OyVOTrmwMEnmFH8INZxiM3adzAqVH6Vo,6844
|
15
15
|
txt2ebook/helpers/__init__.py,sha256=UNFxeTg1tZ81DMk7_JsfhtW0zDsQH29hkYkqKrsYUQ0,1722
|
16
16
|
txt2ebook/languages/__init__.py,sha256=-c9-YQEkXnb9LKLoi7EtNlQLAw2SqDKVw2UXlWt9Dl0,753
|
@@ -18,20 +18,20 @@ txt2ebook/languages/en.py,sha256=xCIhL431eUgoGwci4LCBkso8bR2LBhxKqWCPczKKoJQ,915
|
|
18
18
|
txt2ebook/languages/zh_cn.py,sha256=UVTkxNmhZL5d6Ui53UfJ0jgwtnZmfjwbN4axLQZXkMY,1699
|
19
19
|
txt2ebook/languages/zh_tw.py,sha256=D_YVDNj4uik8rAkgtiEashaONRjLqAkBh6kvAqozttk,1227
|
20
20
|
txt2ebook/locales/en/LC_MESSAGES/txt2ebook.mo,sha256=rMcL7tj29bvbTMqDJOuw27U8TmTlX1FP4GVNmec36SU,527
|
21
|
-
txt2ebook/locales/en/LC_MESSAGES/txt2ebook.po,sha256=
|
22
|
-
txt2ebook/locales/txt2ebook.pot,sha256=
|
21
|
+
txt2ebook/locales/en/LC_MESSAGES/txt2ebook.po,sha256=8naBQ3LMFfziTOdLvZfKk0066HuRCu20aUC4lqhJoFQ,827
|
22
|
+
txt2ebook/locales/txt2ebook.pot,sha256=uTzyQa-N4kdng9DHXkcMXmr4Mf5S1CC4T9PbwNxltDc,784
|
23
23
|
txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.mo,sha256=OkYKLhkYjqfdt2DbF3-TaCodD8BDh3hmOZuEn0FLja0,507
|
24
|
-
txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.po,sha256=
|
24
|
+
txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.po,sha256=9V5RBklXlDpn_wxZUm1eVeEGGpKnewjWzESoxjeO5No,811
|
25
25
|
txt2ebook/models/__init__.py,sha256=oHf4YvkEV7qKHhHiGxl4m95DSJ3zSIW2uJQec-BwXrc,920
|
26
26
|
txt2ebook/models/book.py,sha256=hDOtA2ppBPIQqMrlQdmx55CE7eKP_e0JthpfUxaWdew,2216
|
27
27
|
txt2ebook/models/chapter.py,sha256=PhPHraG3QNgY4C-USAzTDpDPVNsvTL8yC3r2iTW42KU,1676
|
28
28
|
txt2ebook/models/volume.py,sha256=4n6a9cF69NTcOmWTxT1sVm-Bjvf-fagJ2E8thVX4uzg,1587
|
29
29
|
txt2ebook/parser.py,sha256=a7b7uB7zC5lFgTihz07qNWMyOU-_0ZL1tpfaf_IQFDE,11922
|
30
30
|
txt2ebook/tokenizer.py,sha256=lsgGZSVpKl5fC6eEf8eIrGKZIVQnLqKM1Kenn4xJ-u4,9263
|
31
|
-
txt2ebook/txt2ebook.py,sha256=
|
32
|
-
txt2ebook/zh_utils.py,sha256=
|
33
|
-
txt2ebook-0.1.
|
34
|
-
txt2ebook-0.1.
|
35
|
-
txt2ebook-0.1.
|
36
|
-
txt2ebook-0.1.
|
37
|
-
txt2ebook-0.1.
|
31
|
+
txt2ebook/txt2ebook.py,sha256=LJD-7mmnonSVo4yZXJFda3mnrY95zpk5onO8_34wQkQ,10704
|
32
|
+
txt2ebook/zh_utils.py,sha256=AAkvL2O8WRpm6ftZuZZ5nyWCn3h4kjImJouJFEig_C0,4588
|
33
|
+
txt2ebook-0.1.26.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
34
|
+
txt2ebook-0.1.26.dist-info/entry_points.txt,sha256=IQHyIIhd0MHjSSRVC1a6tMeIoLus8D06KHL_cumvEbg,83
|
35
|
+
txt2ebook-0.1.26.dist-info/WHEEL,sha256=vVCvjcmxuUltf8cYhJ0sJMRDLr1XsPuxEId8YDzbyCY,88
|
36
|
+
txt2ebook-0.1.26.dist-info/METADATA,sha256=ZDlrXQPVHgGjvHNXhi2RlVUG17UmNj8x5SY8sc94WNg,6023
|
37
|
+
txt2ebook-0.1.26.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|