Both license and creator fields are required for display

main
Bob Mottram 2023-01-24 15:08:27 +00:00
parent bb9af5b860
commit 538454bafd
1 changed files with 7 additions and 16 deletions

View File

@ -1292,7 +1292,7 @@ def get_post_attachments_as_html(base_dir: str,
gallery_str += '<div class="gallery">\n' gallery_str += '<div class="gallery">\n'
if not is_muted: if not is_muted:
gallery_str += ' <a href="' + image_url + '">\n' gallery_str += ' <a href="' + image_url + '">\n'
if media_license or media_creator: if media_license and media_creator:
gallery_str += ' <figure>\n' gallery_str += ' <figure>\n'
gallery_str += \ gallery_str += \
' <img loading="lazy" ' + \ ' <img loading="lazy" ' + \
@ -1300,7 +1300,7 @@ def get_post_attachments_as_html(base_dir: str,
image_url + '" alt="" title="">\n' image_url + '" alt="" title="">\n'
gallery_str += ' </a>\n' gallery_str += ' </a>\n'
license_str = '' license_str = ''
if media_license: if media_license and media_creator:
if '://' in media_license: if '://' in media_license:
license_str += \ license_str += \
'<a href="' + media_license + \ '<a href="' + media_license + \
@ -1308,11 +1308,7 @@ def get_post_attachments_as_html(base_dir: str,
'rel="nofollow noopener noreferrer">©</a>' 'rel="nofollow noopener noreferrer">©</a>'
else: else:
license_str += media_license license_str += media_license
if media_creator: license_str += ' ' + media_creator
if license_str:
license_str += ' '
license_str += media_creator
if media_license or media_creator:
gallery_str += \ gallery_str += \
' ' + license_str + \ ' ' + license_str + \
'</figcaption></figure>\n' '</figcaption></figure>\n'
@ -1378,17 +1374,16 @@ def get_post_attachments_as_html(base_dir: str,
'<div id="' + post_id + '">\n' '<div id="' + post_id + '">\n'
attachment_str += '<a href="' + image_url + '" tabindex="10">' attachment_str += '<a href="' + image_url + '" tabindex="10">'
if media_license or media_creator: if media_license and media_creator:
attachment_str += '<figure>' attachment_str += '<figure>'
attachment_str += \ attachment_str += \
'<img loading="lazy" decoding="async" ' + \ '<img loading="lazy" decoding="async" ' + \
'src="' + image_url + \ 'src="' + image_url + \
'" alt="' + image_description + '" title="' + \ '" alt="' + image_description + '" title="' + \
image_description + '" class="attachment"></a>\n' image_description + '" class="attachment"></a>\n'
if media_license or media_creator: if media_license and media_creator:
license_str = ''
attachment_str += '<figcaption>' attachment_str += '<figcaption>'
license_str = ''
if media_license:
if '://' in media_license: if '://' in media_license:
license_str += \ license_str += \
'<a href="' + media_license + \ '<a href="' + media_license + \
@ -1396,11 +1391,7 @@ def get_post_attachments_as_html(base_dir: str,
'rel="nofollow noopener noreferrer">©</a>' 'rel="nofollow noopener noreferrer">©</a>'
else: else:
license_str += media_license license_str += media_license
if media_creator: license_str += ' ' + media_creator
if license_str:
license_str += ' '
license_str += media_creator
if media_license or media_creator:
attachment_str += license_str + '</figcaption></figure>' attachment_str += license_str + '</figcaption></figure>'
if minimize_images: if minimize_images: