txt2ebook 0.1.156__tar.gz → 0.1.157__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 (63) hide show
  1. {txt2ebook-0.1.156/src/txt2ebook.egg-info → txt2ebook-0.1.157}/PKG-INFO +17 -1
  2. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/pyproject.toml +15 -15
  3. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/subcommands/massage.py +30 -9
  4. {txt2ebook-0.1.156 → txt2ebook-0.1.157/src/txt2ebook.egg-info}/PKG-INFO +17 -1
  5. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook.egg-info/requires.txt +19 -0
  6. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/LICENSE.md +0 -0
  7. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/README.md +0 -0
  8. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/setup.cfg +0 -0
  9. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/__init__.py +0 -0
  10. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/__main__.py +0 -0
  11. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/cli.py +0 -0
  12. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/exceptions.py +0 -0
  13. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/formats/__init__.py +0 -0
  14. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/formats/base.py +0 -0
  15. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/formats/epub.py +0 -0
  16. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/formats/gmi.py +0 -0
  17. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/formats/md.py +0 -0
  18. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/formats/pdf.py +0 -0
  19. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/formats/templates/__init__.py +0 -0
  20. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/formats/templates/epub/__init__.py +0 -0
  21. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/formats/tex.py +0 -0
  22. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/formats/txt.py +0 -0
  23. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/formats/typ.py +0 -0
  24. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/helpers/__init__.py +0 -0
  25. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/languages/__init__.py +0 -0
  26. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/languages/en.py +0 -0
  27. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/languages/zh_cn.py +0 -0
  28. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/languages/zh_tw.py +0 -0
  29. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/models/__init__.py +0 -0
  30. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/models/book.py +0 -0
  31. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/models/chapter.py +0 -0
  32. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/models/volume.py +0 -0
  33. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/parser.py +0 -0
  34. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/subcommands/__init__.py +0 -0
  35. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/subcommands/env.py +0 -0
  36. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/subcommands/epub.py +0 -0
  37. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/subcommands/gmi.py +0 -0
  38. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/subcommands/md.py +0 -0
  39. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/subcommands/parse.py +0 -0
  40. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/subcommands/pdf.py +0 -0
  41. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/subcommands/tex.py +0 -0
  42. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/subcommands/typ.py +0 -0
  43. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/tokenizer.py +0 -0
  44. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook/zh_utils.py +0 -0
  45. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook.egg-info/SOURCES.txt +0 -0
  46. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook.egg-info/dependency_links.txt +0 -0
  47. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook.egg-info/entry_points.txt +0 -0
  48. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/src/txt2ebook.egg-info/top_level.txt +0 -0
  49. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_header_number_flag.py +0 -0
  50. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_input_file_arg.py +0 -0
  51. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_language_option.py +0 -0
  52. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_output_file_arg.py +0 -0
  53. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_overwrite_flag.py +0 -0
  54. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_parser.py +0 -0
  55. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_purge_flag.py +0 -0
  56. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_quiet_flag.py +0 -0
  57. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_sort_volume_and_chapter_flag.py +0 -0
  58. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_split_volume_and_chapter_flag.py +0 -0
  59. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_test_parsing_flag.py +0 -0
  60. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_tokenizer.py +0 -0
  61. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_txt2ebook.py +0 -0
  62. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_verbose_flag.py +0 -0
  63. {txt2ebook-0.1.156 → txt2ebook-0.1.157}/tests/test_volume_page_flag.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: txt2ebook
3
- Version: 0.1.156
3
+ Version: 0.1.157
4
4
  Summary: CLI tool to convert txt file to ebook format
5
5
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -39,6 +39,22 @@ Requires-Dist: regex<2022,>=2021.11.10
39
39
  Requires-Dist: reportlab<5,>=4.0.0
40
40
  Requires-Dist: typing-extensions<5,>=4.5.0
41
41
  Requires-Dist: typst>=0.13.0
