txt2ebook 0.1.25__tar.gz → 0.1.26__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 (37) hide show
  1. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/CHANGELOG.md +13 -0
  2. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/CONTRIBUTING.md +7 -1
  3. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/PKG-INFO +5 -4
  4. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/README.md +4 -3
  5. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/pyproject.toml +1 -1
  6. txt2ebook-0.1.26/setup.py +59 -0
  7. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/__init__.py +1 -1
  8. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.po +6 -6
  9. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/locales/txt2ebook.pot +6 -6
  10. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.po +6 -6
  11. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/txt2ebook.py +0 -1
  12. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/zh_utils.py +12 -2
  13. txt2ebook-0.1.25/setup.py +0 -59
  14. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/LICENSE.md +0 -0
  15. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/__main__.py +0 -0
  16. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/exceptions.py +0 -0
  17. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/formats/__init__.py +0 -0
  18. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/formats/epub.py +0 -0
  19. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/formats/templates/__init__.py +0 -0
  20. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/formats/templates/epub/__init__.py +0 -0
  21. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/formats/templates/epub/clean.css +0 -0
  22. /txt2ebook-0.1.25/src/txt2ebook/formats/templates/epub/clean_no_paragraph_space.css → /txt2ebook-0.1.26/src/txt2ebook/formats/templates/epub/condense.css +0 -0
  23. /txt2ebook-0.1.25/src/txt2ebook/formats/templates/epub/clean_no_indent.css → /txt2ebook-0.1.26/src/txt2ebook/formats/templates/epub/noindent.css +0 -0
  24. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/formats/txt.py +0 -0
  25. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/helpers/__init__.py +0 -0
  26. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/languages/__init__.py +0 -0
  27. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/languages/en.py +0 -0
  28. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/languages/zh_cn.py +0 -0
  29. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/languages/zh_tw.py +0 -0
  30. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.mo +0 -0
  31. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.mo +0 -0
  32. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/models/__init__.py +0 -0
  33. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/models/book.py +0 -0
  34. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/models/chapter.py +0 -0
  35. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/models/volume.py +0 -0
  36. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/parser.py +0 -0
  37. {txt2ebook-0.1.25 → txt2ebook-0.1.26}/src/txt2ebook/tokenizer.py +0 -0
@@ -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
@@ -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:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: txt2ebook
3
- Version: 0.1.25
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 TEMPLATE] [-vp] [-tp]
70
- [-sp] [-hn] [-fw] [-rw] [-ob] [-ow] [-v] [-d] [-h] [-V]
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 TEMPLATE, --epub-template TEMPLATE
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)
@@ -28,8 +28,9 @@ txt2ebook --help
28
28
  usage: txt2ebook [-f {epub,txt}] [-t TITLE] [-l LANGUAGE] [-a AUTHOR]
29
29
  [-c IMAGE_FILENAME] [-w WIDTH] [-ps SEPARATOR] [-rd REGEX]
30
30
  [-rvc REGEX] [-rv REGEX] [-rc REGEX] [-rt REGEX] [-ra REGEX]
31
- [-rl REGEX] [-rr REGEX REGEX] [-et TEMPLATE] [-vp] [-tp]
32
- [-sp] [-hn] [-fw] [-rw] [-ob] [-ow] [-v] [-d] [-h] [-V]
31
+ [-rl REGEX] [-rr REGEX REGEX] [-et {clean,noindent,condense}]
32
+ [-vp] [-tp] [-sp] [-hn] [-fw] [-rw] [-ob] [-ow] [-v] [-d]
33
+ [-h] [-V]
33
34
  TXT_FILENAME [EBOOK_FILENAME]
34
35
 
35
36
  txt2ebook/tte is a cli tool to convert txt file to ebook format.
@@ -73,7 +74,7 @@ optional arguments:
73
74
  regex to delete whole line (default: '[]')
74
75
  -rr REGEX REGEX, --regex-replace REGEX REGEX
