Show post author

master
Bob Mottram 2019-07-21 13:41:31 +01:00
parent 314a3aa047
commit 39bfc07ac5
2 changed files with 39 additions and 29 deletions

View File

@ -1,56 +1,61 @@
@charset "UTF-8"; @charset "UTF-8";
body { body {
margin: 0 auto; margin: 0 auto;
max-width: 80%; max-width: 80%;
padding: 0 20px; padding: 0 20px;
} }
.container { .container {
border: 2px solid #dedede; border: 2px solid #dedede;
background-color: #f1f1f1; background-color: #f1f1f1;
border-radius: 5px; border-radius: 5px;
padding: 10px; padding: 10px;
margin: 10px 0; margin: 10px 0;
} }
.darker { .darker {
border-color: #ccc; border-color: #ccc;
background-color: #ddd; background-color: #ddd;
} }
.container::after { .container::after {
content: ""; content: "";
clear: both; clear: both;
display: table; display: table;
} }
.container img { .container img {
float: left; float: left;
max-width: 60px; max-width: 60px;
width: 100%; width: 100%;
margin-right: 20px; margin-right: 20px;
border-radius: 50%; border-radius: 50%;
} }
.container img.attachment { .container img.attachment {
max-width: 100%; max-width: 100%;
margin-left: 25%; margin-left: 25%;
width: 50%; width: 50%;
border-radius: 0%; border-radius: 0%;
} }
.container img.right { .container img.right {
float: right; float: right;
margin-left: 20px; margin-left: 20px;
margin-right:0; margin-right:0;
} }
.time-right { .time-right {
float: right; float: right;
color: #aaa; color: #aaa;
} }
.time-left { .time-left {
float: left; float: left;
color: #999; color: #999;
}
.post-title {
margin-top: 0px;
color: #999;
} }

View File

@ -7,6 +7,8 @@ __email__ = "bob@freedombone.net"
__status__ = "Production" __status__ = "Production"
import json import json
from utils import getNicknameFromActor
from utils import getDomainFromActor
def htmlHeader(lang='en') -> str: def htmlHeader(lang='en') -> str:
htmlStr= \ htmlStr= \
@ -72,10 +74,13 @@ def individualPostAsHtml(postJsonObject: {}) -> str:
'<img src="'+attach['url']+'" alt="'+imageDescription+'" title="'+imageDescription+'" class="attachment"></a>\n' '<img src="'+attach['url']+'" alt="'+imageDescription+'" title="'+imageDescription+'" class="attachment"></a>\n'
attachmentCtr+=1 attachmentCtr+=1
nickname=getNicknameFromActor(postJsonObject['actor'])
domain,port=getDomainFromActor(postJsonObject['actor'])
return \ return \
'<div class="'+containerClass+'">\n' \ '<div class="'+containerClass+'">\n' \
'<a href="'+postJsonObject['actor']+'">' \ '<a href="'+postJsonObject['actor']+'">' \
'<img src="'+postJsonObject['actor']+'/avatar.png" alt="Avatar"'+avatarPosition+'></a>\n'+ \ '<img src="'+postJsonObject['actor']+'/avatar.png" alt="Avatar"'+avatarPosition+'></a>\n'+ \
'<p class="post-title">@'+nickname+'@'+domain+'</p>'+ \
postJsonObject['object']['content']+'\n'+ \ postJsonObject['object']['content']+'\n'+ \
attachmentStr+ \ attachmentStr+ \
'<span class="'+timeClass+'">'+postJsonObject['object']['published']+'</span>\n'+ \ '<span class="'+timeClass+'">'+postJsonObject['object']['published']+'</span>\n'+ \