42
+ Provides-Extra: test
43
+ Requires-Dist: pytest; extra == "test"
44
+ Requires-Dist: pytest-cov; extra == "test"
45
+ Requires-Dist: pytest-randomly; extra == "test"
46
+ Requires-Dist: pytest-xdist; extra == "test"
47
+ Requires-Dist: scripttest; extra == "test"
48
+ Provides-Extra: doc
49
+ Requires-Dist: myst-parser; extra == "doc"
50
+ Requires-Dist: sphinx; extra == "doc"
51
+ Requires-Dist: sphinx-autobuild; extra == "doc"
52
+ Requires-Dist: sphinx-autodoc-typehints; extra == "doc"
53
+ Requires-Dist: sphinx-copybutton; extra == "doc"
54
+ Provides-Extra: lint
55
+ Requires-Dist: pre-commit; extra == "lint"
56
+ Requires-Dist: ruff; extra == "lint"
57
+ Requires-Dist: mypy; extra == "lint"
42
58
  Dynamic: license-file
43
59
 
44
60
  # txt2ebook
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "txt2ebook"
3
- version = "0.1.156"
3
+ version = "0.1.157"
4
4
  description = "CLI tool to convert txt file to ebook format"
5
5
  authors = [{ name = "Kian-Meng Ang", email = "kianmeng@cpan.org" }]
6
6
  requires-python = "~=3.9"
@@ -60,26 +60,26 @@ Repository = "https://github.com/kianmeng/txt2ebook"
60
60
  txt2ebook = "txt2ebook.cli:main"
61
61
  tte = "txt2ebook.cli:main"
62
62
 
