Skip to content

Commit 536b3bf

Browse files
committed
Now detecting if a thumbnail image has already been inserted, to avoid inserting it twice
1 parent db77f2e commit 536b3bf

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [1.0.9] - Not released yet
8+
### Added
9+
* now detecting if a thumbnail image has already been inserted, to avoid inserting it twice
10+
711
## [1.0.8] - 2022-03-20
812
### Added
913
* Adding support for relative image URL in `<meta>` section

image_preview_thumbnailer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ def process_all_links_in_html(html_file, config=PluginConfig()):
141141
return str(soup)
142142

143143
def process_link(img_downloader, anchor_tag, url_match, config=PluginConfig()):
144+
next_tag = anchor_tag.next_sibling
145+
if next_tag and next_tag.name == 'a' and any('thumb' in _class for _class in next_tag['class']):
146+
LOGGER.warning("Existing thumbnail image detected on anchor with href: %s", anchor_tag['href'])
144147
thumb_filename = extract_thumb_filename(anchor_tag['href'])
145148
matching_filepaths = glob(config.fs_thumbs_dir(thumb_filename + '.*'))
146149
if matching_filepaths: # => a thumbnail has already been generated

0 commit comments

Comments
 (0)