From 53d43dd061425bfd062003f99ee1edc5d2cbdd78 Mon Sep 17 00:00:00 2001 From: shirshasa Date: Tue, 7 Sep 2021 16:13:14 +0300 Subject: [PATCH] epub converter: fix adding nested style tags --- src/css_reader.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/css_reader.py b/src/css_reader.py index 433e841..e19935a 100644 --- a/src/css_reader.py +++ b/src/css_reader.py @@ -255,11 +255,12 @@ class TagStyleConverter: if new_tags: tmp_attrs = top_tag.attrs.copy() - top_tag = BeautifulSoup(features='lxml').new_tag(self.tag_initial_name) - top_tag.attrs = tmp_attrs + top_tag.attrs = {} + top_tag2 = BeautifulSoup(features='lxml').new_tag(self.tag_initial_name) + top_tag2.attrs = tmp_attrs if self.style: - top_tag.attrs['style'] = self.style - new_tags[-1].wrap(top_tag) + top_tag2.attrs['style'] = self.style + new_tags[-1].wrap(top_tag2) else: top_tag.attrs['style'] = self.style