forked from LiveCarta/BookConverter
fix mistype
This commit is contained in:
@@ -29,7 +29,7 @@ class Book:
|
||||
"Verdana": "verdana,geneva,sans-serif"
|
||||
}
|
||||
|
||||
SUPPPORTED_LEVELS = 3
|
||||
SUPPORTED_LEVELS = 3
|
||||
SUPPORTED_HEADERS = {"h1", "h2", "h3"}
|
||||
HEADERS_LEVELS = {"h1", "h2", "h3", "h4", "h5", "h6", "h7", "h8", "h9"}
|
||||
|
||||
@@ -49,7 +49,7 @@ class Book:
|
||||
self.images = list()
|
||||
self.content_dict = dict()
|
||||
|
||||
assert self.SUPPPORTED_LEVELS == len(self.SUPPORTED_HEADERS), \
|
||||
assert self.SUPPORTED_LEVELS == len(self.SUPPORTED_HEADERS), \
|
||||
"Length of headers doesn't match allowd levels."
|
||||
|
||||
def configure_file_logger(self, name, attr_name='logger', filename='logs/book_log.log', filemode='w+',
|
||||
@@ -553,7 +553,7 @@ class Book:
|
||||
"""
|
||||
Function to convert all lower level headings to p tags
|
||||
"""
|
||||
pattern = f'^h[{self.SUPPPORTED_LEVELS + 1}-9]$'
|
||||
pattern = f'^h[{self.SUPPORTED_LEVELS + 1}-9]$'
|
||||
header_tags = self.body_tag.find_all(re.compile(pattern))
|
||||
for tag in header_tags:
|
||||
tag.name = 'p'
|
||||
@@ -575,7 +575,7 @@ class Book:
|
||||
tag.unwrap()
|
||||
else:
|
||||
assert tag.name in self.SUPPORTED_HEADERS, \
|
||||
f'Preprocessing went wrong, there is still h{self.SUPPPORTED_LEVELS+1}-h9 headings.'
|
||||
f'Preprocessing went wrong, there is still h{self.SUPPORTED_LEVELS + 1}-h9 headings.'
|
||||
# if tag.name in ["h4", "h5", "h6"]:
|
||||
# tag.name = "h3" # All the lower level headings will be transformed to h3 headings
|
||||
|
||||
|
||||
Reference in New Issue
Block a user