CLI tool to convert txt file to ebook format
Project description
txt2ebook
A console tool to convert txt file to different ebook formats.
Installation
Stable version From PyPI:
python3 -m pip install txt2ebook
Upgrade to latest stable version:
python3 -m pip install txt2ebook --upgrade
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 [-of OUTPUT_FOLDER] [-p] [-f {epub,gmi,md,pdf,tex,txt,typ}]
[-ik INDEX_KEYWORD] [-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] [-ct]
[-et {clean,condense,noindent}] [-vp] [-tp] [-sp] [-ss]
[-toc] [-hn] [-fw] [-rw] [-ow] [-op] [-q] [-v] [-y] [-d]
[--env] [-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
changelog: https://github.com/kianmeng/txt2ebook/blob/master/CHANGELOG.md
issues: https://github.com/kianmeng/txt2ebook/issues
positional arguments:
TXT_FILENAME
source text filename
EBOOK_FILENAME
converted ebook filename (default: 'TXT_FILENAME.epub')
options:
-of OUTPUT_FOLDER, --output-folder OUTPUT_FOLDER
set default output folder (default: 'output')
-p, --purge
remove converted ebooks specified by --output-folder option (default: 'False')
-f {epub,gmi,md,pdf,tex,txt,typ}, --format {epub,gmi,md,pdf,tex,txt,typ}
ebook format (default: 'epub')
-ik INDEX_KEYWORD, --index-keyword INDEX_KEYWORD
keyword to index (default: '[]')
-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')
-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
-ss, --sort-volume-and-chapter
short volume and chapter
-rw, --raise-on-warning
raise exception and stop parsing upon warning
-ow, --overwrite
overwrite massaged TXT_FILENAME
-op, --open
open the generated file using default program
-q, --quiet
suppress all logging
-v, --verbose
show verbosity of debugging log, use -vv, -vvv for more details
-y, --yes
yes to prompt
-d, --debug
show debugging log and stacktrace
--env
print environments information for bug reporting
-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 pdf:
-pz PAGE_SIZE, --page-size PAGE_SIZE
page size of the ebook (default: 'a5')
--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
--format tex:
-ct, --clean-tex
purge artifacts generated by TeX (default: 'False')
--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,2024 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. 18506436>.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file txt2ebook-0.1.107.tar.gz
.
File metadata
- Download URL: txt2ebook-0.1.107.tar.gz
- Upload date:
- Size: 39.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.8.0-45-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e855ad3c851d288f0d74d18333380ad59391fdab4b8c4da1fce0757b0dc707ed |
|
MD5 | e5120ac2aab75bdf27479f0684a842ff |
|
BLAKE2b-256 | 07497de632283267e5e6e518c78db61b22026c8ac383619f30553f70de7b2a30 |
File details
Details for the file txt2ebook-0.1.107-py3-none-any.whl
.
File metadata
- Download URL: txt2ebook-0.1.107-py3-none-any.whl
- Upload date:
- Size: 62.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.8.0-45-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 394eaa01f29c3504c68699ff1db7d7970f1f0332a18b640b0a25a0253fc4487e |
|
MD5 | e67b28c3e8d5c741e54e414658e811ad |
|
BLAKE2b-256 | b29d4b08ac0a0e1fb98918c9b5d217e9b5b77cfd59fa10f7709a75c2a06751e2 |