txt2ebook 0.1.47__tar.gz → 0.1.52__tar.gz

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.
Files changed (42) hide show
  1. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/PKG-INFO +6 -4
  2. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/README.md +5 -3
  3. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/pyproject.toml +5 -11
  4. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/__init__.py +15 -12
  5. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/languages/zh_tw.py +3 -0
  6. txt2ebook-0.1.52/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.mo +0 -0
  7. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.po +1 -18
  8. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/locales/txt2ebook.pot +0 -17
  9. txt2ebook-0.1.52/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.mo +0 -0
  10. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.po +1 -18
  11. txt2ebook-0.1.52/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.mo +0 -0
  12. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.po +1 -13
  13. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/txt2ebook.py +10 -1
  14. txt2ebook-0.1.47/src/txt2ebook/locales/en/LC_MESSAGES/txt2ebook.mo +0 -0
  15. txt2ebook-0.1.47/src/txt2ebook/locales/zh-cn/LC_MESSAGES/txt2ebook.mo +0 -0
  16. txt2ebook-0.1.47/src/txt2ebook/locales/zh-tw/LC_MESSAGES/txt2ebook.mo +0 -0
  17. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/LICENSE.md +0 -0
  18. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/__main__.py +0 -0
  19. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/exceptions.py +0 -0
  20. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/formats/__init__.py +0 -0
  21. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/formats/base.py +0 -0
  22. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/formats/epub.py +0 -0
  23. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/formats/gmi.py +0 -0
  24. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/formats/md.py +0 -0
  25. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/formats/pdf.py +0 -0
  26. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/formats/templates/__init__.py +0 -0
  27. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/formats/templates/epub/__init__.py +0 -0
  28. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/formats/templates/epub/clean.css +0 -0
  29. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/formats/templates/epub/condense.css +0 -0
  30. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/formats/templates/epub/noindent.css +0 -0
  31. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/formats/txt.py +0 -0
  32. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/helpers/__init__.py +0 -0
  33. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/languages/__init__.py +0 -0
  34. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/languages/en.py +0 -0
  35. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/languages/zh_cn.py +3 -3
  36. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/models/__init__.py +0 -0
  37. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/models/book.py +0 -0
  38. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/models/chapter.py +0 -0
  39. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/models/volume.py +0 -0
  40. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/parser.py +0 -0
  41. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/tokenizer.py +0 -0
  42. {txt2ebook-0.1.47 → txt2ebook-0.1.52}/src/txt2ebook/zh_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: txt2ebook
3
- Version: 0.1.47
3
+ Version: 0.1.52
4
4
  Summary: CLI tool to convert txt file to ebook format
5
5
  Home-page: https://github.com/kianmeng/txt2ebook
6
6
  License: AGPL-3.0-or-later
@@ -69,14 +69,14 @@ usage: txt2ebook [-of OUTPUT_FOLDER] [-f {epub,gmi,md,pdf,txt}] [-t TITLE]
69
69
  [-ps SEPARATOR] [-pz PAGE_SIZE] [-rd REGEX] [-rvc REGEX]
70
70
  [-rv REGEX] [-rc REGEX] [-rt REGEX] [-ra REGEX] [-rl REGEX]
71
71
  [-rr REGEX REGEX] [-et {clean,condense,noindent}] [-vp] [-tp]
72
- [-sp] [-ss] [-toc] [-hn] [-fw] [-rw] [-ow] [-v] [-d] [-h]
73
- [-V]
72
+ [-sp] [-ss] [-toc] [-hn] [-fw] [-rw] [-ow] [-q] [-v] [-d]
73
+ [-h] [-V]
74
74
  TXT_FILENAME [EBOOK_FILENAME]
75
75
 
76
76
  txt2ebook/tte is a cli tool to convert txt file to ebook format.
77
77
  website: https://github.com/kianmeng/txt2ebook
78
- issues: https://github.com/kianmeng/txt2ebook/issues
79
78
  changelog: https://github.com/kianmeng/txt2ebook/blob/master/CHANGELOG.md
79
+ issues: https://github.com/kianmeng/txt2ebook/issues
80
80
 
81
81
  positional arguments:
