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
txt2ebook/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -24,7 +24,7 @@ import langdetect
24
24
 
25
25
  logger = logging.getLogger(__name__)
26
26
 
27
- __version__ = "0.1.119"
27
+ __version__ = "0.1.123"
28
28
 
29
29
 
30
30
  def setup_logger(config: argparse.Namespace) -> None:
txt2ebook/__main__.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
txt2ebook/cli.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -32,7 +32,7 @@ logger = logging.getLogger(__name__)
32
32
 
33
33
 
34
34
  def build_parser(
35
- args: Optional[Sequence[str]] = [],
35
+ _args: Optional[Sequence[str]] = None,
36
36
  ) -> argparse.ArgumentParser:
37
37
  """Build the CLI parser."""
38
38
  parser = argparse.ArgumentParser(
@@ -64,15 +64,6 @@ def build_parser(
64
64
  ),
65
65
  )
66
66
 
67
- parser.add_argument(
68
- "-t",
69
- "--title",
70
- dest="title",
71
- default=None,
72
- help="title of the ebook (default: '%(default)s')",
73
- metavar="TITLE",
74
- )
75
-
76
67
  parser.add_argument(
77
68
  "-l",
78
69
  "--language",
@@ -82,54 +73,6 @@ def build_parser(
82
73
  metavar="LANGUAGE",
83
74
  )
84
75
 
85
- parser.add_argument(
86
- "-a",
87
- "--author",
88
- dest="author",
89
- default=[],
90
- action="append",
91
- help="author of the ebook (default: '%(default)s')",
92
- metavar="AUTHOR",
93
- )
94
-
95
- parser.add_argument(
96
- "-tr",
97
- "--translator",
98
- dest="translator",
99
- default=[],
100
- action="append",
101
- help="translator of the ebook (default: '%(default)s')",
102
- metavar="TRANSLATOR",
103
- )
104
-
105
- parser.add_argument(
106
- "-fw",
107
- "--fullwidth",
108
- default=False,
109
- action="store_true",
110
- dest="fullwidth",
111
- help="convert ASCII character from halfwidth to fullwidth",
112
- )
113
-
114
- parser.add_argument(
115
- "-hn",
116
- "--header-number",
117
- default=False,
118
- action="store_true",
119
- dest="header_number",
120
- help="convert section header from words to numbers",
121
- )
122
-
123
- parser.add_argument(
124
- "-ps",
125
- "--paragraph_separator",
126
- dest="paragraph_separator",
127
- type=lambda value: value.encode("utf-8").decode("unicode_escape"),
128
- default="\n\n",
129
- help="paragraph separator (default: %(default)r)",
130
- metavar="SEPARATOR",
131
- )
132
-
133
76
  parser.add_argument(
134
77
  "-rw",
135
78
  "--raise-on-warning",
txt2ebook/exceptions.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
txt2ebook/formats/base.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
txt2ebook/formats/epub.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
txt2ebook/formats/gmi.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
txt2ebook/formats/md.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
txt2ebook/formats/pdf.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
txt2ebook/formats/tex.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
txt2ebook/formats/txt.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
txt2ebook/formats/typ.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
txt2ebook/languages/en.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
txt2ebook/models/book.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
txt2ebook/parser.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -88,10 +88,10 @@ class Parser:
88
88
  Returns:
89
89
  str: The formatted section header.
90
90
  """
91
- if not self.config.header_number or self.config.language not in (
91
+ if hasattr(self.config, "header_number") and (not self.config.header_number or self.config.language not in (
92
92
  "zh-cn",
93
93
  "zh-tw",
94
- ):
94
+ )):
95
95
  return words
96
96
 
97
97
  # left pad the section number if found as halfwidth integer
@@ -112,7 +112,7 @@ class Parser:
112
112
 
113
113
  replaced_words = zh_words_to_numbers(words, length=length)
114
114
 
115
- if self.config.fullwidth:
115
+ if hasattr(self.config, "fullwidth") and self.config.fullwidth:
116
116
  replaced_words = zh_halfwidth_to_fullwidth(replaced_words)
117
117
 
118
118
  logger.debug(
@@ -216,13 +216,13 @@ class Parser:
216
216
  toc[-1].add_paragraph(token.value)
217
217
 
218
218
  # Use authors if set explicitly from command line.
219
- if self.config.author:
219
+ if hasattr(self.config, "author") and self.config.author:
220
220
  authors = self.config.author
221
221
 
222
- if self.config.title:
222
+ if hasattr(self.config, "title") and self.config.title:
223
223
  book_title = self.config.title
224
224
 
225
- if self.config.translator:
225
+ if hasattr(self.config, "translator") and self.config.translator:
226
226
  authors = self.config.translator
227
227
 
228
228
  logger.info("Found or set book title: %s", book_title)
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -103,6 +103,16 @@ def build_subparser(subparsers) -> None:
103
103
  metavar="FILENAME_FORMAT",
104
104
  )
105
105
 
106
+ epub_parser.add_argument(
107
+ "-ps",
108
+ "--paragraph_separator",
109
+ dest="paragraph_separator",
110
+ type=lambda value: value.encode("utf-8").decode("unicode_escape"),
111
+ default="\n\n",
112
+ help="paragraph separator (default: %(default)r)",
113
+ metavar="SEPARATOR",
114
+ )
115
+
106
116
 
107
117
  def run(args: argparse.Namespace) -> None:
108
118
  """Run epub subcommand.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -95,6 +95,16 @@ def build_subparser(subparsers) -> None:
95
95
  metavar="FILENAME_FORMAT",
96
96
  )
97
97
 
98
+ gmi_parser.add_argument(
99
+ "-ps",
100
+ "--paragraph_separator",
101
+ dest="paragraph_separator",
102
+ type=lambda value: value.encode("utf-8").decode("unicode_escape"),
103
+ default="\n\n",
104
+ help="paragraph separator (default: %(default)r)",
105
+ metavar="SEPARATOR",
106
+ )
107
+
98
108
 
99
109
  def run(args: argparse.Namespace) -> None:
100
110
  """Run md subcommand.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -95,6 +95,16 @@ def build_subparser(subparsers) -> None:
95
95
  metavar="FILENAME_FORMAT",
96
96
  )
97
97
 
98
+ md_parser.add_argument(
99
+ "-ps",
100
+ "--paragraph_separator",
101
+ dest="paragraph_separator",
102
+ type=lambda value: value.encode("utf-8").decode("unicode_escape"),
103
+ default="\n\n",
104
+ help="paragraph separator (default: %(default)r)",
105
+ metavar="SEPARATOR",
106
+ )
107
+
98
108
 
99
109
  def run(args: argparse.Namespace) -> None:
100
110
  """Run md subcommand.
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -45,6 +45,16 @@ def build_subparser(subparsers) -> None:
45
45
  metavar="TXT_FILENAME",
46
46
  )