75
76
  regex to search and replace (default: '[]')
76
- -et TEMPLATE, --epub-template TEMPLATE
77
+ -et {clean,noindent,condense}, --epub-template {clean,noindent,condense}
77
78
  CSS template for epub ebook (default: 'clean')
78
79
  -vp, --volume-page
79
80
  generate each volume as separate page (only 'epub' format)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "txt2ebook"
3
- version = "0.1.25"
3
+ version = "0.1.26"
4
4
  description = "CLI tool to convert txt file to ebook format"
5
5
  authors = ["Kian-Meng Ang <kianmeng@cpan.org>"]
6
6
  license = "AGPL-3.0-or-later"
@@ -0,0 +1,59 @@
1
+ # -*- coding: utf-8 -*-
2
+ from setuptools import setup
3
+
4
+ package_dir = \
5
+ {'': 'src'}
6
+
7
+ packages = \
8
+ ['txt2ebook',
9
+ 'txt2ebook.formats',
10
+ 'txt2ebook.formats.templates',
11
+ 'txt2ebook.formats.templates.epub',
12
+ 'txt2ebook.helpers',
13
+ 'txt2ebook.languages',
14
+ 'txt2ebook.models']
15
+
16
+ package_data = \
17
+ {'': ['*'],
18
+ 'txt2ebook': ['locales/*',
19
+ 'locales/en/LC_MESSAGES/txt2ebook.mo',
20
+ 'locales/en/LC_MESSAGES/txt2ebook.mo',
21
+ 'locales/en/LC_MESSAGES/txt2ebook.po',
22
+ 'locales/en/LC_MESSAGES/txt2ebook.po',
23
+ 'locales/zh-cn/LC_MESSAGES/txt2ebook.mo',
24
+ 'locales/zh-cn/LC_MESSAGES/txt2ebook.mo',
25
+ 'locales/zh-cn/LC_MESSAGES/txt2ebook.po',
26
+ 'locales/zh-cn/LC_MESSAGES/txt2ebook.po']}
27
+
28
+ install_requires = \
29
+ ['CJKwrap>=2.2,<3.0',
30
+ 'EbookLib>=0.17.1,<0.18.0',
31
+ 'bs4>=0.0.1,<0.0.2',
32
+ 'langdetect>=1.0.9,<2.0.0',
33
+ 'regex>=2021.11.10,<2022.0.0',
34
+ 'tox-pyenv>=1.1.0,<2.0.0']
35
+
36
+ entry_points = \
37
+ {'console_scripts': ['tte = txt2ebook.txt2ebook:main',
38
+ 'txt2ebook = txt2ebook.txt2ebook:main']}
39
+
40
+ setup_kwargs = {
41
+ 'name': 'txt2ebook',
42
+ 'version': '0.1.26',
43
+ 'description': 'CLI tool to convert txt file to ebook format',
44
+ 'long_description': "# txt2ebook\n\nConsole tool to convert txt file to different ebook format.\n\n## Installation\n\nStable version From PyPI:\n\n```console\npython3 -m pip install txt2ebook\n```\n\nLatest development version from GitHub:\n\n```console\npython3 -m pip install -e git+https://github.com/kianmeng/txt2ebook.git\n```\n\n## Usage\n\nShowing help message of command-line options:\n\n```console\ntxt2ebook --help\n```\n\n```console\nusage: txt2ebook [-f {epub,txt}] [-t TITLE] [-l LANGUAGE] [-a AUTHOR]\n [-c IMAGE_FILENAME] [-w WIDTH] [-ps SEPARATOR] [-rd REGEX]\n [-rvc REGEX] [-rv REGEX] [-rc REGEX] [-rt REGEX] [-ra REGEX]\n [-rl REGEX] [-rr REGEX REGEX] [-et {clean,noindent,condense}]\n [-vp] [-tp] [-sp] [-hn] [-fw] [-rw] [-ob] [-ow] [-v] [-d]\n [-h] [-V]\n TXT_FILENAME [EBOOK_FILENAME]\n\ntxt2ebook/tte is a cli tool to convert txt file to ebook format.\n website: https://github.com/kianmeng/txt2ebook\n issues: https://github.com/kianmeng/txt2ebook/issues\n\npositional arguments:\n TXT_FILENAME\n source text filename\n EBOOK_FILENAME\n converted ebook filename (default: 'TXT_FILENAME.{epub,txt}')\n\noptional arguments:\n -f {epub,txt}, --format {epub,txt}\n ebook format (default: '['epub', 'txt']')\n -t TITLE, --title TITLE\n title of the ebook (default: 'None')\n -l LANGUAGE, --language LANGUAGE\n language of the ebook (default: 'None')\n -a AUTHOR, --author AUTHOR\n author of the ebook (default: '[]')\n -c IMAGE_FILENAME, --cover IMAGE_FILENAME\n cover of the ebook\n -w WIDTH, --width WIDTH\n width for line wrapping\n -ps SEPARATOR, --paragraph_separator SEPARATOR\n paragraph separator (default: '\\n\\n')\n -rd REGEX, --regex-delete REGEX\n regex to delete word or phrase (default: '[]')\n -rvc REGEX, --regex-volume-chapter REGEX\n regex to parse volume and chapter header (default: by LANGUAGE)\n -rv REGEX, --regex-volume REGEX\n regex to parse volume header (default: by LANGUAGE)\n -rc REGEX, --regex-chapter REGEX\n regex to parse chapter header (default: by LANGUAGE)\n -rt REGEX, --regex-title REGEX\n regex to parse title of the book (default: by LANGUAGE)\n -ra REGEX, --regex-author REGEX\n regex to parse author of the book (default: by LANGUAGE)\n -rl REGEX, --regex-delete-line REGEX\n regex to delete whole line (default: '[]')\n -rr REGEX REGEX, --regex-replace REGEX REGEX\n regex to search and replace (default: '[]')\n -et {clean,noindent,condense}, --epub-template {clean,noindent,condense}\n CSS template for epub ebook (default: 'clean')\n -vp, --volume-page\n generate each volume as separate page (only 'epub' format)\n -tp, --test-parsing\n test parsing for volume/chapter header\n -sp, --split-volume-and-chapter\n Split volume or chapter into separate file (only 'txt' format).\n Both --overwrite-backup and --overwrite option will be ignore.\n -hn, --header-number\n convert section header from words to numbers (only 'zh-cn/zh-tw' language)\n -fw, --fullwidth\n convert ASCII character from halfwidth to fullwidth (only 'zh-cn/zh-tw' language)\n -rw, --raise-on-warning\n raise exception and stop parsing upon warning\n -ob, --overwrite-backup\n overwrite massaged and backup original TXT_FILENAME\n -ow, --overwrite\n overwrite massaged TXT_FILENAME\n -v, --verbose\n show verbosity of debugging log, use -vv, -vvv for more details\n -d, --debug\n show debugging log and stacktrace\n -h, --help\n show this help message and exit\n -V, --version\n show program's version number and exit\n```\n\nConvert a txt file into epub:\n\n```console\ntxt2book ebook.txt\n```\n\n## Copyright and License\n\nCopyright (c) 2021,2022,2023 Kian-Meng Ang\n\nThis program is free software: you can redistribute it and/or modify it under\nthe terms of the GNU Affero General Public License as published by the Free\nSoftware Foundation, either version 3 of the License, or (at your option) any\nlater version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\nPARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License along\nwith this program. If not, see <https://www.gnu.org/licenses/>.\n",
45
+ 'author': 'Kian-Meng Ang',
46
+ 'author_email': 'kianmeng@cpan.org',
47
+ 'maintainer': 'None',
48
+ 'maintainer_email': 'None',
49
+ 'url': 'https://github.com/kianmeng/txt2ebook',
50
+ 'package_dir': package_dir,
51
+ 'packages': packages,
52
+ 'package_data': package_data,
53
+ 'install_requires': install_requires,
54
+ 'entry_points': entry_points,
55
+ 'python_requires': '>=3.7,<4.0',
56
+ }
57
+
58
+
59
+ setup(**setup_kwargs)
@@ -21,7 +21,7 @@ import sys
21
21
 
