epub converter: add internal links processing3

This commit is contained in:
shirshasa
2021-05-27 12:15:48 +03:00
parent 836e2dbc11
commit ab7a944bfb

View File

@@ -242,7 +242,6 @@ class EpubPostprocessor:
# if anchor is found we could add placeholder for link creation on server side. # if anchor is found we could add placeholder for link creation on server side.
internal_link_tag.attrs['placeholder'] = '{{tempStyleToAnchor-' + new_id + '}}' internal_link_tag.attrs['placeholder'] = '{{tempStyleToAnchor-' + new_id + '}}'
# create span to have cyclic links, link has 1 type of class, anchor another # create span to have cyclic links, link has 1 type of class, anchor another
if anchor_tag.name == 'a':
new_anchor_already_created = soup.find_all('span', new_anchor_already_created = soup.find_all('span',
attrs={'class': 'link-anchor', attrs={'class': 'link-anchor',
'id': anchor_tag.attrs['id']}) 'id': anchor_tag.attrs['id']})
@@ -253,9 +252,6 @@ class EpubPostprocessor:
anchor_tag.insert(0, new_anchor_span) anchor_tag.insert(0, new_anchor_span)
del anchor_tag.attrs['id'] del anchor_tag.attrs['id']
self.internal_anchors.add(new_anchor_span) self.internal_anchors.add(new_anchor_span)
else:
self.internal_anchors.add(anchor_tag)
anchor_tag.attrs['class'] = 'link-anchor'
del internal_link_tag.attrs['href'] del internal_link_tag.attrs['href']