Replace formatting in profile description

main2
Bob Mottram 2019-10-23 16:06:22 +01:00
parent f2a5c16311
commit 0150f19cd9
1 changed files with 8 additions and 3 deletions

View File

@ -1260,10 +1260,13 @@ def htmlProfile(translate: {},projectVersion: str, \
if len(profileDescription.split('<br>'))>2: if len(profileDescription.split('<br>'))>2:
profileDescriptionShort='' profileDescriptionShort=''
profileDescription=profileDescription.replace('<br>','\n') profileDescription=profileDescription.replace('<br>','\n')
avatarDescription=''
if profileJson.get('summary'):
avatarDescription=profileJson['summary'].replace('<br>','\n').replace('<p>','').replace('</p>','')
profileHeaderStr= \ profileHeaderStr= \
'<div class="hero-image">' \ '<div class="hero-image">' \
' <div class="hero-text">'+ \ ' <div class="hero-text">'+ \
' <img loading="lazy" src="'+profileJson['icon']['url']+'" title="'+profileDescription+'" alt="'+profileDescription+'" class="title">' \ ' <img loading="lazy" src="'+profileJson['icon']['url']+'" title="'+avatarDescription+'" alt="'+avatarDescription+'" class="title">' \
' <h1>'+displayName+'</h1>' \ ' <h1>'+displayName+'</h1>' \
' <p><b>@'+nickname+'@'+domainFull+'</b></p>' \ ' <p><b>@'+nickname+'@'+domainFull+'</b></p>' \
' <p>'+profileDescriptionShort+'</p>'+ \ ' <p>'+profileDescriptionShort+'</p>'+ \
@ -3230,11 +3233,13 @@ def htmlProfileAfterSearch(translate: {}, \
if '<br>' in profileDescription: if '<br>' in profileDescription:
if len(profileDescription.split('<br>'))>2: if len(profileDescription.split('<br>'))>2:
profileDescriptionShort='' profileDescriptionShort=''
profileDescription=profileDescription.replace('<br>','\n') avatarDescription=''
if profileJson.get('summary'):
avatarDescription=profileJson['summary'].replace('<br>','\n').replace('<p>','').replace('</p>','')
profileStr= \ profileStr= \
' <div class="hero-image">' \ ' <div class="hero-image">' \
' <div class="hero-text">' \ ' <div class="hero-text">' \
' <img loading="lazy" src="'+avatarUrl+'" alt="'+profileDescription+'" title="'+profileDescription+'">' \ ' <img loading="lazy" src="'+avatarUrl+'" alt="'+avatarDescription+'" title="'+avatarDescription+'">' \
' <h1>'+displayName+'</h1>' \ ' <h1>'+displayName+'</h1>' \
' <p><b>@'+searchNickname+'@'+searchDomainFull+'</b></p>' \ ' <p><b>@'+searchNickname+'@'+searchDomainFull+'</b></p>' \
' <p>'+profileDescriptionShort+'</p>'+ \ ' <p>'+profileDescriptionShort+'</p>'+ \