82
82
  TXT_FILENAME
@@ -129,6 +129,8 @@ optional arguments:
129
129
  raise exception and stop parsing upon warning
130
130
  -ow, --overwrite
131
131
  overwrite massaged TXT_FILENAME
132
+ -q, --quiet
133
+ suppress all logging
132
134
  -v, --verbose
133
135
  show verbosity of debugging log, use -vv, -vvv for more details
134
136
  -d, --debug
@@ -31,14 +31,14 @@ usage: txt2ebook [-of OUTPUT_FOLDER] [-f {epub,gmi,md,pdf,txt}] [-t TITLE]
31
31
  [-ps SEPARATOR] [-pz PAGE_SIZE] [-rd REGEX] [-rvc REGEX]
32
32
  [-rv REGEX] [-rc REGEX] [-rt REGEX] [-ra REGEX] [-rl REGEX]
33
33
  [-rr REGEX REGEX] [-et {clean,condense,noindent}] [-vp] [-tp]
34
- [-sp] [-ss] [-toc] [-hn] [-fw] [-rw] [-ow] [-v] [-d] [-h]
35
- [-V]
34
+ [-sp] [-ss] [-toc] [-hn] [-fw] [-rw] [-ow] [-q] [-v] [-d]
35
+ [-h] [-V]
36
36
  TXT_FILENAME [EBOOK_FILENAME]
37
37
 
38
38
  txt2ebook/tte is a cli tool to convert txt file to ebook format.
39
39
  website: https://github.com/kianmeng/txt2ebook
40
- issues: https://github.com/kianmeng/txt2ebook/issues
41
40
  changelog: https://github.com/kianmeng/txt2ebook/blob/master/CHANGELOG.md
41
+ issues: https://github.com/kianmeng/txt2ebook/issues
42
42
 
43
43
  positional arguments:
44
44
  TXT_FILENAME
@@ -91,6 +91,8 @@ optional arguments:
91
91
  raise exception and stop parsing upon warning
92
92
  -ow, --overwrite
93
93
  overwrite massaged TXT_FILENAME
94
+ -q, --quiet
95
+ suppress all logging
94
96
  -v, --verbose
95
97
  show verbosity of debugging log, use -vv, -vvv for more details
96
98
  -d, --debug
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "txt2ebook"
3
- version = "0.1.47"
3
+ version = "0.1.52"
4
4
  description = "CLI tool to convert txt file to ebook format"
5
5
  authors = ["Kian-Meng Ang <kianmeng@cpan.org>"]
6
6
  license = "AGPL-3.0-or-later"
@@ -45,7 +45,6 @@ pep8-naming = "^0.12.1"
45
45
  pre-commit = "^2.20.0"
46
46
  pylint = "^2.11.1"
47
47
  pytest = "^7.0"
48
- pytest-console-scripts = "^1.3.1"
49
48
  pytest-cov = "^3.0.0"
50
49
  pytest-randomly = "^3.12.0"
51
50
  pytest-xdist = "^3.2.1"
@@ -58,17 +57,12 @@ vulture = "^2.3"
58
57
  txt2ebook = 'txt2ebook.txt2ebook:main'
59
58
  tte = 'txt2ebook.txt2ebook:main'
60
59
 
60
+ [tool.poetry.group.dev.dependencies]
61
+ babel = "^2.12.1"
62
+ scripttest = "^1.3"
63
+
61
64
  [build-system]
62
65
  build-backend = "poetry.core.masonry.api"
63
66
  requires = [
64
67
  "poetry-core>=1",
65
68
  ]
66
-
67
- [tool.pytest.ini_options]
68
- script_launch_mode = "subprocess"
69
-
70
- [tool.isort]
71
- profile = "black"
72
-
73
- [tool.mypy]
74
- ignore_missing_imports = 1
@@ -21,7 +21,7 @@ import sys
21
21
 
22
22
  logger = logging.getLogger(__name__)
23
23
 
24
- __version__ = "0.1.47"
24
+ __version__ = "0.1.52"
25
25
 
26
26
 
27
27
  def setup_logger(config: argparse.Namespace) -> None:
@@ -30,17 +30,20 @@ def setup_logger(config: argparse.Namespace) -> None:
30
30
  Args:
