txt2ebook 0.1.119__py3-none-any.whl → 0.1.123__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.
Files changed (44) hide show
  1. txt2ebook/__init__.py +2 -2
  2. txt2ebook/__main__.py +1 -1
  3. txt2ebook/cli.py +2 -59
  4. txt2ebook/exceptions.py +1 -1
  5. txt2ebook/formats/__init__.py +1 -1
  6. txt2ebook/formats/base.py +1 -1
  7. txt2ebook/formats/epub.py +1 -1
  8. txt2ebook/formats/gmi.py +1 -1
  9. txt2ebook/formats/md.py +1 -1
  10. txt2ebook/formats/pdf.py +1 -1
  11. txt2ebook/formats/templates/__init__.py +1 -1
  12. txt2ebook/formats/templates/epub/__init__.py +1 -1
  13. txt2ebook/formats/tex.py +1 -1
  14. txt2ebook/formats/txt.py +1 -1
  15. txt2ebook/formats/typ.py +1 -1
  16. txt2ebook/helpers/__init__.py +1 -1
  17. txt2ebook/languages/__init__.py +1 -1
  18. txt2ebook/languages/en.py +1 -1
  19. txt2ebook/languages/zh_cn.py +1 -1
  20. txt2ebook/languages/zh_tw.py +1 -1
  21. txt2ebook/models/__init__.py +1 -1
  22. txt2ebook/models/book.py +1 -1
  23. txt2ebook/models/chapter.py +1 -1
  24. txt2ebook/models/volume.py +1 -1
  25. txt2ebook/parser.py +7 -7
  26. txt2ebook/subcommands/__init__.py +1 -1
  27. txt2ebook/subcommands/env.py +1 -1
  28. txt2ebook/subcommands/epub.py +11 -1
  29. txt2ebook/subcommands/gmi.py +11 -1
  30. txt2ebook/subcommands/massage.py +1 -1
  31. txt2ebook/subcommands/md.py +11 -1
  32. txt2ebook/subcommands/parse.py +11 -1
  33. txt2ebook/subcommands/pdf.py +1 -1
  34. txt2ebook/subcommands/tex.py +1 -1
  35. txt2ebook/subcommands/typ.py +11 -1
  36. txt2ebook/tokenizer.py +1 -1
  37. txt2ebook/zh_utils.py +1 -1
  38. {txt2ebook-0.1.119.dist-info → txt2ebook-0.1.123.dist-info}/METADATA +30 -95
  39. txt2ebook-0.1.123.dist-info/RECORD +52 -0
  40. {txt2ebook-0.1.119.dist-info → txt2ebook-0.1.123.dist-info}/entry_points.txt +1 -1
  41. txt2ebook/txt2ebook.py +0 -533
  42. txt2ebook-0.1.119.dist-info/RECORD +0 -53
  43. {txt2ebook-0.1.119.dist-info → txt2ebook-0.1.123.dist-info}/LICENSE.md +0 -0
  44. {txt2ebook-0.1.119.dist-info → txt2ebook-0.1.123.dist-info}/WHEEL +0 -0
