mirror of
https://gitlab.com/octtspacc/staticoso
synced 2025-06-05 22:09:23 +02:00
Add Mastodon comment embedding (incomplete)
This commit is contained in:
@ -483,17 +483,37 @@ def Main(Args, FeedEntries):
|
||||
Lang=SiteLang,
|
||||
Minify=True if Args.Minify and Args.Minify not in ('False', 'None') else False)
|
||||
|
||||
if Args.GemtextOut:
|
||||
GemtextCompileList(Pages)
|
||||
|
||||
if MastodonURL and MastodonToken and SiteDomain:
|
||||
MastodonShare(
|
||||
MastodonPosts = MastodonShare(
|
||||
MastodonURL,
|
||||
MastodonToken,
|
||||
Pages,
|
||||
SiteDomain,
|
||||
SiteLang,
|
||||
Locale)
|
||||
#print(MastodonPosts)
|
||||
else:
|
||||
MastodonPosts = []
|
||||
|
||||
for File, Content, Titles, Meta, HTMLContent, Description, Image in Pages:
|
||||
#if Meta['Type'] == 'Post':
|
||||
File = 'public/{}.html'.format(StripExt(File))
|
||||
Content = ReadFile(File)
|
||||
Post = ''
|
||||
for p in MastodonPosts:
|
||||
#print(SiteDomain + File[len('public/'):])
|
||||
if p['Link'] == SiteDomain + '/' + File[len('public/'):]:
|
||||
Post = '<br><h3>{StrComments}</h3><a href="{URL}" rel="noopener" target="_blank">{StrOpen} ↗️</a>'.format(
|
||||
StrComments=Locale['Comments'],
|
||||
StrOpen=Locale['OpenInNewTab'],
|
||||
URL=p['Post'])
|
||||
break
|
||||
#print(Post)
|
||||
Content = Content.replace('[HTML:Comments]', Post)
|
||||
WriteFile(File, Content)
|
||||
|
||||
if Args.GemtextOut:
|
||||
GemtextCompileList(Pages)
|
||||
|
||||
DelTmp()
|
||||
os.system("cp -R Assets/* public/")
|
||||
|
Reference in New Issue
Block a user