Skip to content

Commit 824407b

Browse files
Fix format and test.
1 parent c5b9ca2 commit 824407b

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

pelican/plugins/image_process/image_process.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import subprocess
1919
import sys
2020
import urllib
21-
from urllib.parse import unquote, urlparse, urljoin
21+
from urllib.parse import unquote, urljoin, urlparse
2222
from urllib.request import pathname2url, url2pathname
2323

2424
from bs4 import BeautifulSoup
@@ -804,7 +804,9 @@ def process_metadata(generator, metadata):
804804
path = compute_paths(value, generator.context, derivative)
805805

806806
original_values[key] = value
807-
metadata[key] = urljoin(site_url, posixpath.join(path.base_url, path.filename))
807+
metadata[key] = urljoin(
808+
site_url, posixpath.join(path.base_url, path.filename)
809+
)
808810
destination = os.path.join(str(path.base_path), path.filename)
809811

810812
if not isinstance(process, list):

pelican/plugins/image_process/test_image_process.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,14 +914,24 @@ def test_class_settings(mocker, orig_tag, new_tag, setting_overrides):
914914
),
915915
(
916916
{"og_image": "/photos/test-image.jpg"},
917-
{"og_image": "/photos/derivatives/crop/test-image.jpg"},
917+
{
918+
"og_image": "/photos/derivatives/crop/test-image.jpg",
919+
"image_process_original_metadata": {
920+
"og_image": "/photos/test-image.jpg"
921+
},
922+
},
918923
{"IMAGE_PROCESS_METADATA": {"og_image": "crop"}},
919924
True,
920925
"crop",
921926
),
922927
(
923928
{"og_image": "{resize}/photos/test-image.jpg"},
924-
{"og_image": "/photos/derivatives/resize/test-image.jpg"},
929+
{
930+
"og_image": "/photos/derivatives/resize/test-image.jpg",
931+
"image_process_original_metadata": {
932+
"og_image": "/photos/test-image.jpg"
933+
},
934+
},
925935
{"IMAGE_PROCESS_METADATA": {"og_image": "crop"}},
926936
True,
927937
"resize",

0 commit comments

Comments
 (0)