@@ -0,0 +1,52 @@
1
+ txt2ebook/__init__.py,sha256=fd76ha-G3glbHge-GEfS_3E7ufxyrXzBanhwbIWB8fE,2706
2
+ txt2ebook/__main__.py,sha256=L29rlfPSx9XMnVaHBYP2dyYgDmutJvONR3yUejjYwRY,855
3
+ txt2ebook/cli.py,sha256=D0jseJLlFDjLfX-yiGCC0e98a5IJ1IbRFx_mVGyYIxc,4241
4
+ txt2ebook/exceptions.py,sha256=oVtVMCqrxWq-CZ5GQYOBioil9i2kJ2mqD08IQ9A636Q,847
5
+ txt2ebook/formats/__init__.py,sha256=uNbNvSrXyfil7uIeFgYjttYB_1GkwTSPYfiDew9V4bs,2468
6
+ txt2ebook/formats/base.py,sha256=ODguJ7OBPXfRQLLeoL-G66NZihroXb4kG5-56ZrlygI,5819
7
+ txt2ebook/formats/epub.py,sha256=IVz-FmYQlcChOw38YqfKy46bPVSIrHyxA_94iz06N3Y,6941
8
+ txt2ebook/formats/gmi.py,sha256=qwNCcHh2LN4pEn0rDLpQFhLOPjLBgMU-E_dxWxewWbw,6788
9
+ txt2ebook/formats/md.py,sha256=9RWv_7cfXfAGC1MdYm0WTkjpgtXKQJTQjYOf0MqQmsc,6537
10
+ txt2ebook/formats/pdf.py,sha256=xPsTAZ0UtDjKt2sTMKDnNLEMq6gSVNnxkK9XDlMhC9A,7281
11
+ txt2ebook/formats/templates/__init__.py,sha256=f3K7pJByNmmvu-wvziks6qb2QnnLmkDjUACXyw2s60E,760
12
+ txt2ebook/formats/templates/epub/__init__.py,sha256=-XVLvnknTJTmQZY9UTH705vMcHgy56rQVRTusYawEZ4,766
13
+ txt2ebook/formats/templates/epub/clean.css,sha256=AnEwMckzUSKcjKsDiWtJW1oaceuklt2tyuS1VbpVK1s,462
14
+ txt2ebook/formats/templates/epub/condense.css,sha256=Fz80ZqkPsFRmGdURduAxqMV8drD0CCUlrv41P8rUsm8,477
15
+ txt2ebook/formats/templates/epub/noindent.css,sha256=_O5Tv90TKyyPBRdgjuNKFwtKFbdheh2V9PtDhgRUg3U,483
16
+ txt2ebook/formats/tex.py,sha256=V5B1nPR-WzGc4jqWu-BqxfQhtQsUTKM_sZZJsCcDBAk,5897
17
+ txt2ebook/formats/txt.py,sha256=j5RWF41WQfLdm-APwi8u-OE8snenDEJLzxHD_i9mxeg,7541
18
+ txt2ebook/formats/typ.py,sha256=_a3PKFh5jlHvaqRes6XvtPoDJI_HJaH7pCBbBRFeYyM,6647
19
+ txt2ebook/helpers/__init__.py,sha256=-G-BbGOY2iRmX8jNKnXXZ7tWD17_IjuDbFzT-bSrSf8,1976
20
+ txt2ebook/languages/__init__.py,sha256=1AfDn-D0q-dvODGP-9KxPHY_Wtk-ifZdN1FutZMT9-Q,763
21
+ txt2ebook/languages/en.py,sha256=e5VzZwfrO2kABMwEB0l--eo4XbOre6f6uJ-ySU3ORT8,960
22
+ txt2ebook/languages/zh_cn.py,sha256=VlNB-XvCx_aB4G-gGJJA2i49ksPRdGDiZu0qXHwsDvo,1971
23
+ txt2ebook/languages/zh_tw.py,sha256=_fdXOOSLK0nTMuBe1Om2qjb4zr2PVd6N4xi2rrYkNTI,1515
24
+ txt2ebook/locales/en/LC_MESSAGES/txt2ebook.mo,sha256=Ym6soeijV3zsv9FUPWlJnu18-CNb5tcOTN5JsMOfV9c,672
25
+ txt2ebook/locales/en/LC_MESSAGES/txt2ebook.po,sha256=YhI4ZnZVWIqR3WpbLL940xXdLwAAp9-OBQShD6QtSWU,698
26
+ txt2ebook/locales/txt2ebook.pot,sha256=NyqRL3frKSw9bry_vriA1pdXh1gh1qAUpi5_wzLb7jc,641
27
+ txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.mo,sha256=rRGW7HByDVZV8WpQkhyIFOWYNTQc4NnStrn0eGJX8Wc,675
28
+ txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.po,sha256=zVvD8AEL6gcxg4QPfc_NnDy22Qf9_AdeYejiVzbLsFc,698
29
+ txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.mo,sha256=1GIuOcO_bISiFcfhFez-A7mSi11Mo-x3PBobBENgMEc,675
30
+ txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.po,sha256=Y-oJYvufQKqiUmAJR6RAB9DZdsu2hChUUtkEApu7byI,698
31
+ txt2ebook/models/__init__.py,sha256=Z3zClWLj08Q8HgaWV1RRgIKatEhIUfYBAVWm-j4m05w,930
32
+ txt2ebook/models/book.py,sha256=jzbLM2v5aKr_p5_YqhCVDEdCmoS61nitKM6mLznjyME,2763
33
+ txt2ebook/models/chapter.py,sha256=6YvUDHzR6amGMZgkQl_xHWrYZUmlfpF7mnDLilG2BpA,1686
34
+ txt2ebook/models/volume.py,sha256=koz1KfWjvGWLFbmGEQlZ23frsP93cDsuBMySYBHiXm8,1597
35
+ txt2ebook/parser.py,sha256=ClcmWdFMSLfU-76vVnoHVAb6N7qYhCy6zmIwK0MPx9M,9006
36
+ txt2ebook/subcommands/__init__.py,sha256=ldhzvsrMsR8lZmhZef77JFz0jValpV3pytFfwJSkjls,1146
37
+ txt2ebook/subcommands/env.py,sha256=Fx2IXNmmlW-6jlMjRPI-nYp90Sbi77Z2SeL4q3cGg2w,1495
38
+ txt2ebook/subcommands/epub.py,sha256=JDDucrRiiQW1B7ycKz5zS1X5SMQZ82GBtlE2_SBYIdw,3507
39
+ txt2ebook/subcommands/gmi.py,sha256=zVvP2ZjLtDdqew4Vlab2_R3H2OmQkpMKdfND6qgppiU,3320
40
+ txt2ebook/subcommands/massage.py,sha256=ZDb0pBlOOmsVWWNaokPr9FOpOPcKmjKszlE-mLAiNxE,10192
41
+ txt2ebook/subcommands/md.py,sha256=P-oFtb2u-v2F_KU8t249-f5Ihjb_TCT_NWMlOYoq5p4,3330
42
+ txt2ebook/subcommands/parse.py,sha256=FaYTWa2yqkowwPAmHWJC7iCii2Rnus3SUHG10GjjJp4,3022
43
+ txt2ebook/subcommands/pdf.py,sha256=KS3rzxPJG6ovt8GPJj8u1Bum5ye3zrEI0LPz21EMLZo,2981
44
+ txt2ebook/subcommands/tex.py,sha256=X6ZBfuAs_mcJe8PNjzoW339ecPynZduVbcCq0henjiA,3131
45
+ txt2ebook/subcommands/typ.py,sha256=r4Xf7xSINbYfaIKkVzdyQDlUMWPvOIcbvOwC71spu6w,3682
46
+ txt2ebook/tokenizer.py,sha256=_Y34FEQghaqD-6OLuMJ1amCuF_beGb0SAO24CzsJ4qE,9595
47
+ txt2ebook/zh_utils.py,sha256=0Yq9r-JL4HntW68vFR6TBP9yQim1a07mfsh_sp-XmaE,4887
48
+ txt2ebook-0.1.123.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
49
+ txt2ebook-0.1.123.dist-info/METADATA,sha256=yE6ZIDNuOldii9G9vDo3Dlfl2fGUiz0HjYXwdb_eLFM,4969
50
+ txt2ebook-0.1.123.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
51
+ txt2ebook-0.1.123.dist-info/entry_points.txt,sha256=q4krNWsYNu4Rcf72nFc66JeR0J9BiFA6-NVEJKBZ_F4,71
52
+ txt2ebook-0.1.123.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  [console_scripts]
2
2
  tte=txt2ebook.cli:main
