mirror of https://gitlab.com/bashrc2/epicyon
html metadata indentation
parent
1fffb62523
commit
d7cd151f04
|
@ -85,9 +85,9 @@ def _htmlPostMetadataOpenGraph(domain: str, postJsonObject: {}) -> str:
|
||||||
"""Returns html OpenGraph metadata for a post
|
"""Returns html OpenGraph metadata for a post
|
||||||
"""
|
"""
|
||||||
metadata = \
|
metadata = \
|
||||||
"<meta content=\"" + domain + "\" property=\"og:site_name\" />\n"
|
" <meta content=\"" + domain + "\" property=\"og:site_name\" />\n"
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content=\"article\" property=\"og:type\" />\n"
|
" <meta content=\"article\" property=\"og:type\" />\n"
|
||||||
objJson = postJsonObject
|
objJson = postJsonObject
|
||||||
if hasObjectDict(postJsonObject):
|
if hasObjectDict(postJsonObject):
|
||||||
objJson = postJsonObject['object']
|
objJson = postJsonObject['object']
|
||||||
|
@ -98,23 +98,24 @@ def _htmlPostMetadataOpenGraph(domain: str, postJsonObject: {}) -> str:
|
||||||
actorDomain, _ = getDomainFromActor(attrib)
|
actorDomain, _ = getDomainFromActor(attrib)
|
||||||
actorHandle = actorNick + '@' + actorDomain
|
actorHandle = actorNick + '@' + actorDomain
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content=\"@" + actorHandle + \
|
" <meta content=\"@" + actorHandle + \
|
||||||
"\" property=\"og:title\" />\n"
|
"\" property=\"og:title\" />\n"
|
||||||
if objJson.get('url'):
|
if objJson.get('url'):
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content=\"" + objJson['url'] + \
|
" <meta content=\"" + objJson['url'] + \
|
||||||
"\" property=\"og:url\" />\n"
|
"\" property=\"og:url\" />\n"
|
||||||
if objJson.get('published'):
|
if objJson.get('published'):
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content=\"" + objJson['published'] + \
|
" <meta content=\"" + objJson['published'] + \
|
||||||
"\" property=\"og:published_time\" />\n"
|
"\" property=\"og:published_time\" />\n"
|
||||||
if not objJson.get('attachment'):
|
if not objJson.get('attachment'):
|
||||||
if objJson.get('content'):
|
if objJson.get('content'):
|
||||||
description = removeHtml(objJson['content'])
|
description = removeHtml(objJson['content'])
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content='" + description + "' name='description'>\n"
|
" <meta content='" + description + "' name='description'>\n"
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content='" + description + "' name='og:description'>\n"
|
" <meta content='" + description + \
|
||||||
|
"' name='og:description'>\n"
|
||||||
return metadata
|
return metadata
|
||||||
|
|
||||||
# metadata for attachment
|
# metadata for attachment
|
||||||
|
@ -138,29 +139,30 @@ def _htmlPostMetadataOpenGraph(domain: str, postJsonObject: {}) -> str:
|
||||||
if objJson.get('content'):
|
if objJson.get('content'):
|
||||||
description += '\n\n' + removeHtml(objJson['content'])
|
description += '\n\n' + removeHtml(objJson['content'])
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content='" + description + "' name='description'>\n"
|
" <meta content='" + description + "' name='description'>\n"
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content='" + description + "' name='og:description'>\n"
|
" <meta content='" + description + \
|
||||||
|
"' name='og:description'>\n"
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content=\"" + attachJson['url'] + \
|
" <meta content=\"" + attachJson['url'] + \
|
||||||
"\" property=\"og:image\" />\n"
|
"\" property=\"og:image\" />\n"
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content=\"" + attachJson['mediaType'] + \
|
" <meta content=\"" + attachJson['mediaType'] + \
|
||||||
"\" property=\"og:image:type\" />\n"
|
"\" property=\"og:image:type\" />\n"
|
||||||
if attachJson.get('width'):
|
if attachJson.get('width'):
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content=\"" + attachJson['width'] + \
|
" <meta content=\"" + attachJson['width'] + \
|
||||||
"\" property=\"og:image:width\" />\n"
|
"\" property=\"og:image:width\" />\n"
|
||||||
if attachJson.get('height'):
|
if attachJson.get('height'):
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content=\"" + attachJson['height'] + \
|
" <meta content=\"" + attachJson['height'] + \
|
||||||
"\" property=\"og:image:height\" />\n"
|
"\" property=\"og:image:height\" />\n"
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content=\"" + attachJson['name'] + \
|
" <meta content=\"" + attachJson['name'] + \
|
||||||
"\" property=\"og:image:alt\" />\n"
|
"\" property=\"og:image:alt\" />\n"
|
||||||
if attachJson['mediaType'].startswith('image/'):
|
if attachJson['mediaType'].startswith('image/'):
|
||||||
metadata += \
|
metadata += \
|
||||||
"<meta content=\"summary_large_image\" " + \
|
" <meta content=\"summary_large_image\" " + \
|
||||||
"property=\"twitter:card\" />\n"
|
"property=\"twitter:card\" />\n"
|
||||||
return metadata
|
return metadata
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue