From 5b257124277827aef2ffc5e9d71f9eee761c3c32 Mon Sep 17 00:00:00 2001
From: Bob Mottram
Date: Tue, 28 Jul 2020 11:06:05 +0100
Subject: [PATCH] Line endings
---
webinterface.py | 170 +++++++++++++++++++++++++-----------------------
1 file changed, 89 insertions(+), 81 deletions(-)
diff --git a/webinterface.py b/webinterface.py
index 8c10e473..d0368321 100644
--- a/webinterface.py
+++ b/webinterface.py
@@ -1703,14 +1703,15 @@ def htmlTermsOfService(baseDir: str, httpPrefix: str, domainFull: str) -> str:
termsCSS = termsCSS.replace('https://', httpPrefix+'://')
TOSForm = htmlHeader(cssFilename, termsCSS)
- TOSForm += '' + TOSText + '
'
+ TOSForm += '' + TOSText + '
\n'
if adminNickname:
adminActor = httpPrefix + '://' + domainFull + \
'/users/' + adminNickname
TOSForm += \
- '' + \
+ ''
+ adminActor + '">' + adminNickname + '\n' + \
+ ' \n'
TOSForm += htmlFooter()
return TOSForm
@@ -1748,14 +1749,16 @@ def htmlAbout(baseDir: str, httpPrefix: str,
aboutForm += '' + aboutText + '
'
if onionDomain:
aboutForm += \
- '' + \
- 'http://' + onionDomain + '
'
+ '\n' + \
+ '' + \
+ 'http://' + onionDomain + '
\n \n'
if adminNickname:
adminActor = '/users/' + adminNickname
aboutForm += \
- '' + \
+ ''
+ adminActor + '">' + adminNickname + '\n' + \
+ ' \n'
aboutForm += htmlFooter()
return aboutForm
@@ -1770,11 +1773,11 @@ def htmlHashtagBlocked(baseDir: str) -> str:
with open(cssFilename, 'r') as cssFile:
blockedHashtagCSS = cssFile.read()
blockedHashtagForm = htmlHeader(cssFilename, blockedHashtagCSS)
- blockedHashtagForm += ''
- blockedHashtagForm += ' Hashtag Blocked
'
+ blockedHashtagForm += '\n'
+ blockedHashtagForm += ' Hashtag Blocked
\n'
blockedHashtagForm += \
- ' See Terms of Service
'
- blockedHashtagForm += ' '
+ ' See Terms of Service
\n'
+ blockedHashtagForm += ' \n'
blockedHashtagForm += htmlFooter()
return blockedHashtagForm
@@ -1789,10 +1792,10 @@ def htmlSuspended(baseDir: str) -> str:
with open(cssFilename, 'r') as cssFile:
suspendedCSS = cssFile.read()
suspendedForm = htmlHeader(cssFilename, suspendedCSS)
- suspendedForm += ''
- suspendedForm += ' Account Suspended
'
- suspendedForm += ' See Terms of Service
'
- suspendedForm += ' '
+ suspendedForm += '\n'
+ suspendedForm += ' Account Suspended
\n'
+ suspendedForm += ' See Terms of Service
\n'
+ suspendedForm += ' \n'
suspendedForm += htmlFooter()
return suspendedForm
@@ -1815,13 +1818,13 @@ def htmlNewPost(mediaInstance: bool, translate: {},
if not path.endswith('/newreport'):
if not inReplyTo or path.endswith('/newreminder'):
newPostText = '' + \
- translate['Write your post text below.'] + '
'
+ translate['Write your post text below.'] + '
\n'
else:
newPostText = \
'' + \
translate['Write your reply to'] + \
' ' + \
- translate['this post'] + '
'
+ translate['this post'] + '\n'
replyStr = ' '
@@ -1840,7 +1843,7 @@ def htmlNewPost(mediaInstance: bool, translate: {},
else:
newPostText = \
'' + \
- translate['Write your report below.'] + '
'
+ translate['Write your report below.'] + '\n'
# custom report header with any additional instructions
if os.path.isfile(baseDir + '/accounts/report.txt'):
@@ -1849,7 +1852,7 @@ def htmlNewPost(mediaInstance: bool, translate: {},
if '' not in customReportText:
customReportText = \
'' + \
- customReportText + '
'
+ customReportText + '\n'
repStr = ''
customReportText = \
customReportText.replace('
', repStr)
@@ -1858,24 +1861,26 @@ def htmlNewPost(mediaInstance: bool, translate: {},
idx = 'This message only goes to moderators, even if it ' + \
'mentions other fediverse addresses.'
newPostText += \
- '
' + translate[idx] + \
- '
' + translate['Also see'] + \
+ '
' + translate[idx] + '
\n' + \
+ '' + translate['Also see'] + \
' ' + \
- translate['Terms of Service'] + '
'
+ translate['Terms of Service'] + '\n'
else:
newPostText = \
'' + \
- translate['Enter the details for your shared item below.'] + '
'
+ translate['Enter the details for your shared item below.'] + \
+ '\n'
if path.endswith('/newquestion'):
newPostText = \
'' + \
- translate['Enter the choices for your question below.'] + '
'
+ translate['Enter the choices for your question below.'] + \
+ '\n'
if os.path.isfile(baseDir + '/accounts/newpost.txt'):
with open(baseDir + '/accounts/newpost.txt', 'r') as file:
newPostText = \
- '' + file.read() + '
'
+ '' + file.read() + '
\n'
cssFilename = baseDir + '/epicyon-profile.css'
if os.path.isfile(baseDir + '/epicyon.css'):
@@ -1897,14 +1902,15 @@ def htmlNewPost(mediaInstance: bool, translate: {},
newPostImageSection = ' '
newPostImageSection += \
' ' + translate['Image description'] + \
- ' '
- newPostImageSection += ' '
+ '\n'
+ newPostImageSection += \
+ ' \n'
newPostImageSection += \
' '
- newPostImageSection += '
'
+ '.webm, .ogv, .mp3, .ogg">\n'
+ newPostImageSection += ' \n'
scopeIcon = 'scope_public.png'
scopeDescription = translate['Public']
@@ -1948,19 +1954,19 @@ def htmlNewPost(mediaInstance: bool, translate: {},
scopeDescription = translate['Question']
placeholderMessage = translate['Enter your question'] + '...'
endpoint = 'newquestion'
- extraFields = ''
- dateAndLocation += ''
+ dateAndLocation += ' \n'
+ dateAndLocation += '
\n'
+ dateAndLocation += '\n'
dateAndLocation += '' + \
- translate['Location'] + ': '
- dateAndLocation += ' '
- dateAndLocation += '
'
+ translate['Location'] + ': \n'
+ dateAndLocation += ' \n'
+ dateAndLocation += '\n'
newPostForm = htmlHeader(cssFilename, newPostCSS)
@@ -2343,12 +2351,12 @@ def htmlProfileFollowing(translate: {}, baseDir: str, httpPrefix: str,
if authorized and pageNumber > 1:
# page up arrow
profileStr += \
- ' '
+ translate['Page up'] + '">\n\n'
for item in followingJson['orderedItems']:
profileStr += \
@@ -2361,12 +2369,12 @@ def htmlProfileFollowing(translate: {}, baseDir: str, httpPrefix: str,
if len(followingJson['orderedItems']) >= maxItemsPerPage:
# page down arrow
profileStr += \
- ' '
+ translate['Page down'] + '">\n\n'
return profileStr
@@ -2377,16 +2385,16 @@ def htmlProfileRoles(translate: {}, nickname: str, domain: str,
profileStr = ''
for project, rolesList in rolesJson.items():
profileStr += \
- '' + project + \
- ' '
+ '
\n
' + project + \
+ ' \n
\n'
for role in rolesList:
- profileStr += '
' + role + ' '
- profileStr += ''
+ profileStr += '
' + role + ' \n'
+ profileStr += '
\n'
if len(profileStr) == 0:
profileStr += \
- '@' + nickname + '@' + domain + ' has no roles assigned
'
+ '@' + nickname + '@' + domain + ' has no roles assigned
\n'
else:
- profileStr = '' + profileStr + '
'
+ profileStr = '' + profileStr + '
\n'
return profileStr
@@ -2399,10 +2407,10 @@ def htmlProfileSkills(translate: {}, nickname: str, domain: str,
profileStr += \
' '
+ str(level) + '%">\n \n'
if len(profileStr) > 0:
profileStr = '' + \
- profileStr + '
'
+ profileStr + '\n'
return profileStr
@@ -2410,33 +2418,33 @@ def htmlIndividualShare(actor: str, item: {}, translate: {},
showContact: bool, removeButton: bool) -> str:
"""Returns an individual shared item as html
"""
- profileStr = ''
- profileStr += '
' + item['displayName'] + '
'
+ profileStr = '
\n'
+ profileStr += '
' + item['displayName'] + '
\n'
if item.get('imageUrl'):
- profileStr += '
'
+ profileStr += ' \n'
profileStr += \
' '
- profileStr += '
' + item['summary'] + '
'
+ '" alt="' + translate['Item image'] + '">\n\n'
+ profileStr += '
' + item['summary'] + '
\n'
profileStr += \
'
' + translate['Type'] + ': ' + item['itemType'] + ' '
profileStr += \
'' + translate['Category'] + ': ' + item['category'] + ' '
profileStr += \
- '' + translate['Location'] + ': ' + item['location'] + '
'
+ '
' + translate['Location'] + ': ' + item['location'] + '\n'
if showContact:
contactActor = item['actor']
profileStr += \
'
' + \
- translate['Contact'] + ' '
+ translate['Contact'] + '\n'
if removeButton:
profileStr += \
' ' + \
- translate['Remove'] + ' '
- profileStr += '
'
+ translate['Remove'] + '\n'
+ profileStr += '
\n'
return profileStr
@@ -2448,7 +2456,7 @@ def htmlProfileShares(actor: str, translate: {},
for item in sharesJson['orderedItems']:
profileStr += htmlIndividualShare(actor, item, translate, False, False)
if len(profileStr) > 0:
- profileStr = '' + profileStr + '
'
+ profileStr = '' + profileStr + '
\n'
return profileStr
@@ -2523,11 +2531,11 @@ def htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
if pageNumber > 1:
iconsDir = getIconsDir(baseDir)
timelineStr += \
- ' '
+ '" alt="' + translate['Page up'] + '">\n\n'
for published, item in sharesJson.items():
showContactButton = False
@@ -2543,11 +2551,11 @@ def htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int,
if not lastPage:
iconsDir = getIconsDir(baseDir)
timelineStr += \
- ' '
+ '" alt="' + translate['Page down'] + '">\n\n'
return timelineStr