3
- txt2ebook=txt2ebook.txt2ebook:main
3
+ txt2ebook=txt2ebook.cli.main
4
4
 
txt2ebook/txt2ebook.py DELETED
@@ -1,533 +0,0 @@
1
- # pylint: disable=no-value-for-parameter
2
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
3
- #
4
- # This program is free software: you can redistribute it and/or modify
5
- # it under the terms of the GNU Affero General Public License as published by
6
- # the Free Software Foundation, either version 3 of the License, or
7
- # (at your option) any later version.
8
- #
9
- # This program is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU Affero General Public License for more details.
13
- #
14
- # You should have received a copy of the GNU Affero General Public License
15
- # along with this program. If not, see <https://www.gnu.org/licenses/>.
16
-
17
- """txt2ebook/tte is a cli tool to convert txt file to ebook format.
18
-
19
- website: https://github.com/kianmeng/txt2ebook
20
- changelog: https://github.com/kianmeng/txt2ebook/blob/master/CHANGELOG.md
21
- issues: https://github.com/kianmeng/txt2ebook/issues
22
- """
23
-
24
- import argparse
25
- import datetime
26
- import logging
27
- import sys
28
- import time
29
- from typing import Optional, Sequence
30
-
31
- from bs4 import UnicodeDammit
32
-
33
- from txt2ebook import (
34
- __version__,
35
- print_env,
36
- setup_logger,
37
- detect_and_expect_language,
38
- )
39
- from txt2ebook.exceptions import EmptyFileError
40
- from txt2ebook.formats import (
41
- EBOOK_FORMATS,
42
- EPUB_TEMPLATES,
43
- PAGE_SIZES,
44
- create_format,
45
- )
46
- from txt2ebook.parser import Parser
47
-
48
- logger = logging.getLogger(__name__)
49
-
50
-
51
- def run(config: argparse.Namespace) -> None:
52
- """Set the main application logic."""
53
- logger.debug(config)
54
-
55
- if config.env:
56
- print_env()
57
- else:
58
- logger.info("Parsing txt file: %s", config.input_file.name)
59
-
60
- unicode = UnicodeDammit(config.input_file.read())
61
- logger.info("Detect encoding : %s", unicode.original_encoding)
62
-
63
- content = unicode.unicode_markup
64
- if not content:
65
- raise EmptyFileError(
66
- f"Empty file content in {config.input_file.name}"
67
- )
68
-
69
- config.language = detect_and_expect_language(content, config.language)
70
- parser = Parser(content, config)
71
- book = parser.parse()
72
-
73
- if config.test_parsing or config.debug:
74
- book.debug(config.verbose)
75
-
76
- config.format = config.format or ["epub"]
77
- if not config.test_parsing:
78
- if book.toc:
79
- for ebook_format in config.format:
80
- writer = create_format(book, ebook_format, config)
81
- writer.write()
82
- else:
83
- logger.warning("No table of content found, not exporting")
84
-
85
-
86
- def build_parser(
87
- args: Optional[Sequence[str]] = None,
88
- ) -> argparse.ArgumentParser:
89
- """Generate the argument parser."""
90
- args = args or []
91
-
92
- parser = argparse.ArgumentParser(
93
- prog="txt2ebook",
94
- add_help=False,
95
- description=__doc__,
96
- formatter_class=lambda prog: argparse.RawTextHelpFormatter(
97
- prog, max_help_position=6
98
- ),
99
- )
100
-
101
- epub = parser.add_argument_group("--format epub")
102
- pdf = parser.add_argument_group("--format pdf")
103
- txt = parser.add_argument_group("--format txt")
104
- tex = parser.add_argument_group("--format tex")
105
- zhlang = parser.add_argument_group("--language zh-cn / --language zh-tw")
106
-
107
- if "--env" not in args:
108
- parser.add_argument(
109
- "input_file",
110
- nargs=None if sys.stdin.isatty() else "?", # type: ignore
111
- type=argparse.FileType("rb"),
112
- default=None if sys.stdin.isatty() else sys.stdin,
113
- help="source text filename",
114
- metavar="TXT_FILENAME",
115
- )
116
-
117
- parser.add_argument(
118
- "output_file",
119
- nargs="?",
120
- default=None,
121
- help="converted ebook filename (default: 'TXT_FILENAME.epub')",
122
- metavar="EBOOK_FILENAME",
123
- )
124
-
125
- parser.add_argument(
126
- "-of",
127
- "--output-folder",
128
- dest="output_folder",
129
- default="output",
130
- help="set default output folder (default: '%(default)s')",
131
- )
132
-
133
- parser.add_argument(
134
- "-p",
135
- "--purge",
136
- default=False,
137
- action="store_true",
138
- dest="purge",
139
- help=(
140
- "remove converted ebooks specified by --output-folder option "
141
- "(default: '%(default)s')"
142
- ),
143
- )
144
-
145
- parser.add_argument(
146
- "-f",
147
- "--format",
148
- dest="format",
149
- choices=EBOOK_FORMATS,
150
- action="append",
151
- help="ebook format (default: 'epub')",
152
- )
153
-
154
- parser.add_argument(
155
- "-ik",
156
- "--index-keyword",
157
- dest="index_keyword",
158
- action="append",
159
- default=[],
160
- help="keyword to index (default: '%(default)s')",
161
- )
162
-
163
- parser.add_argument(
164
- "-t",
165
- "--title",
166
- dest="title",
167
- default=None,
168
- help="title of the ebook (default: '%(default)s')",
169
- metavar="TITLE",
170
- )
171
-
172
- parser.add_argument(
173
- "-l",
174
- "--language",
175
- dest="language",
176
- default=None,
177
- help="language of the ebook (default: '%(default)s')",
178
- metavar="LANGUAGE",
179
- )
180
-
181
- parser.add_argument(
182
- "-a",
183
- "--author",
184
- dest="author",
185
- default=[],
186
- action="append",
187
- help="author of the ebook (default: '%(default)s')",
188
- metavar="AUTHOR",
189
- )
190
-
191
- parser.add_argument(
192
- "-tr",
193
- "--translator",
194
- dest="translator",
195
- default=[],
196
- action="append",
197
- help="translator of the ebook (default: '%(default)s')",
198
- metavar="TRANSLATOR",
199
- )
200
-
201
- epub.add_argument(
202
- "-c",
203
- "--cover",
204
- dest="cover",
205
- default=None,
206
- help="cover of the ebook",
207
- metavar="IMAGE_FILENAME",
208
- )
209
-
210
- txt.add_argument(
211
- "-w",
212
- "--width",
213
- dest="width",
214
- type=int,
215
- default=None,
216
- help="width for line wrapping",
217
- metavar="WIDTH",
218
- )
219
-
220
- parser.add_argument(
221
- "-ff",
222
- "--filename-format",
223
- dest="filename_format",
224
- type=int,
225
- default=None,
226
- help=(
227
- "the output filename format "
228
- "(default: TXT_FILENAME [EBOOK_FILENAME])\n"
229
- "1 - title_authors.EBOOK_EXTENSION\n"
230
- "2 - authors_title.EBOOK_EXTENSION"
231
- ),
232
- metavar="FILENAME_FORMAT",
233
- )
234
-
235
- parser.add_argument(
236
- "-ps",
237
- "--paragraph_separator",
238
- dest="paragraph_separator",
239
- type=lambda value: value.encode("utf-8").decode("unicode_escape"),
240
- default="\n\n",
241
- help="paragraph separator (default: %(default)r)",
242
- metavar="SEPARATOR",
243
- )
244
-
245
- pdf.add_argument(
246
- "-pz",
247
- "--page-size",
248
- dest="page_size",
249
- default="a5",
250
- choices=PAGE_SIZES,
251
- help="page size of the ebook (default: '%(default)s')",
252
- metavar="PAGE_SIZE",
253
- )
254
-
255
- parser.add_argument(
256
- "-rd",
257
- "--regex-delete",
258
- dest="re_delete",
259
- default=[],
260
- action="append",
261
- help="regex to delete word or phrase (default: '%(default)s')",
262
- metavar="REGEX",
263
- )
264
-
265
- parser.add_argument(
266
- "-rvc",
267
- "--regex-volume-chapter",
268
- dest="re_volume_chapter",
269
- default=[],
270
- action="append",
271
- help=(
272
- "regex to parse volume and chapter header "
273
- "(default: by LANGUAGE)"
274
- ),
275
- metavar="REGEX",
276
- )
277
-
278
- parser.add_argument(
279
- "-rv",
280
- "--regex-volume",
281
- dest="re_volume",
282
- default=[],
283
- action="append",
284
- help="regex to parse volume header (default: by LANGUAGE)",
285
- metavar="REGEX",
286
- )
287
-
288
- parser.add_argument(
289
- "-rc",
290
- "--regex-chapter",
291
- dest="re_chapter",
292
- default=[],
293
- action="append",
294
- help="regex to parse chapter header (default: by LANGUAGE)",
295
- metavar="REGEX",
296
- )
297
-
298
- parser.add_argument(
299
- "-rt",
300
- "--regex-title",
301
- dest="re_title",
302
- default=[],
303
- action="append",
304
- help="regex to parse title of the book (default: by LANGUAGE)",
305
- metavar="REGEX",
306
- )
307
-
308
- parser.add_argument(
309
- "-ra",
310
- "--regex-author",
311
- dest="re_author",
312
- default=[],
313
- action="append",
314
- help="regex to parse author of the book (default: by LANGUAGE)",
315
- metavar="REGEX",
316
- )
317
-
318
- parser.add_argument(
319
- "-rl",
320
- "--regex-delete-line",
321
- dest="re_delete_line",
322
- default=[],
323
- action="append",
324
- help="regex to delete whole line (default: '%(default)s')",
325
- metavar="REGEX",
326
- )
327
-
328
- parser.add_argument(
329
- "-rr",
330
- "--regex-replace",
331
- dest="re_replace",
332
- nargs=2,
333
- default=[],
334
- action="append",
335
- help="regex to search and replace (default: '%(default)s')",
336
- metavar="REGEX",
337
- )
338
-
339
- tex.add_argument(
340
- "-ct",
341
- "--clean-tex",
342
- default=False,
343
- action="store_true",
344
- dest="clean_tex",
345
- help="purge artifacts generated by TeX (default: '%(default)s')",
346
- )
347
-
348
- epub.add_argument(
349
- "-et",
350
- "--epub-template",
351
- default="clean",
352
- choices=EPUB_TEMPLATES,
353
- dest="epub_template",
354
- help="CSS template for epub ebook (default: '%(default)s')",
355
- )
356
-
357
- epub.add_argument(
358
- "-vp",
359
- "--volume-page",
360
- default=False,
361
- action="store_true",
362
- dest="volume_page",
363
- help="generate each volume as separate page",
364
- )
365
-
366
- parser.add_argument(
367
- "-tp",
368
- "--test-parsing",
369
- default=False,
370
- action="store_true",
371
- dest="test_parsing",
372
- help="test parsing for volume/chapter header",
373
- )
374
-
375
- txt.add_argument(
376
- "-sp",
377
- "--split-volume-and-chapter",
378
- default=False,
379
- action="store_true",
380
- dest="split_volume_and_chapter",
381
- help=(
382
- "split volume or chapter into separate file and "
383
- "ignore the --overwrite option"
384
- ),
385
- )
386
-
387
- parser.add_argument(
388
- "-ss",
389
- "--sort-volume-and-chapter",
390
- default=False,
391
- action="store_true",
392
- dest="sort_volume_and_chapter",
393
- help="short volume and chapter",
394
- )
395
-
396
- txt.add_argument(
397
- "-toc",
398
- "--table-of-content",
399
- default=False,
400
- action="store_true",
401
- dest="with_toc",
402
- help="add table of content",
403
- )
404
-
405
- zhlang.add_argument(
406
- "-hn",
407
- "--header-number",
408
- default=False,
409
- action="store_true",
410
- dest="header_number",
411
- help="convert section header from words to numbers",
412
- )
413
-
414
- zhlang.add_argument(
415
- "-fw",
416
- "--fullwidth",
417
- default=False,
418
- action="store_true",
419
- dest="fullwidth",
420
- help="convert ASCII character from halfwidth to fullwidth",
421
- )
422
-
423
- parser.add_argument(
424
- "-rw",
425
- "--raise-on-warning",
426
- default=False,
427
- action="store_true",
428
- dest="raise_on_warning",
429
- help="raise exception and stop parsing upon warning",
430
- )
431
-
432
- parser.add_argument(
433
- "-ow",
434
- "--overwrite",
435
- default=False,
436
- action="store_true",
437
- dest="overwrite",
438
- help="overwrite massaged TXT_FILENAME",
439
- )
440
-
441
- parser.add_argument(
442
- "-op",
443
- "--open",
444
- default=False,
445
- action="store_true",
446
- dest="open",
447
- help="open the generated file using default program",
448
- )
449
-
450
- parser.add_argument(
451
- "-q",
452
- "--quiet",
453
- default=False,
454
- action="store_true",
455
- dest="quiet",
456
- help="suppress all logging",
457
- )
458
-
459
- parser.add_argument(
460
- "-v",
461
- "--verbose",
462
- default=0,
463
- action="count",
464
- dest="verbose",
465
- help="show verbosity of debugging log, use -vv, -vvv for more details",
466
- )
467
-
468
- parser.add_argument(
469
- "-y",
470
- "--yes",
471
- default=False,
472
- action="store_true",
473
- dest="yes",
474
- help="yes to prompt",
475
- )
476
-
477
- parser.add_argument(
478
- "-d",
479
- "--debug",
480
- default=False,
481
- action="store_true",
482
- dest="debug",
483
- help="show debugging log and stacktrace",
484
- )
485
-
486
- parser.add_argument(
487
- "--env",
488
- default=False,
489
- action="store_true",
490
- dest="env",
491
- help="print environments information for bug reporting",
492
- )
493
-
494
- parser.add_argument(
495
- "-h",
496
- "--help",
497
- action="help",
498
- default=argparse.SUPPRESS,
499
- help="show this help message and exit",
500
- )
501
-
502
- parser.add_argument(
503
- "-V", "--version", action="version", version=f"%(prog)s {__version__}"
504
- )
505
-
506
- return parser
507
-
508
-
509
- def main(args: Optional[Sequence[str]] = None):
510
- """Set the main entrypoint of the CLI script."""
511
- args = args or sys.argv[1:]
512
- config = argparse.Namespace()
513
-
514
- try:
515
- parser = build_parser(args)
516
- config = parser.parse_args(args)
517
- logger.debug(config)
518
-
519
- setup_logger(config)
520
-
521
- start_time = time.time()
522
- run(config)
523
- end_time = time.time()
524
- elapsed_time = end_time - start_time
525
- timedelta = datetime.timedelta(seconds=elapsed_time)
526
- logger.info("Time taken: %s", timedelta)
527
-
528
- except Exception as error:
529
- logger.error(
530
- getattr(error, "message", str(error)),
531
- exc_info=("-d" in args or "--debug" in args),
532
- )
533
- raise SystemExit(1) from None
@@ -1,53 +0,0 @@
1
- txt2ebook/__init__.py,sha256=iohYWQYl2xqJZNU_hSkVkfs-JeUr5IMRQzAiLUxlcEA,2701
2
- txt2ebook/__main__.py,sha256=gMLvgpqc_BL4cBqNe0vqErRF5dlJPAbvqu1zndcAHYI,850
3
- txt2ebook/cli.py,sha256=8yrYmixLbQCwAwdd_u0A3SSHDxIEZLI04lg53Ec3XwY,5622
4
- txt2ebook/exceptions.py,sha256=b2HDsXdqweLJbvSJEGt48nxvGkZq20SfYezSjwp77JU,842
5
- txt2ebook/formats/__init__.py,sha256=WhiRWGvbUjc8QZfhAIkKCg6GL8vNNlEF73meZSzYhDA,2463
6
- txt2ebook/formats/base.py,sha256=SMt6Op88-HoIxRA-tgPBNSlrt7-KZ-m5-BytAEJT4m0,5814
7
- txt2ebook/formats/epub.py,sha256=ZRXRnEO-qCtRIQYM9zh-VaoJfrySRdAliWr5y91l_bA,6936
8
- txt2ebook/formats/gmi.py,sha256=deVCwFfCE7Ys9eFTnRgZUncJX6LiUM1iXG7HXFCHlPY,6783
9
- txt2ebook/formats/md.py,sha256=D-6bGaNNtL11A-a8xZDVVUbfUMIdkeV6umTlsXpLSOA,6532
10
- txt2ebook/formats/pdf.py,sha256=Mz-h300tKc_-NcqL6YZTTAPaBk0i9e0323LXFR8bR0U,7276
11
- txt2ebook/formats/templates/__init__.py,sha256=PmObHFVHXD0GIw4328g1i1KoBks1m5-7u00XMNgb38U,755
12
- txt2ebook/formats/templates/epub/__init__.py,sha256=DeIsL4WDqgTU7zCLxlCidFItvG4Nl4TMKWeoeTcUuuo,761
13
- txt2ebook/formats/templates/epub/clean.css,sha256=AnEwMckzUSKcjKsDiWtJW1oaceuklt2tyuS1VbpVK1s,462
14
- txt2ebook/formats/templates/epub/condense.css,sha256=Fz80ZqkPsFRmGdURduAxqMV8drD0CCUlrv41P8rUsm8,477
15
- txt2ebook/formats/templates/epub/noindent.css,sha256=_O5Tv90TKyyPBRdgjuNKFwtKFbdheh2V9PtDhgRUg3U,483
16
- txt2ebook/formats/tex.py,sha256=Z4nPTXcKFu2ZTsICuihDejmeNoQ9OSk7RT0VMJO2QGE,5892
17
- txt2ebook/formats/txt.py,sha256=8PkJ54r-0saZYyYEH64nYSkM-oW5LnurCbAk6d2Ue78,7536
18
- txt2ebook/formats/typ.py,sha256=1GpBkLWbScBr8evFDV_qaKtHPwV1MU042AHlht1tIFA,6642
19
- txt2ebook/helpers/__init__.py,sha256=cQmFjEsEEI0gRxDPL-284FMS5Z-iBMcu-4qe7Icf7is,1971
20
- txt2ebook/languages/__init__.py,sha256=oShuwgKn784v_XYrAKQM2x1h0-KEsJPeia9XWMnJTYU,758
21
- txt2ebook/languages/en.py,sha256=ZUhkXzZrs3Sy11-hj0SGj5XYrMnafTHEN8WxMOJEtEo,955
22
- txt2ebook/languages/zh_cn.py,sha256=Qtu_k9LiXkib_7Tp5Wwi3ESSKDJ59BvArW4s7jr7kwA,1966
23
- txt2ebook/languages/zh_tw.py,sha256=MGu99-dSPq7bwS9PyRTUExJuYGtViq8d2ubrjH9C7cA,1510
24
- txt2ebook/locales/en/LC_MESSAGES/txt2ebook.mo,sha256=Ym6soeijV3zsv9FUPWlJnu18-CNb5tcOTN5JsMOfV9c,672
25
- txt2ebook/locales/en/LC_MESSAGES/txt2ebook.po,sha256=YhI4ZnZVWIqR3WpbLL940xXdLwAAp9-OBQShD6QtSWU,698
26
- txt2ebook/locales/txt2ebook.pot,sha256=NyqRL3frKSw9bry_vriA1pdXh1gh1qAUpi5_wzLb7jc,641
27
- txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.mo,sha256=rRGW7HByDVZV8WpQkhyIFOWYNTQc4NnStrn0eGJX8Wc,675
28
- txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.po,sha256=zVvD8AEL6gcxg4QPfc_NnDy22Qf9_AdeYejiVzbLsFc,698
29
- txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.mo,sha256=1GIuOcO_bISiFcfhFez-A7mSi11Mo-x3PBobBENgMEc,675
30
- txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.po,sha256=Y-oJYvufQKqiUmAJR6RAB9DZdsu2hChUUtkEApu7byI,698
31
- txt2ebook/models/__init__.py,sha256=8_k1oI_PnPMekhdZCXiTtg5WghdR6fugQEHJHsy1-Ds,925
32
- txt2ebook/models/book.py,sha256=Q4EzFFAGigz4MPSM9Vu_F-JxNOWjm82469Vy8-vq-pw,2758
33
- txt2ebook/models/chapter.py,sha256=buECAklNQgM3tDehzyVO9YfA_F0iXyLq2PaMZGV_Zaw,1681
34
- txt2ebook/models/volume.py,sha256=HyT4XO9yZ8d0PgZVfMMyAYUDFv58RrUmsSFNNmU-sHY,1592
35
- txt2ebook/parser.py,sha256=XlVjCKSUdAPKvp2655xWwHMOnpA8Qhe6ysExxdl8_ss,8811
36
- txt2ebook/subcommands/__init__.py,sha256=RU5YLwFz_SLrFpMz8vSYU6dwco3ZGe97zSVwFl1fMp4,1141
37
- txt2ebook/subcommands/env.py,sha256=nY7mmBkV2y1WonwUpJZAAZ141aeUCUtPZRACk18WoaY,1490
38
- txt2ebook/subcommands/epub.py,sha256=SdU4NYCNgGbioe-6Je88gvQbycIQDa4sPcvlnUvSOrY,3194
39
- txt2ebook/subcommands/gmi.py,sha256=l_YaxXwdp9L8h2xu2bTNPcY5hOGp6sJAEE9E1zuL1rc,3008
40
- txt2ebook/subcommands/massage.py,sha256=VB31ZKAKIprK6ccigpmHr87LTNjgHxlXxYvbhy7Zfds,10187
41
- txt2ebook/subcommands/md.py,sha256=MF74qdG7aHDRRI0XZYGlZdyMz07HKDQ7-xSe_dhAbsU,3019
42
- txt2ebook/subcommands/parse.py,sha256=nklsxk_S2iswPWKlqa_azbjQOi5PHx8BwMuXV5yCOCs,2708
43
- txt2ebook/subcommands/pdf.py,sha256=SVsFz3oW4RDLM51O7G7Y8PqoTNoKOSEYMqDfak6DDgg,2976
44
- txt2ebook/subcommands/tex.py,sha256=TEOazBTfFlE1-eW1oyG1g_IE8hXYZUvKbmH3sBAFMHo,3126
45
- txt2ebook/subcommands/typ.py,sha256=l5CKeHIrnGHRMvjowXr3mT5WgWEHTQc34nJYgtzGKJw,3370
46
- txt2ebook/tokenizer.py,sha256=KJud1GAZIzeZtPWjAKc78q675pOfvIhBQYqOTmkfJm8,9590
47
- txt2ebook/txt2ebook.py,sha256=zNgxSmvEPpw7iiOq4gf9K5jsrJm0BqNQGM3MSAYh0F0,13560
48
- txt2ebook/zh_utils.py,sha256=EgKVbwqYGaTGswQUGcOCeSfRelzwkAb9WWY9TrsX1x4,4882
49
- txt2ebook-0.1.119.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
50
- txt2ebook-0.1.119.dist-info/METADATA,sha256=5vwCS_b0PjoI37CgdjvrtwKt5fas1hsvuPerYtNscRU,7845
51
- txt2ebook-0.1.119.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
52
- txt2ebook-0.1.119.dist-info/entry_points.txt,sha256=JLW3Iv7eUyABlQeUFiUWQhLKfRdnB9o5SIcNlneGR0Q,77
53
- txt2ebook-0.1.119.dist-info/RECORD,,