forked from LiveCarta/BookConverter
Add ability to get file from import in css
This commit is contained in:
@@ -121,6 +121,9 @@ class EpubConverter:
|
||||
path_to_css_from_root = normpath(
|
||||
join(html_folder, path_to_css_from_html)).replace('\\', '/')
|
||||
css_obj = self.ebooklib_book.get_item_with_href(path_to_css_from_root)
|
||||
if "@import" in str(css_obj.content):
|
||||
path_to_css_from_root = "css/" + re.search('"(.*)"', str(css_obj.content)).group(1)
|
||||
css_obj = self.ebooklib_book.get_item_with_href(path_to_css_from_root)
|
||||
assert css_obj, f'Css style {css_href} was not in manifest.'
|
||||
css_content: str = css_obj.get_content().decode()
|
||||
return css_content
|
||||
|
||||
Reference in New Issue
Block a user