txt2ebook 0.1.117__tar.gz → 0.1.118__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 (52) hide show
  1. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/PKG-INFO +1 -1
  2. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/pyproject.toml +1 -1
  3. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/__init__.py +1 -1
  4. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/cli.py +1 -37
  5. txt2ebook-0.1.118/src/txt2ebook/subcommands/__init__.py +33 -0
  6. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/subcommands/epub.py +15 -0
  7. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/subcommands/gmi.py +15 -0
  8. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/subcommands/md.py +15 -0
  9. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/subcommands/pdf.py +24 -0
  10. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/subcommands/tex.py +24 -0
  11. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/subcommands/typ.py +25 -1
  12. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/LICENSE.md +0 -0
  13. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/README.md +0 -0
  14. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/__main__.py +0 -0
  15. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/exceptions.py +0 -0
  16. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/__init__.py +0 -0
  17. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/base.py +0 -0
  18. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/epub.py +0 -0
  19. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/gmi.py +0 -0
  20. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/md.py +0 -0
  21. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/pdf.py +0 -0
  22. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/templates/__init__.py +0 -0
  23. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/templates/epub/__init__.py +0 -0
  24. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/templates/epub/clean.css +0 -0
  25. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/templates/epub/condense.css +0 -0
  26. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/templates/epub/noindent.css +0 -0
  27. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/tex.py +0 -0
  28. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/txt.py +0 -0
  29. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/formats/typ.py +0 -0
  30. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/helpers/__init__.py +0 -0
  31. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/languages/__init__.py +0 -0
  32. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/languages/en.py +0 -0
  33. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/languages/zh_cn.py +0 -0
  34. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/languages/zh_tw.py +0 -0
  35. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.mo +0 -0
  36. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.po +0 -0
  37. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/locales/txt2ebook.pot +0 -0
  38. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.mo +0 -0
  39. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.po +0 -0
  40. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.mo +0 -0
  41. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.po +0 -0
  42. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/models/__init__.py +0 -0
  43. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/models/book.py +0 -0
  44. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/models/chapter.py +0 -0
  45. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/models/volume.py +0 -0
  46. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/parser.py +0 -0
  47. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/subcommands/env.py +0 -0
  48. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/subcommands/massage.py +0 -0
  49. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/subcommands/parse.py +0 -0
  50. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/tokenizer.py +0 -0
  51. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/txt2ebook.py +0 -0
  52. {txt2ebook-0.1.117 → txt2ebook-0.1.118}/src/txt2ebook/zh_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: txt2ebook
3
- Version: 0.1.117
3
+ Version: 0.1.118
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "txt2ebook"
3
- version = "0.1.117"
3
+ version = "0.1.118"
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"
@@ -24,7 +24,7 @@ import langdetect
24
24
 
25
25
  logger = logging.getLogger(__name__)
26
26
 
27
- __version__ = "0.1.117"
27
+ __version__ = "0.1.118"
28
28
 
29
29
 
30
30
  def setup_logger(config: argparse.Namespace) -> None:
