txt2ebook 0.1.121__py3-none-any.whl → 0.1.122__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.
- txt2ebook/__init__.py +1 -1
- txt2ebook/cli.py +0 -28
- txt2ebook/parser.py +3 -3
- txt2ebook/subcommands/gmi.py +10 -0
- txt2ebook/subcommands/md.py +10 -0
- txt2ebook/subcommands/parse.py +10 -0
- txt2ebook/subcommands/typ.py +10 -0
- {txt2ebook-0.1.121.dist-info → txt2ebook-0.1.122.dist-info}/METADATA +1 -1
- {txt2ebook-0.1.121.dist-info → txt2ebook-0.1.122.dist-info}/RECORD +12 -12
- {txt2ebook-0.1.121.dist-info → txt2ebook-0.1.122.dist-info}/LICENSE.md +0 -0
- {txt2ebook-0.1.121.dist-info → txt2ebook-0.1.122.dist-info}/WHEEL +0 -0
- {txt2ebook-0.1.121.dist-info → txt2ebook-0.1.122.dist-info}/entry_points.txt +0 -0
txt2ebook/__init__.py
CHANGED
txt2ebook/cli.py
CHANGED
@@ -73,34 +73,6 @@ def build_parser(
|
|
73
73
|
metavar="LANGUAGE",
|
74
74
|
)
|
75
75
|
|
76
|
-
parser.add_argument(
|
77
|
-
"-fw",
|
78
|
-
"--fullwidth",
|
79
|
-
default=False,
|
80
|
-
action="store_true",
|
81
|
-
dest="fullwidth",
|
82
|
-
help="convert ASCII character from halfwidth to fullwidth",
|
83
|
-
)
|
84
|
-
|
85
|
-
parser.add_argument(
|
86
|
-
"-hn",
|
87
|
-
"--header-number",
|
88
|
-
default=False,
|
89
|
-
action="store_true",
|
90
|
-
dest="header_number",
|
91
|
-
help="convert section header from words to numbers",
|
92
|
-
)
|
93
|
-
|
94
|
-
parser.add_argument(
|
95
|
-
"-ps",
|
96
|
-
"--paragraph_separator",
|
97
|
-
dest="paragraph_separator",
|
98
|
-
type=lambda value: value.encode("utf-8").decode("unicode_escape"),
|
99
|
-
default="\n\n",
|
100
|
-
help="paragraph separator (default: %(default)r)",
|
101
|
-
metavar="SEPARATOR",
|
102
|
-
)
|
103
|
-
|
104
76
|
parser.add_argument(
|
105
77
|
"-rw",
|
106
78
|
"--raise-on-warning",
|
txt2ebook/parser.py
CHANGED
@@ -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(
|
txt2ebook/subcommands/gmi.py
CHANGED
@@ -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.
|
txt2ebook/subcommands/md.py
CHANGED
@@ -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.
|
txt2ebook/subcommands/parse.py
CHANGED
@@ -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
|
|
txt2ebook/subcommands/typ.py
CHANGED
@@ -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.
|
@@ -1,6 +1,6 @@
|
|
1
|
-
txt2ebook/__init__.py,sha256=
|
1
|
+
txt2ebook/__init__.py,sha256=azAoZvK9xXszMm1fUCaTAIsjVV71TfGUXix3_ARYDqg,2706
|
2
2
|
txt2ebook/__main__.py,sha256=L29rlfPSx9XMnVaHBYP2dyYgDmutJvONR3yUejjYwRY,855
|
3
|
-
txt2ebook/cli.py,sha256=
|
3
|
+
txt2ebook/cli.py,sha256=D0jseJLlFDjLfX-yiGCC0e98a5IJ1IbRFx_mVGyYIxc,4241
|
4
4
|
txt2ebook/exceptions.py,sha256=oVtVMCqrxWq-CZ5GQYOBioil9i2kJ2mqD08IQ9A636Q,847
|
5
5
|
txt2ebook/formats/__init__.py,sha256=uNbNvSrXyfil7uIeFgYjttYB_1GkwTSPYfiDew9V4bs,2468
|
6
6
|
txt2ebook/formats/base.py,sha256=ODguJ7OBPXfRQLLeoL-G66NZihroXb4kG5-56ZrlygI,5819
|
@@ -32,22 +32,22 @@ txt2ebook/models/__init__.py,sha256=Z3zClWLj08Q8HgaWV1RRgIKatEhIUfYBAVWm-j4m05w,
|
|
32
32
|
txt2ebook/models/book.py,sha256=jzbLM2v5aKr_p5_YqhCVDEdCmoS61nitKM6mLznjyME,2763
|
33
33
|
txt2ebook/models/chapter.py,sha256=6YvUDHzR6amGMZgkQl_xHWrYZUmlfpF7mnDLilG2BpA,1686
|
34
34
|
txt2ebook/models/volume.py,sha256=koz1KfWjvGWLFbmGEQlZ23frsP93cDsuBMySYBHiXm8,1597
|
35
|
-
txt2ebook/parser.py,sha256=
|
35
|
+
txt2ebook/parser.py,sha256=ClcmWdFMSLfU-76vVnoHVAb6N7qYhCy6zmIwK0MPx9M,9006
|
36
36
|
txt2ebook/subcommands/__init__.py,sha256=ldhzvsrMsR8lZmhZef77JFz0jValpV3pytFfwJSkjls,1146
|
37
37
|
txt2ebook/subcommands/env.py,sha256=Fx2IXNmmlW-6jlMjRPI-nYp90Sbi77Z2SeL4q3cGg2w,1495
|
38
38
|
txt2ebook/subcommands/epub.py,sha256=JnQuegVYJYk20AmoG0uldtMs06coyGOF-6hslUE5_Ss,3199
|
39
|
-
txt2ebook/subcommands/gmi.py,sha256=
|
39
|
+
txt2ebook/subcommands/gmi.py,sha256=zVvP2ZjLtDdqew4Vlab2_R3H2OmQkpMKdfND6qgppiU,3320
|
40
40
|
txt2ebook/subcommands/massage.py,sha256=ZDb0pBlOOmsVWWNaokPr9FOpOPcKmjKszlE-mLAiNxE,10192
|
41
|
-
txt2ebook/subcommands/md.py,sha256=
|
42
|
-
txt2ebook/subcommands/parse.py,sha256=
|
41
|
+
txt2ebook/subcommands/md.py,sha256=P-oFtb2u-v2F_KU8t249-f5Ihjb_TCT_NWMlOYoq5p4,3330
|
42
|
+
txt2ebook/subcommands/parse.py,sha256=FaYTWa2yqkowwPAmHWJC7iCii2Rnus3SUHG10GjjJp4,3022
|
43
43
|
txt2ebook/subcommands/pdf.py,sha256=KS3rzxPJG6ovt8GPJj8u1Bum5ye3zrEI0LPz21EMLZo,2981
|
44
44
|
txt2ebook/subcommands/tex.py,sha256=X6ZBfuAs_mcJe8PNjzoW339ecPynZduVbcCq0henjiA,3131
|
45
|
-
txt2ebook/subcommands/typ.py,sha256=
|
45
|
+
txt2ebook/subcommands/typ.py,sha256=r4Xf7xSINbYfaIKkVzdyQDlUMWPvOIcbvOwC71spu6w,3682
|
46
46
|
txt2ebook/tokenizer.py,sha256=_Y34FEQghaqD-6OLuMJ1amCuF_beGb0SAO24CzsJ4qE,9595
|
47
47
|
txt2ebook/txt2ebook.py,sha256=vQPdvazg1WIBs8AEgEHfEQWkMr8wrZ0XBtx08qv4huU,13565
|
48
48
|
txt2ebook/zh_utils.py,sha256=0Yq9r-JL4HntW68vFR6TBP9yQim1a07mfsh_sp-XmaE,4887
|
49
|
-
txt2ebook-0.1.
|
50
|
-
txt2ebook-0.1.
|
51
|
-
txt2ebook-0.1.
|
52
|
-
txt2ebook-0.1.
|
53
|
-
txt2ebook-0.1.
|
49
|
+
txt2ebook-0.1.122.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
50
|
+
txt2ebook-0.1.122.dist-info/METADATA,sha256=WTw4l4EPCZ4VrpAK-BWO_z-6Wdz0gmKecmILzK5RaGE,7850
|
51
|
+
txt2ebook-0.1.122.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
52
|
+
txt2ebook-0.1.122.dist-info/entry_points.txt,sha256=JLW3Iv7eUyABlQeUFiUWQhLKfRdnB9o5SIcNlneGR0Q,77
|
53
|
+
txt2ebook-0.1.122.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|