63
- [dependency-groups]
64
- dev = [
65
- "babel",
66
- "bandit",
67
- "flake8-simplify",
68
- "mypy",
69
- "myst-parser",
70
- "nox",
71
- "pep8-naming",
72
- "pre-commit",
63
+ [project.optional-dependencies]
64
+ test = [
65
+ "pytest",
73
66
  "pytest-cov",
74
67
  "pytest-randomly",
75
68
  "pytest-xdist",
76
- "pytest",
77
- "ruff",
78
69
  "scripttest",
70
+ ]
71
+ doc = [
72
+ "myst-parser",
73
+ "sphinx",
74
+ "sphinx-autobuild",
79
75
  "sphinx-autodoc-typehints",
80
76
  "sphinx-copybutton",
81
- "sphinx",
82
- "vulture",
77
+ ]
78
+
79
+ lint = [
80
+ "pre-commit",
81
+ "ruff",
82
+ "mypy",
83
83
  ]
84
84
 
85
85
  [build-system]
@@ -210,7 +210,7 @@ def run(args: argparse.Namespace) -> None:
210
210
  """Run massage subcommand.
211
211
 
212
212
  Args:
213
- args (argparse.Namespace): args.from command line arguments
213
+ args (argparse.Namespace): arguments from command line arguments
214
214
 
215
215
  Returns:
216
216
  None
@@ -472,7 +472,6 @@ def extract_metadata_and_body(_args, content: str) -> tuple:
472
472
  metadata = match.group(0).strip()
473
473
  body = content.replace(metadata, "", 1)
474
474
 
475
-
476
475
  metadata_block = metadata.split("---")[1]
477
476
 
478
477
  metadata_dict = {}
@@ -492,33 +491,38 @@ def extract_metadata_and_body(_args, content: str) -> tuple:
492
491
  return (meta_str, body)
493
492
 
494
493
 
495
- def do_single_newline(args, content: str) -> str:
494
+ def do_single_newline(args: argparse.Namespace, content: str) -> str:
496
495
  """Set single newline.
497
496
 
498
497
  Args:
499
- content (str): The formatted book content.
498
+ args (argparse.Namespace): arguments from command line arguments
499
+ content (str): The formatted book content
500
500
 
501
501
  Returns:
502
502
  str: The formatted book content.
503
503
  """
504
- modified_content = re.sub(r"\n+", "\n\n", content)
504
+ unwrap_content = _unwrap_content(args, content)
505
+ modified_content = re.sub(r"\n+", "\n\n", unwrap_content)
505
506
  return modified_content
506
507
 
507
508
 
508
- def do_wrapping(args, content: str) -> str:
509
+ def do_wrapping(args: argparse.Namespace, content: str) -> str:
509
510
  """Wrap or fill CJK text.
510
511
 
511
512
  Args:
512
- content (str): The formatted book content.
513
+ args (argparse.Namespace): arguments from command line arguments
514
+ content (str): The formatted book content
513
515
 
514
516
  Returns:
515
517
  str: The formatted book content.
516
518
  """
517
519
  logger.info("Wrapping paragraph to width: %s", args.width)
518
520
 
521
+ unwrap_content = _unwrap_content(args, content)
522
+
523
+ # don't remove empty line and keep all formatting as it
519
524
  paragraphs = []
520
- # We don't remove empty line and keep all formatting as it.
521
- for paragraph in content.split("\n"):
525
+ for paragraph in unwrap_content.split("\n"):
522
526
  paragraph = paragraph.strip()
523
527
 
524
528
  lines = cjkwrap.wrap(paragraph, width=args.width)
@@ -527,3 +531,20 @@ def do_wrapping(args, content: str) -> str:
527
531
 
528
532
  wrapped_content = "\n".join(paragraphs)
529
533
  return wrapped_content
534
+
535
+
536
+ def _unwrap_content(args: argparse.Namespace, content: str) -> str:
537
+ """
538
+ Args:
539
+ args (argparse.Namespace): arguments from command line arguments
540
+ content (str): The formatted book content
541
+
542
+ Returns:
543
+ str: The formatted book content.
544
+ """
545
+ paragraphs = content.split(args.paragraph_separator)
546
+ processed_paragraphs = []
547
+ for paragraph in paragraphs:
548
+ single_line_paragraph = " ".join(paragraph.splitlines())
549
+ processed_paragraphs.append(single_line_paragraph.strip())
550
+ return args.paragraph_separator.join(processed_paragraphs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: txt2ebook
3
- Version: 0.1.156
3
+ Version: 0.1.157
4
4
  Summary: CLI tool to convert txt file to ebook format
5
5
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -39,6 +39,22 @@ Requires-Dist: regex<2022,>=2021.11.10
39
39
  Requires-Dist: reportlab<5,>=4.0.0
40
40
  Requires-Dist: typing-extensions<5,>=4.5.0
41
41
  Requires-Dist: typst>=0.13.0
42
+ Provides-Extra: test
43
+ Requires-Dist: pytest; extra == "test"
44
+ Requires-Dist: pytest-cov; extra == "test"
45
+ Requires-Dist: pytest-randomly; extra == "test"
46
+ Requires-Dist: pytest-xdist; extra == "test"
47
+ Requires-Dist: scripttest; extra == "test"
48
+ Provides-Extra: doc
49
+ Requires-Dist: myst-parser; extra == "doc"
50
+ Requires-Dist: sphinx; extra == "doc"
51
+ Requires-Dist: sphinx-autobuild; extra == "doc"
52
+ Requires-Dist: sphinx-autodoc-typehints; extra == "doc"
53
+ Requires-Dist: sphinx-copybutton; extra == "doc"
54
+ Provides-Extra: lint
55
+ Requires-Dist: pre-commit; extra == "lint"
56
+ Requires-Dist: ruff; extra == "lint"
57
+ Requires-Dist: mypy; extra == "lint"
42
58
  Dynamic: license-file
43
59
 
44
60
  # txt2ebook
@@ -11,3 +11,22 @@ regex<2022,>=2021.11.10
11
11
  reportlab<5,>=4.0.0
12
12
  typing-extensions<5,>=4.5.0
13
13
  typst>=0.13.0
14
+
15
+ [doc]
16
+ myst-parser
17
+ sphinx
18
+ sphinx-autobuild
19
+ sphinx-autodoc-typehints
20
+ sphinx-copybutton
21
+
22
+ [lint]
23
+ pre-commit
24
+ ruff
25
+ mypy
26
+
27
+ [test]
28
+ pytest
29
+ pytest-cov
30
+ pytest-randomly
31
+ pytest-xdist
32
+ scripttest
File without changes
File without changes
File without changes