Skip to content

Commit d5c77dc

Browse files
Preserve whitespace when rewriting content.
1 parent 3a90b9e commit d5c77dc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pelican/plugins/image_process/image_process.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def harvest_feed_images(path, context, feed):
287287
set_default_settings(context)
288288

289289
with open(path, "r+", encoding=context["IMAGE_PROCESS_ENCODING"]) as f:
290-
soup = BeautifulSoup(f, "xml")
290+
soup = BeautifulSoup(f, "xml", preserve_whitespace_tags={"rss", "feed"})
291291

292292
for content in soup.find_all("content"):
293293
if content["type"] != "html" or not content.string:
@@ -303,7 +303,7 @@ def harvest_feed_images(path, context, feed):
303303

304304
def harvest_images_in_fragment(fragment, settings):
305305
parser = settings.get("IMAGE_PROCESS_PARSER", "html.parser")
306-
soup = BeautifulSoup(fragment, parser)
306+
soup = BeautifulSoup(fragment, parser, preserve_whitespace_tags={"html"})
307307

308308
copy_exif_tags = settings.get("IMAGE_PROCESS_COPY_EXIF_TAGS", False)
309309
if copy_exif_tags:

0 commit comments

Comments
 (0)