22
22
  logger = logging.getLogger(__name__)
23
23
 
24
- __version__ = "0.1.25"
24
+ __version__ = "0.1.26"
25
25
 
26
26
 
27
27
  def setup_logger(config: argparse.Namespace) -> None:
@@ -5,7 +5,7 @@
5
5
  msgid ""
6
6
  msgstr ""
7
7
  "Project-Id-Version: PACKAGE VERSION\n"
8
- "POT-Creation-Date: 2023-02-04 22:03+0800\n"
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:193
18
+ #: src/txt2ebook/formats/epub.py:199
19
19
  msgid "cover"
20
20
  msgstr "Cover"
21
21
 
22
- #: src/txt2ebook/formats/txt.py:88
22
+ #: src/txt2ebook/formats/txt.py:84
23
23
  msgid "metadata"
24
24
  msgstr "metadata"
25
25
 
26
- #: src/txt2ebook/formats/txt.py:158
26
+ #: src/txt2ebook/formats/txt.py:154
27
27
  msgid "title:"
28
28
  msgstr "Title:"
29
29
 
30
- #: src/txt2ebook/formats/txt.py:159
30
+ #: src/txt2ebook/formats/txt.py:155
31
31
  msgid "author:"
32
32
  msgstr "Author:"
33
33
 