@@ -21,9 +21,7 @@
21
21
  """
22
22
 
23
23
  import argparse
24
- import importlib
25
24
  import logging
26
- import pkgutil
27
25
  import sys
28
26
  from typing import Optional, Sequence
29
27
 
@@ -94,15 +92,6 @@ def build_parser(
94
92
  metavar="AUTHOR",
95
93
  )
96
94
 
97
- parser.add_argument(
98
- "-c",
99
- "--cover",
100
- dest="cover",
101
- default=None,
102
- help="cover of the ebook",
103
- metavar="IMAGE_FILENAME",
104
- )
105
-
106
95
  parser.add_argument(
107
96
  "-tr",
108
97
  "--translator",
@@ -141,21 +130,6 @@ def build_parser(
141
130
  metavar="SEPARATOR",
142
131
  )
143
132
 
144
- parser.add_argument(
145
- "-ff",
146
- "--filename-format",
147
- dest="filename_format",
148
- type=int,
149
- default=None,
150
- help=(
151
- "the output filename format "
152
- "(default: TXT_FILENAME [EBOOK_FILENAME])\n"
153
- "1 - title_authors.EBOOK_EXTENSION\n"
154
- "2 - authors_title.EBOOK_EXTENSION"
155
- ),
156
- metavar="FILENAME_FORMAT",
157
- )
158
-
159
133
  parser.add_argument(
160
134
  "-rw",
161
135
  "--raise-on-warning",
@@ -208,17 +182,7 @@ def build_parser(
208
182
  )
209
183
 
210
184
  subparsers = parser.add_subparsers(help="sub-command help")
211
-
212
- iter_namespace = pkgutil.iter_modules(
213
- txt2ebook.subcommands.__path__, txt2ebook.subcommands.__name__ + "."
214
- )
215
- subcommands = {
216
- name: importlib.import_module(name)
217
- for finder, name, ispkg
218
- in iter_namespace
219
- }
220
- for subcommand in subcommands.values():
221
- subcommand.build_subparser(subparsers)
185
+ txt2ebook.subcommands.build_subparser(subparsers)
222
186
 
223
187
  return parser
224
188
 
@@ -0,0 +1,33 @@
1
+ # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Affero General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Affero General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Affero General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ """Common utils for subcommand."""
17
+
18
+ import importlib
19
+ import pkgutil
20
+
21
+
22
+ def build_subparser(subparsers):
23
+ """Build subparser for each subcommands."""
24
+ iter_namespace = pkgutil.iter_modules(__path__, __name__ + ".")
25
+
26
+ subcommands = {
27
+ name: importlib.import_module(name)
28
+ for finder, name, ispkg
29
+ in iter_namespace
30
+ }
31
+
32
+ for subcommand in subcommands.values():
33
+ subcommand.build_subparser(subparsers)
@@ -88,6 +88,21 @@ def build_subparser(subparsers) -> None:
88
88
  help="open the generated file using default program",
89
89
  )
90
90
 
91
+ epub_parser.add_argument(
92
+ "-ff",
93
+ "--filename-format",
94
+ dest="filename_format",
95
+ type=int,
96
+ default=None,
97
+ help=(
98
+ "the output filename format "
99
+ "(default: TXT_FILENAME [EBOOK_FILENAME])\n"
100
+ "1 - title_authors.EBOOK_EXTENSION\n"
101
+ "2 - authors_title.EBOOK_EXTENSION"
102
+ ),
103
+ metavar="FILENAME_FORMAT",
104
+ )
105
+
91
106
 
92
107
  def run(args: argparse.Namespace) -> None:
93
108
  """Run epub subcommand.
@@ -80,6 +80,21 @@ def build_subparser(subparsers) -> None:
80
80
  help="open the generated file using default program",
81
81
  )
82
82
 
83
+ gmi_parser.add_argument(
84
+ "-ff",
85
+ "--filename-format",
86
+ dest="filename_format",
87
+ type=int,
88
+ default=None,
89
+ help=(
90
+ "the output filename format "
91
+ "(default: TXT_FILENAME [EBOOK_FILENAME])\n"
92
+ "1 - title_authors.EBOOK_EXTENSION\n"
93
+ "2 - authors_title.EBOOK_EXTENSION"
94
+ ),
95
+ metavar="FILENAME_FORMAT",
96
+ )
97
+
83
98
 
84
99
  def run(args: argparse.Namespace) -> None:
85
100
  """Run md subcommand.
@@ -80,6 +80,21 @@ def build_subparser(subparsers) -> None:
80
80
  help="open the generated file using default program",
81
81
  )
82
82
 
83
+ md_parser.add_argument(
84
+ "-ff",
85
+ "--filename-format",
86
+ dest="filename_format",
87
+ type=int,
88
+ default=None,
89
+ help=(
90
+ "the output filename format "
91
+ "(default: TXT_FILENAME [EBOOK_FILENAME])\n"
92
+ "1 - title_authors.EBOOK_EXTENSION\n"
93
+ "2 - authors_title.EBOOK_EXTENSION"
94
+ ),
95
+ metavar="FILENAME_FORMAT",
96
+ )
97
+
83
98
 
84
99
  def run(args: argparse.Namespace) -> None:
85
100
  """Run md subcommand.
@@ -52,6 +52,15 @@ def build_subparser(subparsers) -> None:
52
52
  metavar="EBOOK_FILENAME",
