txt2ebook
A console tool to convert txt file to different ebook formats.
Installation
Stable version From PyPI:
python3 -m pip install txt2ebook
Latest development version from GitHub:
python3 -m pip install -e git+https://github.com/kianmeng/txt2ebook.git
Usage
Showing help message of command-line options:
txt2ebook --help
usage: txt2ebook [-f {epub,gmi,md,pdf,txt}] [-t TITLE] [-l LANGUAGE]
[-a AUTHOR] [-tr TRANSLATOR] [-c IMAGE_FILENAME] [-w WIDTH]
[-ff FILENAME_FORMAT] [-ps SEPARATOR] [-pz PAGE_SIZE]
[-rd REGEX] [-rvc REGEX] [-rv REGEX] [-rc REGEX] [-rt REGEX]
[-ra REGEX] [-rl REGEX] [-rr REGEX REGEX]
[-et {clean,condense,noindent}] [-vp] [-tp] [-sp] [-toc]
[-hn] [-fw] [-rw] [-ow] [-v] [-d] [-h] [-V]
TXT_FILENAME [EBOOK_FILENAME]
txt2ebook/tte is a cli tool to convert txt file to ebook format.
website: https://github.com/kianmeng/txt2ebook
issues: https://github.com/kianmeng/txt2ebook/issues
positional arguments:
TXT_FILENAME
source text filename
EBOOK_FILENAME
converted ebook filename (default: 'TXT_FILENAME.epub')
optional arguments:
-f {epub,gmi,md,pdf,txt}, --format {epub,gmi,md,pdf,txt}
ebook format (default: 'epub')
-t TITLE, --title TITLE
title of the ebook (default: 'None')
-l LANGUAGE, --language LANGUAGE
language of the ebook (default: 'None')
-a AUTHOR, --author AUTHOR
author of the ebook (default: '[]')
-tr TRANSLATOR, --translator TRANSLATOR
translator of the ebook (default: '[]')
-ff FILENAME_FORMAT, --filename-format FILENAME_FORMAT
the output filename format (default: TXT_FILENAME [EBOOK_FILENAME])
1 - title_authors.EBOOK_EXTENSION
2 - authors_title.EBOOK_EXTENSION
-ps SEPARATOR, --paragraph_separator SEPARATOR
paragraph separator (default: '\n\n')
-pz PAGE_SIZE, --page-size PAGE_SIZE
page size of the ebook (default: 'None')
-rd REGEX, --regex-delete REGEX
regex to delete word or phrase (default: '[]')
-rvc REGEX, --regex-volume-chapter REGEX
regex to parse volume and chapter header (default: by LANGUAGE)
-rv REGEX, --regex-volume REGEX
regex to parse volume header (default: by LANGUAGE)
-rc REGEX, --regex-chapter REGEX
regex to parse chapter header (default: by LANGUAGE)
-rt REGEX, --regex-title REGEX
regex to parse title of the book (default: by LANGUAGE)
-ra REGEX, --regex-author REGEX
regex to parse author of the book (default: by LANGUAGE)
-rl REGEX, --regex-delete-line REGEX
regex to delete whole line (default: '[]')
-rr REGEX REGEX, --regex-replace REGEX REGEX
regex to search and replace (default: '[]')
-tp, --test-parsing
test parsing for volume/chapter header
-rw, --raise-on-warning
raise exception and stop parsing upon warning
-ow, --overwrite
overwrite massaged TXT_FILENAME
-v, --verbose
show verbosity of debugging log, use -vv, -vvv for more details
-d, --debug
show debugging log and stacktrace
-h, --help
show this help message and exit
-V, --version
show program's version number and exit
--format epub:
-c IMAGE_FILENAME, --cover IMAGE_FILENAME
cover of the ebook
-et {clean,condense,noindent}, --epub-template {clean,condense,noindent}
CSS template for epub ebook (default: 'clean')
-vp, --volume-page
generate each volume as separate page
--format txt:
-w WIDTH, --width WIDTH
width for line wrapping
-sp, --split-volume-and-chapter
split volume or chapter into separate file and ignore the --overwrite option
-toc, --table-of-content
add table of content
--language zh-cn / --language zh-tw:
-hn, --header-number
convert section header from words to numbers
-fw, --fullwidth
convert ASCII character from halfwidth to fullwidth
Convert a txt file into epub:
txt2ebook ebook.txt
Copyright and License
Copyright (c) 2021,2022,2023 Kian-Meng Ang
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.
The fish logo used in the documentation generated by Sphinx is a public domain drawing of Troschel's parrotfish (Chlorurus troschelii Var. A.) from https://commons.wikimedia.org/entity/M18506436.
Metadata
Release files for txt2ebook 0.1.45
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| txt2ebook-0.1.45.tar.gz | 41.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| txt2ebook-0.1.45-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 117.8 kB
Release files / txt2ebook-0.1.45.tar.gz
| Download URL | txt2ebook-0.1.45.tar.gz |
|---|---|
| Size | 41.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f7399f475c0b17a6d650589385f0c03621e8be07225b21250132e62718995be
|
|
BLAKE2b-256 checksum How to use checksums |
0f3302e005dd35bc6f5def588478110bf16c444c43d2ddab5969c5640d50c4c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.8.17 Linux/6.2.0-25-generic
|
Release files / txt2ebook-0.1.45-py3-none-any.whl
| Download URL | txt2ebook-0.1.45-py3-none-any.whl |
|---|---|
| Size | 75.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e60348faeb2868d4325dc9f48dd3e906b57e272f103154d7a36a992940da714
|
|
BLAKE2b-256 checksum How to use checksums |
c970377de83b5a4083402e5ad68452fcaad5b7b4603e3ee0c7bb4f6c6ba71541
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.8.17 Linux/6.2.0-25-generic
|