31
31
  config(argparse.Namespace): Config that contains arguments
32
32
  """
33
- logformat = {
34
- True: "%(levelname)5s: %(message)s",
35
- False: "%(message)s",
36
- }
37
-
38
- logging.basicConfig(
39
- level=config.debug and logging.DEBUG or logging.INFO,
40
- stream=sys.stdout,
41
- format=logformat[config.debug],
42
- datefmt="%Y-%m-%d %H:%M:%S",
43
- )
33
+ if config.quiet:
34
+ logging.disable(logging.NOTSET)
35
+ else:
36
+ logformat = {
37
+ True: "%(levelname)5s: %(message)s",
38
+ False: "%(message)s",
39
+ }
40
+
41
+ logging.basicConfig(
42
+ level=config.debug and logging.DEBUG or logging.INFO,
43
+ stream=sys.stdout,
44
+ format=logformat[config.debug],
45
+ datefmt="%Y-%m-%d %H:%M:%S",
46
+ )
44
47
 
45
48
 
46
49
  def log_or_raise_on_warning(msg: str, raise_on_warning: bool = False) -> None:
@@ -20,6 +20,7 @@ from txt2ebook.languages.zh_cn import (
20
20
  DEFAULT_RE_CHAPTER,
21
21
  DEFAULT_RE_TAG,
22
22
  DEFAULT_RE_TITLE,
23
+ DEFAULT_RE_TRANSLATOR,
23
24
  DEFAULT_RE_VOLUME,
24
25
  FULLWIDTH_NUMS,
25
26
  HALFWIDTH_NUMS,
@@ -32,12 +33,14 @@ from txt2ebook.languages.zh_cn import (
32
33
  DEFAULT_PDF_FONT_NAME = "AR PL UMing TW"
33
34
  DEFAULT_PDF_FONT_FILE = "uming.ttc"
34
35
  DEFAULT_PDF_FONT_SIZE = 12
36
+ DEFAULT_PDF_PAGE_SIZE = "A5"
35
37
 
36
38
  __all__ = [
37
39
  "DEFAULT_RE_AUTHOR",
38
40
  "DEFAULT_RE_CHAPTER",
39
41
  "DEFAULT_RE_TAG",
40
42
  "DEFAULT_RE_TITLE",
43
+ "DEFAULT_RE_TRANSLATOR",
41
44
  "DEFAULT_RE_VOLUME",
42
45
  "FULLWIDTH_NUMS",
43
46
  "HALFWIDTH_NUMS",
@@ -1,21 +1,3 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR ORGANIZATION
3
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4
- #
5
- msgid ""
6
- msgstr ""
7
- "Project-Id-Version: \n"
8
- "POT-Creation-Date: 2023-07-30 13:34+0800\n"
9
- "PO-Revision-Date: 2023-06-17 00:06+0800\n"
10
- "Last-Translator: \n"
11
- "Language-Team: \n"
12
- "Language: en\n"
13
- "MIME-Version: 1.0\n"
14
- "Content-Type: text/plain; charset=UTF-8\n"
15
- "Content-Transfer-Encoding: 8bit\n"
16
- "Generated-By: pygettext.py 1.5\n"
17
- "X-Generator: Poedit 3.2.2\n"
18
-
19
1
  #: src/txt2ebook/formats/base.py:94
20
2
  msgid "title:"
21
3
  msgstr "Title:"
@@ -46,3 +28,4 @@ msgstr "Cover"
46
28
  #: src/txt2ebook/formats/txt.py:55
47
29
  msgid "metadata"
48
30
  msgstr "Metadata"
31
+
@@ -1,20 +1,3 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR ORGANIZATION
3
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4
- #
5
- msgid ""
6
- msgstr ""
7
- "Project-Id-Version: PACKAGE VERSION\n"
8
- "POT-Creation-Date: 2023-07-30 13:34+0800\n"
9
- "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
- "Language-Team: LANGUAGE <LL@li.org>\n"
12
- "MIME-Version: 1.0\n"
13
- "Content-Type: text/plain; charset=UTF-8\n"
14
- "Content-Transfer-Encoding: 8bit\n"
15
- "Generated-By: pygettext.py 1.5\n"
16
-
17
-
18
1
  #: src/txt2ebook/formats/base.py:94
19
2
  msgid "title:"
20
3
  msgstr ""
@@ -1,21 +1,3 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR ORGANIZATION
3
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4
- #
5
- msgid ""
6
- msgstr ""
7
- "Project-Id-Version: \n"
8
- "POT-Creation-Date: 2023-07-30 13:34+0800\n"
9
- "PO-Revision-Date: 2023-06-17 00:04+0800\n"
10
- "Last-Translator: \n"
11
- "Language-Team: \n"
12
- "Language: zh\n"
13
- "MIME-Version: 1.0\n"
14
- "Content-Type: text/plain; charset=UTF-8\n"
15
- "Content-Transfer-Encoding: 8bit\n"
16
- "Generated-By: pygettext.py 1.5\n"
17
- "X-Generator: Poedit 3.2.2\n"
18
-
19
1
  #: src/txt2ebook/formats/base.py:94
20
2
  msgid "title:"
21
3
  msgstr "书名:"
@@ -46,3 +28,4 @@ msgstr "封面"
46
28
  #: src/txt2ebook/formats/txt.py:55
47
29
  msgid "metadata"
48
30
  msgstr "元数据"
31
+
@@ -1,16 +1,3 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: \n"
4
- "POT-Creation-Date: 2023-07-30 13:34+0800\n"
5
- "PO-Revision-Date: \n"
6
- "Last-Translator: \n"
7
- "Language-Team: \n"
8
- "Language: zh_TW\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 3.2.2\n"
13
-
14
1
  #: src/txt2ebook/formats/base.py:94
15
2
  msgid "title:"
16
3
  msgstr "书名:"
@@ -41,3 +28,4 @@ msgstr "封面"
41
28
  #: src/txt2ebook/formats/txt.py:55
42
29
  msgid "metadata"
43
30
  msgstr "元数据"
31
+
@@ -400,6 +400,15 @@ def build_parser(
400
400
  help="overwrite massaged TXT_FILENAME",
401
401
  )
402
402
 
403
+ parser.add_argument(
404
+ "-q",
405
+ "--quiet",
406
+ default=False,
407
+ action="store_true",
408
+ dest="quiet",
409
+ help="suppress all logging",
410
+ )
411
+
403
412
  parser.add_argument(
404
413
  "-v",
405
414
  "--verbose",
@@ -438,8 +447,8 @@ def _doc() -> str:
438
447
  return (
439
448
  __doc__
440
449
  + f"\n website: {repo_url}"
441
- + f"\n issues: {repo_url}/issues"
442
450
  + f"\n changelog: {repo_url}/blob/master/CHANGELOG.md"
451
+ + f"\n issues: {repo_url}/issues"
443
452
  )
444
453
 
445
454
 
File without changes
@@ -49,14 +49,14 @@ RE_CHAPTERS = [
49
49
  "人物谱",
50
50
  ]
51
51
 
52
- DEFAULT_RE_TITLE = r"书名:(.*)"
53
52
  DEFAULT_RE_AUTHOR = r"作者:(.*)"
53
+ DEFAULT_RE_CHAPTER = "(" + "|".join(RE_CHAPTERS) + ")"
54
54
  DEFAULT_RE_TAG = r"标签:(.*)"
55
+ DEFAULT_RE_TITLE = r"书名:(.*)"
55
56
  DEFAULT_RE_TRANSLATOR = r"翻译:(.*)"
56
57
  DEFAULT_RE_VOLUME = "(" + "|".join(RE_VOLUMES) + ")"
57
- DEFAULT_RE_CHAPTER = "(" + "|".join(RE_CHAPTERS) + ")"
58
58
 
59
- DEFAULT_PDF_FONT_NAME = "AR PL UMing CN"
60
59
  DEFAULT_PDF_FONT_FILE = "uming.ttc"
60
+ DEFAULT_PDF_FONT_NAME = "AR PL UMing CN"
61
61
  DEFAULT_PDF_FONT_SIZE = 12
62
62
  DEFAULT_PDF_PAGE_SIZE = "A5"