34
- #: src/txt2ebook/formats/txt.py:160
34
+ #: src/txt2ebook/formats/txt.py:156
35
35
  msgid "tag:"
36
36
  msgstr "Tag:"
@@ -5,7 +5,7 @@
5
5
  msgid ""
6
6
  msgstr ""
7
7
  "Project-Id-Version: PACKAGE VERSION\n"
8
- "POT-Creation-Date: 2023-02-05 10:12+0800\n"
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:193
18
+ #: src/txt2ebook/formats/epub.py:199
19
19
  msgid "cover"
20
20
  msgstr ""
21
21
 
22
- #: src/txt2ebook/formats/txt.py:88
22
+ #: src/txt2ebook/formats/txt.py:84
23
23
  msgid "metadata"
24
24
  msgstr ""
25
25
 
26
- #: src/txt2ebook/formats/txt.py:158
26
+ #: src/txt2ebook/formats/txt.py:154
27
27
  msgid "title:"
28
28
  msgstr ""
29
29
 
30
- #: src/txt2ebook/formats/txt.py:159
30
+ #: src/txt2ebook/formats/txt.py:155
31
31
  msgid "author:"
32
32
  msgstr ""
33
33
 
34
- #: src/txt2ebook/formats/txt.py:160
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-02-04 22:03+0800\n"
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:193
19
+ #: src/txt2ebook/formats/epub.py:199
20
20
  msgid "cover"
21
21
  msgstr "封面"
22
22
 
23
- #: src/txt2ebook/formats/txt.py:88
23
+ #: src/txt2ebook/formats/txt.py:84
24
24
  msgid "metadata"
25
25
  msgstr "元数据"
26
26
 
27
- #: src/txt2ebook/formats/txt.py:158
27
+ #: src/txt2ebook/formats/txt.py:154
28
28
  msgid "title:"
29
29
  msgstr "书名:"
30
30
 
31
- #: src/txt2ebook/formats/txt.py:159
31
+ #: src/txt2ebook/formats/txt.py:155
32
32
  msgid "author:"
33
33
  msgstr "作者:"
34
34
 
35
- #: src/txt2ebook/formats/txt.py:160
35
+ #: src/txt2ebook/formats/txt.py:156
36
36
  msgid "tag:"
37
37
  msgstr "票签:"