47
47
 
48
+ parse_parser.add_argument(
49
+ "-ps",
50
+ "--paragraph_separator",
51
+ dest="paragraph_separator",
52
+ type=lambda value: value.encode("utf-8").decode("unicode_escape"),
53
+ default="\n\n",
54
+ help="paragraph separator (default: %(default)r)",
55
+ metavar="SEPARATOR",
56
+ )
57
+
48
58
  parse_parser.set_defaults(func=run)
49
59
 
50
60
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -112,6 +112,16 @@ def build_subparser(subparsers) -> None:
112
112
  metavar="FILENAME_FORMAT",
113
113
  )
114
114
 
115
+ typ_parser.add_argument(
116
+ "-ps",
117
+ "--paragraph_separator",
118
+ dest="paragraph_separator",
119
+ type=lambda value: value.encode("utf-8").decode("unicode_escape"),
120
+ default="\n\n",
121
+ help="paragraph separator (default: %(default)r)",
122
+ metavar="SEPARATOR",
123
+ )
124
+
115
125
 
116
126
  def run(args: argparse.Namespace) -> None:
117
127
  """Run typ subcommand.
txt2ebook/tokenizer.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
txt2ebook/zh_utils.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021,2022,2023,2024 Kian-Meng Ang
1
+ # Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
2
2
  #
3
3
  # This program is free software: you can redistribute it and/or modify
4
4
  # it under the terms of the GNU Affero General Public License as published by
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: txt2ebook
3
- Version: 0.1.119
3
+ Version: 0.1.123
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
@@ -77,122 +77,57 @@ txt2ebook --help
77
77
  <!--help !-->
78
78
 
79
79
  ```console
80
- usage: txt2ebook [-of OUTPUT_FOLDER] [-p] [-f {epub,gmi,md,pdf,tex,txt,typ}]
81
- [-ik INDEX_KEYWORD] [-t TITLE] [-l LANGUAGE] [-a AUTHOR]
82
- [-tr TRANSLATOR] [-c IMAGE_FILENAME] [-w WIDTH]
83
- [-ff FILENAME_FORMAT] [-ps SEPARATOR] [-pz PAGE_SIZE]
84
- [-rd REGEX] [-rvc REGEX] [-rv REGEX] [-rc REGEX] [-rt REGEX]
85
- [-ra REGEX] [-rl REGEX] [-rr REGEX REGEX] [-ct]
86
- [-et {clean,condense,noindent}] [-vp] [-tp] [-sp] [-ss]
87
- [-toc] [-hn] [-fw] [-rw] [-ow] [-op] [-q] [-v] [-y] [-d]
88
- [--env] [-h] [-V]
89
- TXT_FILENAME [EBOOK_FILENAME]
80
+ usage: txt2ebook [-of OUTPUT_FOLDER] [-p] [-l LANGUAGE] [-rw] [-q] [-v] [-d]
81
+ [-h] [-V]
82
+ {env,epub,gmi,massage,md,parse,pdf,tex,typ} ...
90
83
 
91
84
  txt2ebook/tte is a cli tool to convert txt file to ebook format.
92
85
 
93
- website: https://github.com/kianmeng/txt2ebook
94
- changelog: https://github.com/kianmeng/txt2ebook/blob/master/CHANGELOG.md
95
- issues: https://github.com/kianmeng/txt2ebook/issues
86
+ website: https://github.com/kianmeng/txt2ebook
87
+ changelog: https://github.com/kianmeng/txt2ebook/blob/master/CHANGELOG.md
88
+ issues: https://github.com/kianmeng/txt2ebook/issues
96
89
 
97
90
  positional arguments:
98
- TXT_FILENAME
99
- source text filename
100
- EBOOK_FILENAME
101
- converted ebook filename (default: 'TXT_FILENAME.epub')
91
+ {env,epub,gmi,massage,md,parse,pdf,tex,typ}
92
+ sub-command help
93
+ env
94
+ print environment information for bug reporting
95
+ epub
96
+ generate ebook in EPUB format
97
+ gmi
98
+ generate ebook in Markdown format
99
+ massage
100
+ massage the source txt file
101
+ md
102
+ generate ebook in Markdown format
103
+ parse
104
+ parse and validate the txt file
105
+ pdf
106
+ generate ebook in Markdown format
107
+ tex
108
+ generate ebook in TeX/PDF format
109
+ typ
110
+ generate ebook in Typst format
102
111
 
103
112
  options:
104
- -of OUTPUT_FOLDER, --output-folder OUTPUT_FOLDER
113
+ -of, --output-folder OUTPUT_FOLDER
105
114
  set default output folder (default: 'output')
106
115
  -p, --purge
107
116
  remove converted ebooks specified by --output-folder option (default: 'False')
108
- -f {epub,gmi,md,pdf,tex,txt,typ}, --format {epub,gmi,md,pdf,tex,txt,typ}
109
- ebook format (default: 'epub')
110
- -ik INDEX_KEYWORD, --index-keyword INDEX_KEYWORD
111
- keyword to index (default: '[]')
112
- -t TITLE, --title TITLE
113
- title of the ebook (default: 'None')
114
- -l LANGUAGE, --language LANGUAGE
117
+ -l, --language LANGUAGE
115
118
  language of the ebook (default: 'None')
116
- -a AUTHOR, --author AUTHOR
117
- author of the ebook (default: '[]')
118
- -tr TRANSLATOR, --translator TRANSLATOR
119
- translator of the ebook (default: '[]')
120
- -ff FILENAME_FORMAT, --filename-format FILENAME_FORMAT
121
- the output filename format (default: TXT_FILENAME [EBOOK_FILENAME])
122
- 1 - title_authors.EBOOK_EXTENSION
123
- 2 - authors_title.EBOOK_EXTENSION
124
- -ps SEPARATOR, --paragraph_separator SEPARATOR
125
- paragraph separator (default: '\n\n')
126
- -rd REGEX, --regex-delete REGEX
127
- regex to delete word or phrase (default: '[]')
128
- -rvc REGEX, --regex-volume-chapter REGEX
129
- regex to parse volume and chapter header (default: by LANGUAGE)
130
- -rv REGEX, --regex-volume REGEX
131
- regex to parse volume header (default: by LANGUAGE)
132
- -rc REGEX, --regex-chapter REGEX
133
- regex to parse chapter header (default: by LANGUAGE)
134
- -rt REGEX, --regex-title REGEX
135
- regex to parse title of the book (default: by LANGUAGE)
136
- -ra REGEX, --regex-author REGEX
137
- regex to parse author of the book (default: by LANGUAGE)
138
- -rl REGEX, --regex-delete-line REGEX
139
- regex to delete whole line (default: '[]')
140
- -rr REGEX REGEX, --regex-replace REGEX REGEX
141
- regex to search and replace (default: '[]')
142
- -tp, --test-parsing
143
- test parsing for volume/chapter header
144
- -ss, --sort-volume-and-chapter
145
- short volume and chapter
146
119
  -rw, --raise-on-warning
147
120
  raise exception and stop parsing upon warning
148
- -ow, --overwrite
149
- overwrite massaged TXT_FILENAME
150
- -op, --open
151
- open the generated file using default program
152
121
  -q, --quiet
153
122
  suppress all logging
154
123
  -v, --verbose
155
124
  show verbosity of debugging log, use -vv, -vvv for more details
156
- -y, --yes
157
- yes to prompt
158
125
  -d, --debug
159
126
  show debugging log and stacktrace
160
- --env
161
- print environments information for bug reporting
162
127
  -h, --help
163
128
  show this help message and exit
164
129
  -V, --version
165
130
  show program's version number and exit
166
-
167
- --format epub:
168
- -c IMAGE_FILENAME, --cover IMAGE_FILENAME
169
- cover of the ebook
170
- -et {clean,condense,noindent}, --epub-template {clean,condense,noindent}
171
- CSS template for epub ebook (default: 'clean')
172
- -vp, --volume-page
173
- generate each volume as separate page
174
-
175
- --format pdf:
176
- -pz PAGE_SIZE, --page-size PAGE_SIZE
177
- page size of the ebook (default: 'a5')
178
-
179
- --format txt:
180
- -w WIDTH, --width WIDTH
181
- width for line wrapping
182
- -sp, --split-volume-and-chapter
183
- split volume or chapter into separate file and ignore the --overwrite option
184
- -toc, --table-of-content
185
- add table of content
186
-
187
- --format tex:
188
- -ct, --clean-tex
189
- purge artifacts generated by TeX (default: 'False')
190
-
191
- --language zh-cn / --language zh-tw:
192
- -hn, --header-number
193
- convert section header from words to numbers
194
- -fw, --fullwidth
195
- convert ASCII character from halfwidth to fullwidth
196
131
  ```
197
132
 
198
133
  <!--help !-->
@@ -205,7 +140,7 @@ txt2ebook ebook.txt
205
140
 
206
141
  ## Copyright and License
207
142
 
208
- Copyright (c) 2021,2022,2023,2024 Kian-Meng Ang
143
+ Copyright (c) 2021,2022,2023,2024,2025 Kian-Meng Ang
209
144
 
210
145
  This program is free software: you can redistribute it and/or modify it under
211
146
  the terms of the GNU Affero General Public License as published by the Free