# txt2ebook
A console tool to convert txt file to different ebook formats.
## Installation
Stable version From PyPI:
```console
python3 -m pip install txt2ebook
```
Upgrade to latest stable version:
```console
python3 -m pip install txt2ebook --upgrade
```
Latest development version from GitHub:
```console
python3 -m pip install -e git+https://github.com/kianmeng/txt2ebook.git
```
## Usage
Showing help message of command-line options:
```console
txt2ebook --help
```
```console
usage: txt2ebook [-of OUTPUT_FOLDER] [-p] [-f {epub,gmi,md,pdf,tex,txt,typ}]
[-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] [-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')
optional arguments:
-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')
-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
--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:
```console
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>.
Raw data
{
"_id": null,
"home_page": "https://github.com/kianmeng/txt2ebook",
"name": "txt2ebook",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "txt, ebook, epub, cjk",
"author": "Kian-Meng Ang",
"author_email": "kianmeng@cpan.org",
"download_url": "https://files.pythonhosted.org/packages/cf/b1/d4020ff05bf50c89fd826dd4718f3956f2da4e079d6228fe043d0cd21a32/txt2ebook-0.1.83.tar.gz",
"platform": null,
"description": "# txt2ebook\n\nA console tool to convert txt file to different ebook formats.\n\n## Installation\n\nStable version From PyPI:\n\n```console\npython3 -m pip install txt2ebook\n```\n\nUpgrade to latest stable version:\n\n```console\npython3 -m pip install txt2ebook --upgrade\n```\n\nLatest development version from GitHub:\n\n```console\npython3 -m pip install -e git+https://github.com/kianmeng/txt2ebook.git\n```\n\n## Usage\n\nShowing help message of command-line options:\n\n```console\ntxt2ebook --help\n```\n\n```console\nusage: txt2ebook [-of OUTPUT_FOLDER] [-p] [-f {epub,gmi,md,pdf,tex,txt,typ}]\n [-t TITLE] [-l LANGUAGE] [-a AUTHOR] [-tr TRANSLATOR]\n [-c IMAGE_FILENAME] [-w WIDTH] [-ff FILENAME_FORMAT]\n [-ps SEPARATOR] [-pz PAGE_SIZE] [-rd REGEX] [-rvc REGEX]\n [-rv REGEX] [-rc REGEX] [-rt REGEX] [-ra REGEX] [-rl REGEX]\n [-rr REGEX REGEX] [-et {clean,condense,noindent}] [-vp] [-tp]\n [-sp] [-ss] [-toc] [-hn] [-fw] [-rw] [-ow] [-op] [-q] [-v]\n [-y] [-d] [--env] [-h] [-V]\n TXT_FILENAME [EBOOK_FILENAME]\n\ntxt2ebook/tte is a cli tool to convert txt file to ebook format.\n\n website: https://github.com/kianmeng/txt2ebook\n changelog: https://github.com/kianmeng/txt2ebook/blob/master/CHANGELOG.md\n issues: https://github.com/kianmeng/txt2ebook/issues\n\npositional arguments:\n TXT_FILENAME\n source text filename\n EBOOK_FILENAME\n converted ebook filename (default: 'TXT_FILENAME.epub')\n\noptional arguments:\n -of OUTPUT_FOLDER, --output-folder OUTPUT_FOLDER\n set default output folder (default: 'output')\n -p, --purge\n remove converted ebooks specified by --output-folder option (default: 'False')\n -f {epub,gmi,md,pdf,tex,txt,typ}, --format {epub,gmi,md,pdf,tex,txt,typ}\n ebook format (default: 'epub')\n -t TITLE, --title TITLE\n title of the ebook (default: 'None')\n -l LANGUAGE, --language LANGUAGE\n language of the ebook (default: 'None')\n -a AUTHOR, --author AUTHOR\n author of the ebook (default: '[]')\n -tr TRANSLATOR, --translator TRANSLATOR\n translator of the ebook (default: '[]')\n -ff FILENAME_FORMAT, --filename-format FILENAME_FORMAT\n the output filename format (default: TXT_FILENAME [EBOOK_FILENAME])\n 1 - title_authors.EBOOK_EXTENSION\n 2 - authors_title.EBOOK_EXTENSION\n -ps SEPARATOR, --paragraph_separator SEPARATOR\n paragraph separator (default: '\\n\\n')\n -rd REGEX, --regex-delete REGEX\n regex to delete word or phrase (default: '[]')\n -rvc REGEX, --regex-volume-chapter REGEX\n regex to parse volume and chapter header (default: by LANGUAGE)\n -rv REGEX, --regex-volume REGEX\n regex to parse volume header (default: by LANGUAGE)\n -rc REGEX, --regex-chapter REGEX\n regex to parse chapter header (default: by LANGUAGE)\n -rt REGEX, --regex-title REGEX\n regex to parse title of the book (default: by LANGUAGE)\n -ra REGEX, --regex-author REGEX\n regex to parse author of the book (default: by LANGUAGE)\n -rl REGEX, --regex-delete-line REGEX\n regex to delete whole line (default: '[]')\n -rr REGEX REGEX, --regex-replace REGEX REGEX\n regex to search and replace (default: '[]')\n -tp, --test-parsing\n test parsing for volume/chapter header\n -ss, --sort-volume-and-chapter\n short volume and chapter\n -rw, --raise-on-warning\n raise exception and stop parsing upon warning\n -ow, --overwrite\n overwrite massaged TXT_FILENAME\n -op, --open\n open the generated file using default program\n -q, --quiet\n suppress all logging\n -v, --verbose\n show verbosity of debugging log, use -vv, -vvv for more details\n -y, --yes\n yes to prompt\n -d, --debug\n show debugging log and stacktrace\n --env\n print environments information for bug reporting\n -h, --help\n show this help message and exit\n -V, --version\n show program's version number and exit\n\n--format epub:\n -c IMAGE_FILENAME, --cover IMAGE_FILENAME\n cover of the ebook\n -et {clean,condense,noindent}, --epub-template {clean,condense,noindent}\n CSS template for epub ebook (default: 'clean')\n -vp, --volume-page\n generate each volume as separate page\n\n--format pdf:\n -pz PAGE_SIZE, --page-size PAGE_SIZE\n page size of the ebook (default: 'a5')\n\n--format txt:\n -w WIDTH, --width WIDTH\n width for line wrapping\n -sp, --split-volume-and-chapter\n split volume or chapter into separate file and ignore the --overwrite option\n -toc, --table-of-content\n add table of content\n\n--language zh-cn / --language zh-tw:\n -hn, --header-number\n convert section header from words to numbers\n -fw, --fullwidth\n convert ASCII character from halfwidth to fullwidth\n```\n\nConvert a txt file into epub:\n\n```console\ntxt2ebook ebook.txt\n```\n\n## Copyright and License\n\nCopyright (c) 2021,2022,2023,2024 Kian-Meng Ang\n\nThis program is free software: you can redistribute it and/or modify it under\nthe terms of the GNU Affero General Public License as published by the Free\nSoftware Foundation, either version 3 of the License, or (at your option) any\nlater version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\nPARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License along\nwith this program. If not, see <https://www.gnu.org/licenses/>.\n\nThe fish logo used in the documentation generated by Sphinx is a public domain\ndrawing of Troschel's parrotfish (Chlorurus troschelii Var. A.) from\n<https://commons.wikimedia.org/entity/M18506436>.\n",
"bugtrack_url": null,
"license": "AGPL-3.0-or-later",
"summary": "CLI tool to convert txt file to ebook format",
"version": "0.1.83",
"project_urls": {
"Homepage": "https://github.com/kianmeng/txt2ebook",
"Repository": "https://github.com/kianmeng/txt2ebook"
},
"split_keywords": [
"txt",
" ebook",
" epub",
" cjk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2c084c2b00bf4741a42d65d40daaf03c0ca2667497c741d0c7888a57c5e56467",
"md5": "bb399210c423caff2c3bdef917ac1b00",
"sha256": "5ae1b5972b1dd9697dfcf553c19d87b7e82d6f046461c4f1777119dcad269de4"
},
"downloads": -1,
"filename": "txt2ebook-0.1.83-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bb399210c423caff2c3bdef917ac1b00",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 61414,
"upload_time": "2024-04-13T17:22:36",
"upload_time_iso_8601": "2024-04-13T17:22:36.907614Z",
"url": "https://files.pythonhosted.org/packages/2c/08/4c2b00bf4741a42d65d40daaf03c0ca2667497c741d0c7888a57c5e56467/txt2ebook-0.1.83-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cfb1d4020ff05bf50c89fd826dd4718f3956f2da4e079d6228fe043d0cd21a32",
"md5": "4582c7f4bf11a7e14a87cf13387ee0bd",
"sha256": "c784cbc79428be7a9c051fe9587141e16585fc1666ceb89e48d8a3f52ef5089f"
},
"downloads": -1,
"filename": "txt2ebook-0.1.83.tar.gz",
"has_sig": false,
"md5_digest": "4582c7f4bf11a7e14a87cf13387ee0bd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 38444,
"upload_time": "2024-04-13T17:22:40",
"upload_time_iso_8601": "2024-04-13T17:22:40.345167Z",
"url": "https://files.pythonhosted.org/packages/cf/b1/d4020ff05bf50c89fd826dd4718f3956f2da4e079d6228fe043d0cd21a32/txt2ebook-0.1.83.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-13 17:22:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kianmeng",
"github_project": "txt2ebook",
"github_not_found": true,
"lcname": "txt2ebook"
}