@@ -265,7 +265,6 @@ def build_parser(
265
265
  choices=EPUB_TEMPLATES,
266
266
  dest="epub_template",
267
267
  help="CSS template for epub ebook (default: '%(default)s')",
268
- metavar="TEMPLATE",
269
268
  )
270
269
 
271
270
  parser.add_argument(
@@ -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
- # todo: padded_header_nums length must smaller than length
135
+
135
136
  if length > 0:
136
- padded_header_nums = padded_header_nums.rjust(length, "0")
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
txt2ebook-0.1.25/setup.py DELETED
@@ -1,59 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from setuptools import setup
3
-
4
- package_dir = \
5
- {'': 'src'}
6
-
7
- packages = \
8
- ['txt2ebook',
9
- 'txt2ebook.formats',
10
- 'txt2ebook.formats.templates',
11
- 'txt2ebook.formats.templates.epub',
12
- 'txt2ebook.helpers',
13
- 'txt2ebook.languages',
14
- 'txt2ebook.models']
15
-
16
- package_data = \
17
- {'': ['*'],
18
- 'txt2ebook': ['locales/*',
19
- 'locales/en/LC_MESSAGES/txt2ebook.mo',
20
- 'locales/en/LC_MESSAGES/txt2ebook.mo',
21
- 'locales/en/LC_MESSAGES/txt2ebook.po',
22
- 'locales/en/LC_MESSAGES/txt2ebook.po',
23
- 'locales/zh-cn/LC_MESSAGES/txt2ebook.mo',
24
- 'locales/zh-cn/LC_MESSAGES/txt2ebook.mo',
25
- 'locales/zh-cn/LC_MESSAGES/txt2ebook.po',
26
- 'locales/zh-cn/LC_MESSAGES/txt2ebook.po']}
27
-
28
- install_requires = \
29
- ['CJKwrap>=2.2,<3.0',
30
- 'EbookLib>=0.17.1,<0.18.0',
31
- 'bs4>=0.0.1,<0.0.2',
32
- 'langdetect>=1.0.9,<2.0.0',
33
- 'regex>=2021.11.10,<2022.0.0',
34
- 'tox-pyenv>=1.1.0,<2.0.0']
35
-
36
- entry_points = \
37
- {'console_scripts': ['tte = txt2ebook.txt2ebook:main',
38
- 'txt2ebook = txt2ebook.txt2ebook:main']}
39
-
40
- setup_kwargs = {
41
- 'name': 'txt2ebook',
42
- 'version': '0.1.25',
43
- 'description': 'CLI tool to convert txt file to ebook format',
44
- 'long_description': "# txt2ebook\n\nConsole tool to convert txt file to different ebook format.\n\n## Installation\n\nStable version From PyPI:\n\n```console\npython3 -m pip install txt2ebook\n```\n\nLatest development version from GitHub:\n\n```console\npython3 -m pip install -e git+https://github.com/kianmeng/txt2ebook.git\n```\n\n## Usage\n\nShowing help message of command-line options:\n\n```console\ntxt2ebook --help\n```\n\n```console\nusage: txt2ebook [-f {epub,txt}] [-t TITLE] [-l LANGUAGE] [-a AUTHOR]\n [-c IMAGE_FILENAME] [-w WIDTH] [-ps SEPARATOR] [-rd REGEX]\n [-rvc REGEX] [-rv REGEX] [-rc REGEX] [-rt REGEX] [-ra REGEX]\n [-rl REGEX] [-rr REGEX REGEX] [-et TEMPLATE] [-vp] [-tp]\n [-sp] [-hn] [-fw] [-rw] [-ob] [-ow] [-v] [-d] [-h] [-V]\n TXT_FILENAME [EBOOK_FILENAME]\n\ntxt2ebook/tte is a cli tool to convert txt file to ebook format.\n website: https://github.com/kianmeng/txt2ebook\n issues: https://github.com/kianmeng/txt2ebook/issues\n\npositional arguments:\n TXT_FILENAME\n source text filename\n EBOOK_FILENAME\n converted ebook filename (default: 'TXT_FILENAME.{epub,txt}')\n\noptional arguments:\n -f {epub,txt}, --format {epub,txt}\n ebook format (default: '['epub', 'txt']')\n -t TITLE, --title TITLE\n title of the ebook (default: 'None')\n -l LANGUAGE, --language LANGUAGE\n language of the ebook (default: 'None')\n -a AUTHOR, --author AUTHOR\n author of the ebook (default: '[]')\n -c IMAGE_FILENAME, --cover IMAGE_FILENAME\n cover of the ebook\n -w WIDTH, --width WIDTH\n width for line wrapping\n -ps SEPARATOR, --paragraph_separator SEPARATOR\n paragraph separator (default: '\\n\\n')\n -rd REGEX, --regex-delete REGEX\n regex to delete word or phrase (default: '[]')\n -rvc REGEX, --regex-volume-chapter REGEX\n regex to parse volume and chapter header (default: by LANGUAGE)\n -rv REGEX, --regex-volume REGEX\n regex to parse volume header (default: by LANGUAGE)\n -rc REGEX, --regex-chapter REGEX\n regex to parse chapter header (default: by LANGUAGE)\n -rt REGEX, --regex-title REGEX\n regex to parse title of the book (default: by LANGUAGE)\n -ra REGEX, --regex-author REGEX\n regex to parse author of the book (default: by LANGUAGE)\n -rl REGEX, --regex-delete-line REGEX\n regex to delete whole line (default: '[]')\n -rr REGEX REGEX, --regex-replace REGEX REGEX\n regex to search and replace (default: '[]')\n -et TEMPLATE, --epub-template TEMPLATE\n CSS template for epub ebook (default: 'clean')\n -vp, --volume-page\n generate each volume as separate page (only 'epub' format)\n -tp, --test-parsing\n test parsing for volume/chapter header\n -sp, --split-volume-and-chapter\n Split volume or chapter into separate file (only 'txt' format).\n Both --overwrite-backup and --overwrite option will be ignore.\n -hn, --header-number\n convert section header from words to numbers (only 'zh-cn/zh-tw' language)\n -fw, --fullwidth\n convert ASCII character from halfwidth to fullwidth (only 'zh-cn/zh-tw' language)\n -rw, --raise-on-warning\n raise exception and stop parsing upon warning\n -ob, --overwrite-backup\n overwrite massaged and backup original TXT_FILENAME\n -ow, --overwrite\n overwrite massaged TXT_FILENAME\n -v, --verbose\n show verbosity of debugging log, use -vv, -vvv for more details\n -d, --debug\n show debugging log and stacktrace\n -h, --help\n show this help message and exit\n -V, --version\n show program's version number and exit\n```\n\nConvert a txt file into epub:\n\n```console\ntxt2book ebook.txt\n```\n\n## Copyright and License\n\nCopyright (c) 2021,2022,2023 Kian-Meng Ang\n\nThis program is free software: you can redistribute it and/or modify it under\nthe terms of the GNU Affero General Public License as published by the Free\nSoftware Foundation, either version 3 of the License, or (at your option) any\nlater version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\nPARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License along\nwith this program. If not, see <https://www.gnu.org/licenses/>.\n",
45
- 'author': 'Kian-Meng Ang',
46
- 'author_email': 'kianmeng@cpan.org',
47
- 'maintainer': 'None',
48
- 'maintainer_email': 'None',
49
- 'url': 'https://github.com/kianmeng/txt2ebook',
50
- 'package_dir': package_dir,
51
- 'packages': packages,
52
- 'package_data': package_data,
53
- 'install_requires': install_requires,
54
- 'entry_points': entry_points,
55
- 'python_requires': '>=3.7,<4.0',
56
- }
57
-
58
-
59
- setup(**setup_kwargs)
File without changes