txt2ebook 0.1.149__py3-none-any.whl → 0.1.151__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/subcommands/massage.py +1 -1
- txt2ebook/subcommands/parse.py +6 -5
- txt2ebook/subcommands/tex.py +10 -0
- {txt2ebook-0.1.149.dist-info → txt2ebook-0.1.151.dist-info}/METADATA +1 -1
- {txt2ebook-0.1.149.dist-info → txt2ebook-0.1.151.dist-info}/RECORD +8 -8
- {txt2ebook-0.1.149.dist-info → txt2ebook-0.1.151.dist-info}/WHEEL +0 -0
- {txt2ebook-0.1.149.dist-info → txt2ebook-0.1.151.dist-info}/entry_points.txt +0 -0
- {txt2ebook-0.1.149.dist-info → txt2ebook-0.1.151.dist-info}/licenses/LICENSE.md +0 -0
txt2ebook/subcommands/massage.py
CHANGED
txt2ebook/subcommands/parse.py
CHANGED
@@ -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
|
-
"""
|
16
|
+
"""Parse subcommand."""
|
17
17
|
|
18
18
|
import argparse
|
19
19
|
import logging
|
@@ -70,14 +70,15 @@ def run(args: argparse.Namespace) -> Book:
|
|
70
70
|
"""
|
71
71
|
logger.info("Parsing txt file: %s", args.input_file.name)
|
72
72
|
|
73
|
-
|
73
|
+
raw_content = args.input_file.read()
|
74
|
+
if not raw_content:
|
75
|
+
raise EmptyFileError(f"Empty file content in {args.input_file.name}")
|
76
|
+
|
77
|
+
unicode = UnicodeDammit(raw_content)
|
74
78
|
logger.info("Detect encoding : %s", unicode.original_encoding)
|
75
79
|
|
76
80
|
content = unicode.unicode_markup
|
77
81
|
|
78
|
-
if not content:
|
79
|
-
raise EmptyFileError(f"Empty file content in {args.input_file.name}")
|
80
|
-
|
81
82
|
logger.info("Detect encoding : %s", unicode.original_encoding)
|
82
83
|
|
83
84
|
args.language = detect_and_expect_language(content, args.language)
|
txt2ebook/subcommands/tex.py
CHANGED
@@ -101,6 +101,16 @@ def build_subparser(subparsers) -> None:
|
|
101
101
|
metavar="FILENAME_FORMAT",
|
102
102
|
)
|
103
103
|
|
104
|
+
tex_parser.add_argument(
|
105
|
+
"-ps",
|
106
|
+
"--paragraph_separator",
|
107
|
+
dest="paragraph_separator",
|
108
|
+
type=lambda value: value.encode("utf-8").decode("unicode_escape"),
|
109
|
+
default="\n\n",
|
110
|
+
help="paragraph separator (default: %(default)r)",
|
111
|
+
metavar="SEPARATOR",
|
112
|
+
)
|
113
|
+
|
104
114
|
|
105
115
|
def run(args: argparse.Namespace) -> None:
|
106
116
|
"""Run tex subcommand.
|
@@ -39,14 +39,14 @@ txt2ebook/subcommands/__init__.py,sha256=ldhzvsrMsR8lZmhZef77JFz0jValpV3pytFfwJS
|
|
39
39
|
txt2ebook/subcommands/env.py,sha256=gEzra4b6guy7pRZUTCWX1_eiR7JmrtR1Z-J-vxljvMY,1549
|
40
40
|
txt2ebook/subcommands/epub.py,sha256=_obM1_fvVBPHOBXBOCYK8nyJadBX3_gOn9kaXA5HipA,3570
|
41
41
|
txt2ebook/subcommands/gmi.py,sha256=ANnPg-RFsylTo44fUzFOSHN1fC3Ce82gBzrv-sBv5fU,3318
|
42
|
-
txt2ebook/subcommands/massage.py,sha256=
|
42
|
+
txt2ebook/subcommands/massage.py,sha256=vPa04lSuzLU0tBsYQ6SKwtiOELT_rDAYo1FyLyb0Yf4,12694
|
43
43
|
txt2ebook/subcommands/md.py,sha256=PmIqrqrnzLywvN4qTkle0V9N3FTIJGRWpC0Xbk76B5o,3329
|
44
|
-
txt2ebook/subcommands/parse.py,sha256=
|
44
|
+
txt2ebook/subcommands/parse.py,sha256=xjhW8I9zS5DL3n3m04RyFofgci-6-_L6aF3d4N7c7M4,2938
|
45
45
|
txt2ebook/subcommands/pdf.py,sha256=1JQtpugzAIaho6G3CK1rGYk74hotAexXZxPH9PHpRps,2980
|
46
|
-
txt2ebook/subcommands/tex.py,sha256=
|
46
|
+
txt2ebook/subcommands/tex.py,sha256=59Bzl67VSHMZS9BtU9zZDmKwsd6cQGoFfuGftAz9efc,3438
|
47
47
|
txt2ebook/subcommands/typ.py,sha256=qXpHMmtu_1nAMs264oKUSolWAUBjZpTziTSBcTe2JgA,3681
|
48
|
-
txt2ebook-0.1.
|
49
|
-
txt2ebook-0.1.
|
50
|
-
txt2ebook-0.1.
|
51
|
-
txt2ebook-0.1.
|
52
|
-
txt2ebook-0.1.
|
48
|
+
txt2ebook-0.1.151.dist-info/entry_points.txt,sha256=AFikuCV6fqf8_GHwsvWuo9jTGNrCkWY1TJWk5GfMWSk,71
|
49
|
+
txt2ebook-0.1.151.dist-info/licenses/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
50
|
+
txt2ebook-0.1.151.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
51
|
+
txt2ebook-0.1.151.dist-info/METADATA,sha256=0bup4PeCqD-94SplBXgxSUESbN1sF4T6UxbATjoE9lg,4700
|
52
|
+
txt2ebook-0.1.151.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|