@@ -525,6 +525,12 @@ def test_html_and_pictures_generation(mocker, orig_tag, new_tag, call_args):
525525@pytest .mark .parametrize (
526526 "orig_tag, new_tag" ,
527527 [
528+ # <img/> src attribute with no quotes, spaces or commas.
529+ (
530+ '<img class="image-process-thumb" src="/tmp/my&_dir/my!_test.jpg" />' ,
531+ '<img class="image-process-thumb" '
532+ 'src="/tmp/my&_dir/derivs/thumb/my!_test.jpg"/>' ,
533+ ),
528534 # <img/> src attribute with double quotes, spaces and commas.
529535 (
530536 '<img class="image-process-thumb" '
@@ -539,8 +545,16 @@ def test_html_and_pictures_generation(mocker, orig_tag, new_tag, call_args):
539545 '<img class="image-process-thumb" '
540546 'src="/tmp/m\' y," dir/derivs/thumb/my "test,.jpg"/>' ,
541547 ),
548+ # <img/> srcset attribute with no quotes, spaces or commas.
549+ (
550+ '<img class="image-process-crisp" src="/tmp/my&_dir/my!_test.jpg" />' ,
551+ '<img class="image-process-crisp" '
552+ 'src="/tmp/my&_dir/derivs/crisp/1x/my!_test.jpg" '
553+ 'srcset="/tmp/my&_dir/derivs/crisp/1x/my!_test.jpg 1x, '
554+ "/tmp/my&_dir/derivs/crisp/2x/my!_test.jpg 2x, "
555+ '/tmp/my&_dir/derivs/crisp/4x/my!_test.jpg 4x"/>' ,
556+ ),
542557 # <img/> srcset attribute with double quotes, spaces and commas.
543- # In srcset, space and comma have special meaning.
544558 (
545559 '<img class="image-process-crisp" '
546560 'src="/tmp/my," dir/my "test,.jpg" />' ,
@@ -551,7 +565,6 @@ def test_html_and_pictures_generation(mocker, orig_tag, new_tag, call_args):
551565 '/tmp/my%2C%22%20dir/derivs/crisp/4x/my%20%22test%2C.jpg 4x"/>' ,
552566 ),
553567 # <img/> srcset attribute with single and double quotes, spaces and commas.
554- # In srcset, space and comma have special meaning.
555568 (
556569 '<img class="image-process-crisp" '
557570 'src="/tmp/m\' y," dir/my "test,.jpg" />' ,
@@ -561,6 +574,25 @@ def test_html_and_pictures_generation(mocker, orig_tag, new_tag, call_args):
561574 "/tmp/m%27y%2C%22%20dir/derivs/crisp/2x/my%20%22test%2C.jpg 2x, "
562575 '/tmp/m%27y%2C%22%20dir/derivs/crisp/4x/my%20%22test%2C.jpg 4x"/>' ,
563576 ),
577+ # <picture/> src and srcset attributes with no quotes, spaces or commas.
578+ (
579+ '<picture><source class="source-1" '
580+ 'src="/my&_dir/my!_pelican-closeup.jpg"/><img '
581+ 'class="image-process-pict" src="/my&_dir/my!_pelican.jpg"/>'
582+ "</picture>" ,
583+ '<picture><source media="(min-width: 640px)" sizes="100vw" '
584+ 'srcset="/my&_dir/derivs/pict/default/640w/'
585+ "my!_pelican.jpg 640w, "
586+ "/my&_dir/derivs/pict/default/1024w/my!_pelican.jpg 1024w, "
587+ '/my&_dir/derivs/pict/default/1600w/my!_pelican.jpg 1600w"/>'
588+ '<source srcset="/my&_dir/derivs/pict/source-1/1x/'
589+ "my!_pelican-closeup.jpg 1x, "
590+ "/my&_dir/derivs/pict/source-1/2x/"
591+ 'my!_pelican-closeup.jpg 2x"/><img '
592+ 'class="image-process-pict" '
593+ 'src="/my&_dir/derivs/pict/default/640w/my!_pelican.jpg"/>'
594+ "</picture>" ,
595+ ),
564596 # <picture/> src and srcset attributes with double quotes, spaces and commas.
565597 (
566598 '<picture><source class="source-1" '
@@ -611,7 +643,7 @@ def test_special_chars_in_image_path_are_handled_properly(mocker, orig_tag, new_
611643 according to the quotation mark used to enclose the attribute value.
612644
613645 For the srcset attribute, in addition to quotes, spaces and commas
614- need to be escaped .
646+ need to be url-encoded .
615647
616648 Related to issue #78 https://github.com/pelican-plugins/image-process/issues/78
617649 """
0 commit comments