Shorten profile description

main2
Bob Mottram 2019-10-23 15:27:43 +01:00
parent f72803ccc3
commit b048d894b7
1 changed files with 25 additions and 9 deletions

View File

@ -1251,18 +1251,26 @@ def htmlProfile(translate: {},projectVersion: str, \
followApprovalsSection+='<button class="followDeny">'+translate['Deny']+'</button></a>' followApprovalsSection+='<button class="followDeny">'+translate['Deny']+'</button></a>'
followApprovalsSection+='</div>' followApprovalsSection+='</div>'
profileStr= \ profileDescriptionShort=profileDescription
linkToTimelineStart+ \ if '\n' in profileDescription:
' <div class="hero-image">' \ if len(profileDescription.split('\n'))>2:
profileDescriptionShort=''
else:
if '<br>' in profileDescription:
if len(profileDescription.split('<br>'))>2:
profileDescriptionShort=''
profileHeaderStr= \
'<div class="hero-image">' \
' <div class="hero-text">'+ \ ' <div class="hero-text">'+ \
' <img loading="lazy" src="'+profileJson['icon']['url']+'" alt="'+nickname+'@'+domainFull+'" class="title">' \ ' <img loading="lazy" src="'+profileJson['icon']['url']+'" title="'+profileDescription+'" alt="'+profileDescription+'" class="title">' \
' <h1>'+displayName+'</h1>' \ ' <h1>'+displayName+'</h1>' \
' <p><b>@'+nickname+'@'+domainFull+'</b></p>' \ ' <p><b>@'+nickname+'@'+domainFull+'</b></p>' \
' <p>'+profileDescription+'</p>'+ \ ' <p>'+profileDescriptionShort+'</p>'+ \
loginButton+ \ loginButton+ \
' </div>' \ ' </div>' \
'</div>'+ \ '</div>'
linkToTimelineEnd+ \ profileStr= \
linkToTimelineStart + profileHeaderStr + linkToTimelineEnd + \
'<div class="container">\n' \ '<div class="container">\n' \
' <center>' \ ' <center>' \
' <a href="'+actor+'"><button class="'+postsButton+'"><span>'+translate['Posts']+' </span></button></a>' \ ' <a href="'+actor+'"><button class="'+postsButton+'"><span>'+translate['Posts']+' </span></button></a>' \
@ -3213,13 +3221,21 @@ def htmlProfileAfterSearch(translate: {}, \
if not backUrl.endswith('/inbox'): if not backUrl.endswith('/inbox'):
backUrl+='/inbox' backUrl+='/inbox'
profileDescriptionShort=profileDescription
if '\n' in profileDescription:
if len(profileDescription.split('\n'))>2:
profileDescriptionShort=''
else:
if '<br>' in profileDescription:
if len(profileDescription.split('<br>'))>2:
profileDescriptionShort=''
profileStr= \ profileStr= \
' <div class="hero-image">' \ ' <div class="hero-image">' \
' <div class="hero-text">' \ ' <div class="hero-text">' \
' <img loading="lazy" src="'+avatarUrl+'" alt="'+searchNickname+'@'+searchDomainFull+'">' \ ' <img loading="lazy" src="'+avatarUrl+'" alt="'+profileDescription+'" title="'+profileDescription+'">' \
' <h1>'+displayName+'</h1>' \ ' <h1>'+displayName+'</h1>' \
' <p><b>@'+searchNickname+'@'+searchDomainFull+'</b></p>' \ ' <p><b>@'+searchNickname+'@'+searchDomainFull+'</b></p>' \
' <p>'+profileDescription+'</p>'+ \ ' <p>'+profileDescriptionShort+'</p>'+ \
' </div>' \ ' </div>' \
'</div>'+ \ '</div>'+ \
'<div class="container">\n' \ '<div class="container">\n' \