replace string
This commit is contained in:
parent
418bea3778
commit
9b58b45ae8
@ -152,14 +152,16 @@ class WPimport:
|
||||
except Exception as err:
|
||||
self._logger.error("{0} : Exception error for get image : {1}".format(self._name, err))
|
||||
exit(1)
|
||||
self._logger.debug("{0} content img : {1}".format(self._name, list_img))
|
||||
content_html = ""
|
||||
if len(list_img) > 0:
|
||||
content_html = "<!-- wp:paragraph --><p>{0}</p><!-- /wp:paragraph -->\n\n".format(albumdesc)
|
||||
|
||||
content_html = content_html + "<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped\"><!-- wp:image {'id':{0},\"sizeSlug\":\"large\",\"linkDestination\":\"none\"} --><figure class=\"wp-block-image size-large'><img src=\"{1}\" alt=\"\" class=\"wp-image-{0}\"/></figure><!-- /wp:image --> \n\n".format(list_img[0]["id"],list_img[1]["new_src"])
|
||||
|
||||
content_html = content_html + "<figure class='wp-block-gallery has-nested-images columns-default is-cropped'><!-- wp:image {\"id\":id-image,'sizeSlug':'large','linkDestination':'none'} --><figure class='wp-block-image size-large'><img src='src-image' alt='' class=wp-image-id-image/></figure><!-- /wp:image --> \n\n".replace("id-image", str(list_img[0]["id"])).replace("src-image", list_img[0]["new_src"])
|
||||
|
||||
for i in range(1, len(list_img)):
|
||||
content_html = content_html + "<!-- wp:image {'id':{0},\"sizeSlug\":\"large\",\"linkDestination\":\"none\"} --><figure class=\"wp-block-image size-large\"><img src='{0}' alt=\"\" class='wp-image-{1}'/></figure><!-- /wp:image -->\n\n".format(list_img[i]["id"],list_img[i]["new_src"])
|
||||
content_html = content_html + "<!-- wp:image {\"id\":id-image,\"sizeSlug\":\"large\",\"linkDestination\":\"none\"} --><figure class=\"wp-block-image size-large\"><img src='src-image' alt=\"\" class='wp-image-id-image'/></figure><!-- /wp:image -->\n\n".replace("id-image", str(list_img[0]["id"])).replace("src-image", list_img[0]["new_src"])
|
||||
content_html = content_html + "<!-- /wp:gallery -->"
|
||||
|
||||
self._logger.info("{0} : content html : {1}".format(self._name, content_html))
|
||||
|
Loading…
x
Reference in New Issue
Block a user