txt2ebook 0.1.162__tar.gz → 0.1.163__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.
- {txt2ebook-0.1.162/src/txt2ebook.egg-info → txt2ebook-0.1.163}/PKG-INFO +1 -1
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/pyproject.toml +1 -1
 - txt2ebook-0.1.162/src/txt2ebook/zh_utils.py → txt2ebook-0.1.163/src/txt2ebook/languages/zh_base.py +1 -1
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/parser.py +11 -11
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/subcommands/massage.py +1 -1
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163/src/txt2ebook.egg-info}/PKG-INFO +1 -1
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook.egg-info/SOURCES.txt +1 -1
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/LICENSE.md +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/README.md +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/setup.cfg +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/__init__.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/__main__.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/cli.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/exceptions.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/formats/__init__.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/formats/base.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/formats/epub.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/formats/gmi.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/formats/md.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/formats/pdf.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/formats/templates/__init__.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/formats/templates/epub/__init__.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/formats/tex.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/formats/txt.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/formats/typ.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/helpers/__init__.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/languages/__init__.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/languages/en.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/languages/zh_cn.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/languages/zh_tw.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/models/__init__.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/models/book.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/models/chapter.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/models/volume.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/subcommands/__init__.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/subcommands/env.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/subcommands/epub.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/subcommands/gmi.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/subcommands/md.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/subcommands/parse.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/subcommands/pdf.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/subcommands/tex.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/subcommands/typ.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook/tokenizer.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook.egg-info/dependency_links.txt +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook.egg-info/entry_points.txt +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook.egg-info/requires.txt +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/src/txt2ebook.egg-info/top_level.txt +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/tests/test_parser.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/tests/test_tokenizer.py +0 -0
 - {txt2ebook-0.1.162 → txt2ebook-0.1.163}/tests/test_txt2ebook.py +0 -0
 
| 
         @@ -20,13 +20,16 @@ import logging 
     | 
|
| 
       20 
20 
     | 
    
         
             
            from collections import Counter
         
     | 
| 
       21 
21 
     | 
    
         
             
            from dataclasses import dataclass
         
     | 
| 
       22 
22 
     | 
    
         
             
            from types import ModuleType
         
     | 
| 
       23 
     | 
    
         
            -
            from typing import List, Tuple
         
     | 
| 
      
 23 
     | 
    
         
            +
            from typing import List, Tuple, Union
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
            import regex as re
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
            from txt2ebook.models import Book, Chapter, Volume
         
     | 
| 
       28 
28 
     | 
    
         
             
            from txt2ebook.tokenizer import Token, Tokenizer
         
     | 
| 
       29 
     | 
    
         
            -
            from txt2ebook. 
     | 
| 
      
 29 
     | 
    
         
            +
            from txt2ebook.languages.zh_base import (
         
     | 
| 
      
 30 
     | 
    
         
            +
                zh_halfwidth_to_fullwidth,
         
     | 
| 
      
 31 
     | 
    
         
            +
                zh_words_to_numbers,
         
     | 
| 
      
 32 
     | 
    
         
            +
            )
         
     | 
| 
       30 
33 
     | 
    
         | 
| 
       31 
34 
     | 
    
         
             
            logger = logging.getLogger(__name__)
         
     | 
| 
       32 
35 
     | 
    
         | 
| 
         @@ -290,13 +293,13 @@ class Parser: 
     | 
|
| 
       290 
293 
     | 
    
         
             
                            self._process_paragraph_token(token, toc)
         
     | 
| 
       291 
294 
     | 
    
         | 
| 
       292 
295 
     | 
    
         
             
                    # Use authors if set explicitly from command line.
         
     | 
| 
       293 
     | 
    
         
            -
                    if  
     | 
| 
      
 296 
     | 
    
         
            +
                    if getattr(self.config, "author", None):
         
     | 
| 
       294 
297 
     | 
    
         
             
                        book_data["authors"] = self.config.author
         
     | 
| 
       295 
298 
     | 
    
         | 
| 
       296 
     | 
    
         
            -
                    if  
     | 
| 
      
 299 
     | 
    
         
            +
                    if getattr(self.config, "title", None):
         
     | 
| 
       297 
300 
     | 
    
         
             
                        book_data["book_title"] = self.config.title
         
     | 
| 
       298 
301 
     | 
    
         | 
| 
       299 
     | 
    
         
            -
                    if  
     | 
| 
      
 302 
     | 
    
         
            +
                    if getattr(self.config, "translator", None):
         
     | 
| 
       300 
303 
     | 
    
         
             
                        book_data["translators"] = self.config.translator
         
     | 
| 
       301 
304 
     | 
    
         | 
| 
       302 
305 
     | 
    
         
             
                    logger.info("Found or set book title: %s", book_data["book_title"])
         
     | 
| 
         @@ -307,10 +310,7 @@ class Parser: 
     | 
|
| 
       307 