53
53
  )
54
54
 
55
+ pdf_parser.add_argument(
56
+ "-c",
57
+ "--cover",
58
+ dest="cover",
59
+ default=None,
60
+ help="cover of the ebook",
61
+ metavar="IMAGE_FILENAME",
62
+ )
63
+
55
64
  pdf_parser.add_argument(
56
65
  "-pz",
57
66
  "--page-size",
@@ -71,6 +80,21 @@ def build_subparser(subparsers) -> None:
71
80
  help="open the generated file using default program",
72
81
  )
73
82
 
83
+ pdf_parser.add_argument(
84
+ "-ff",
85
+ "--filename-format",
86
+ dest="filename_format",
87
+ type=int,
88
+ default=None,
89
+ help=(
90
+ "the output filename format "
91
+ "(default: TXT_FILENAME [EBOOK_FILENAME])\n"
92
+ "1 - title_authors.EBOOK_EXTENSION\n"
93
+ "2 - authors_title.EBOOK_EXTENSION"
94
+ ),
95
+ metavar="FILENAME_FORMAT",
96
+ )
97
+
74
98
 
75
99
  def run(args: argparse.Namespace) -> None:
76
100
  """Run pdf subcommand.
@@ -68,6 +68,15 @@ def build_subparser(subparsers) -> None:
68
68
 
69
69
  tex_parser.set_defaults(func=run)
70
70
 
71
+ tex_parser.add_argument(
72
+ "-c",
73
+ "--cover",
74
+ dest="cover",
75
+ default=None,
76
+ help="cover of the ebook",
77
+ metavar="IMAGE_FILENAME",
78
+ )
79
+
71
80
  tex_parser.add_argument(
72
81
  "-op",
73
82
  "--open",
@@ -77,6 +86,21 @@ def build_subparser(subparsers) -> None:
77
86
  help="open the generated file using default program",
78
87
  )
79
88
 
89
+ tex_parser.add_argument(
90
+ "-ff",
91
+ "--filename-format",
92
+ dest="filename_format",
93
+ type=int,
94
+ default=None,
95
+ help=(
96
+ "the output filename format "
97
+ "(default: TXT_FILENAME [EBOOK_FILENAME])\n"
98
+ "1 - title_authors.EBOOK_EXTENSION\n"
99
+ "2 - authors_title.EBOOK_EXTENSION"
100
+ ),
101
+ metavar="FILENAME_FORMAT",
102
+ )
103
+
80
104
 
81
105
  def run(args: argparse.Namespace) -> None:
82
106
  """Run tex subcommand.
@@ -13,7 +13,7 @@
13
13
  # You should have received a copy of the GNU Affero General Public License
14
14
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
15
 
16
- """md subcommand."""
16
+ """typ subcommand."""
17
17
 
18
18
  import argparse
19
19
  import logging
@@ -52,6 +52,15 @@ def build_subparser(subparsers) -> None:
52
52
  metavar="EBOOK_FILENAME",
53
53
  )
54
54
 
55
+ typ_parser.add_argument(
56
+ "-c",
57
+ "--cover",
58
+ dest="cover",
59
+ default=None,
60
+ help="cover of the ebook",
61
+ metavar="IMAGE_FILENAME",
62
+ )
63
+
55
64
  typ_parser.add_argument(
56
65
  "-pz",
57
66
  "--page-size",
@@ -88,6 +97,21 @@ def build_subparser(subparsers) -> None:
88
97
  help="open the generated file using default program",
89
98
  )
90
99
 
100
+ typ_parser.add_argument(
101
+ "-ff",
102
+ "--filename-format",
103
+ dest="filename_format",
104
+ type=int,
105
+ default=None,
106
+ help=(
107
+ "the output filename format "
108
+ "(default: TXT_FILENAME [EBOOK_FILENAME])\n"
109
+ "1 - title_authors.EBOOK_EXTENSION\n"
110
+ "2 - authors_title.EBOOK_EXTENSION"
111
+ ),
112
+ metavar="FILENAME_FORMAT",
113
+ )
114
+
91
115
 
92
116
  def run(args: argparse.Namespace) -> None:
93
117
  """Run typ subcommand.
File without changes
File without changes