Skip to content

Commit 5b13403

Browse files
authored
Merge pull request #93 from patrickfournier/preserve-whitespace
Preserve whitespace when rewriting content.
2 parents 16ef76a + d5c77dc commit 5b13403

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
@@ -288,7 +288,7 @@ def harvest_feed_images(path, context, feed):
288288
set_default_settings(context)
289289

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

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

305305
def harvest_images_in_fragment(fragment, settings):
306306
parser = settings.get("IMAGE_PROCESS_PARSER", "html.parser")
307-
soup = BeautifulSoup(fragment, parser)
307+
soup = BeautifulSoup(fragment, parser, preserve_whitespace_tags={"html"})
308308

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

0 commit comments

Comments
 (0)