310 
     | 
    
         
             
                    logger.info("Found or set tags: %s", repr(book_data["tags"]))
         
     | 
| 
       308 
311 
     | 
    
         
             
                    logger.info("Found or set index: %s", repr(book_data["index"]))
         
     | 
| 
       309 
312 
     | 
    
         | 
| 
       310 
     | 
    
         
            -
                    if (
         
     | 
| 
       311 
     | 
    
         
            -
                        hasattr(self.config, "sort_volume_and_chapter")
         
     | 
| 
       312 
     | 
    
         
            -
                        and self.config.sort_volume_and_chapter
         
     | 
| 
       313 
     | 
    
         
            -
                    ):
         
     | 
| 
      
 313 
     | 
    
         
            +
                    if getattr(self.config, "sort_volume_and_chapter", False):
         
     | 
| 
       314 
314 
     | 
    
         
             
                        self.sort_volume_and_chapter(toc)
         
     | 
| 
       315 
315 
     | 
    
         | 
| 
       316 
316 
     | 
    
         
             
                    return (
         
     | 
| 
         @@ -322,11 +322,11 @@ class Parser: 
     | 
|
| 
       322 
322 
     | 
    
         
             
                        toc,
         
     | 
| 
       323 
323 
     | 
    
         
             
                    )
         
     | 
| 
       324 
324 
     | 
    
         | 
| 
       325 
     | 
    
         
            -
                def sort_volume_and_chapter(self, toc: List) -> None:
         
     | 
| 
      
 325 
     | 
    
         
            +
                def sort_volume_and_chapter(self, toc: List[Union[Volume, Chapter]]) -> None:
         
     | 
| 
       326 
326 
     | 
    
         
             
                    """Sort by title of volumes and its chapters.
         
     | 
| 
       327 
327 
     | 
    
         | 
| 
       328 
328 
     | 
    
         
             
                    Args:
         
     | 
| 
       329 
     | 
    
         
            -
                        toc(List): The parsed table of content
         
     | 
| 
      
 329 
     | 
    
         
            +
                        toc(List[Union[Volume, Chapter]]): The parsed table of content
         
     | 
| 
       330 
330 
     | 
    
         | 
| 
       331 
331 
     | 
    
         
             
                    Returns:
         
     | 
| 
       332 
332 
     | 
    
         
             
                        str: The formatted book content
         
     | 
| 
         @@ -31,7 +31,7 @@ from txt2ebook.exceptions import EmptyFileError 
     | 
|
| 
       31 
31 
     | 
    
         
             
            from txt2ebook.formats.txt import TxtWriter
         
     | 
| 
       32 
32 
     | 
    
         
             
            from txt2ebook.models.book import Book
         
     | 
| 
       33 
33 
     | 
    
         
             
            from txt2ebook.parser import Parser
         
     | 
| 
       34 
     | 
    
         
            -
            from txt2ebook. 
     | 
| 
      
 34 
     | 
    
         
            +
            from txt2ebook.languages.zh_base import zh_halfwidth_to_fullwidth, zh_words_to_numbers
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
36 
     | 
    
         
             
            logger = logging.getLogger(__name__)
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
         @@ -7,7 +7,6 @@ src/txt2ebook/cli.py 
     | 
|
| 
       7 
7 
     | 
    
         
             
            src/txt2ebook/exceptions.py
         
     | 
| 
       8 
8 
     | 
    
         
             
            src/txt2ebook/parser.py
         
     | 
| 
       9 
9 
     | 
    
         
             
            src/txt2ebook/tokenizer.py
         
     | 
| 
       10 
     | 
    
         
            -
            src/txt2ebook/zh_utils.py
         
     | 
| 
       11 
10 
     | 
    
         
             
            src/txt2ebook.egg-info/PKG-INFO
         
     | 
| 
       12 
11 
     | 
    
         
             
            src/txt2ebook.egg-info/SOURCES.txt
         
     | 
| 
       13 
12 
     | 
    
         
             
            src/txt2ebook.egg-info/dependency_links.txt
         
     | 
| 
         @@ -28,6 +27,7 @@ src/txt2ebook/formats/templates/epub/__init__.py 
     | 
|
| 
       28 
27 
     | 
    
         
             
            src/txt2ebook/helpers/__init__.py
         
     | 
| 
       29 
28 
     | 
    
         
             
            src/txt2ebook/languages/__init__.py
         
     | 
| 
       30 
29 
     | 
    
         
             
            src/txt2ebook/languages/en.py
         
     | 
| 
      
 30 
     | 
    
         
            +
            src/txt2ebook/languages/zh_base.py
         
     | 
| 
       31 
31 
     | 
    
         
             
            src/txt2ebook/languages/zh_cn.py
         
     | 
| 
       32 
32 
     | 
    
         
             
            src/txt2ebook/languages/zh_tw.py
         
     | 
| 
       33 
33 
     | 
    
         
             
            src/txt2ebook/models/__init__.py
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     |