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";
body {
margin: 0 auto;
max-width: 80%;
padding: 0 20px;
margin: 0 auto;
max-width: 80%;
padding: 0 20px;
}
.container {
border: 2px solid #dedede;
background-color: #f1f1f1;
border-radius: 5px;
padding: 10px;
margin: 10px 0;
border: 2px solid #dedede;
background-color: #f1f1f1;
border-radius: 5px;
padding: 10px;
margin: 10px 0;
}
.darker {
border-color: #ccc;
background-color: #ddd;
border-color: #ccc;
background-color: #ddd;
}
.container::after {
content: "";
clear: both;
display: table;
content: "";
clear: both;
display: table;
}
.container img {
float: left;
max-width: 60px;
width: 100%;
margin-right: 20px;
border-radius: 50%;
float: left;
max-width: 60px;
width: 100%;
margin-right: 20px;
border-radius: 50%;
}
.container img.attachment {
max-width: 100%;
margin-left: 25%;
width: 50%;
border-radius: 0%;
max-width: 100%;
margin-left: 25%;
width: 50%;
border-radius: 0%;
}
.container img.right {
float: right;
margin-left: 20px;
margin-right:0;
float: right;
margin-left: 20px;
margin-right:0;
}
.time-right {
float: right;
color: #aaa;
float: right;
color: #aaa;
}
.time-left {
float: left;
color: #999;
float: left;
color: #999;
}
.post-title {
margin-top: 0px;
color: #999;
}

View File

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