mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
500e72f064
commit
9194d95b17
|
@ -111,18 +111,12 @@ def manualApproveFollowRequest(session, baseDir: str,
|
|||
reqNick = approveHandle.split('@')[0]
|
||||
reqDomain = approveHandle.split('@')[1].strip()
|
||||
reqPrefix = httpPrefix + '://' + reqDomain
|
||||
if reqPrefix + '/profile/' + reqNick in approveFollowsStr:
|
||||
paths = ('/profile/', '/channel/', '/accounts/', '/u/')
|
||||
for userPath in paths:
|
||||
if reqPrefix + userPath + reqNick in approveFollowsStr:
|
||||
exists = True
|
||||
approveHandleFull = reqPrefix + '/profile/' + reqNick
|
||||
elif reqPrefix + '/channel/' + reqNick in approveFollowsStr:
|
||||
exists = True
|
||||
approveHandleFull = reqPrefix + '/channel/' + reqNick
|
||||
elif reqPrefix + '/accounts/' + reqNick in approveFollowsStr:
|
||||
exists = True
|
||||
approveHandleFull = reqPrefix + '/accounts/' + reqNick
|
||||
elif reqPrefix + '/u/' + reqNick in approveFollowsStr:
|
||||
exists = True
|
||||
approveHandleFull = reqPrefix + '/u/' + reqNick
|
||||
approveHandleFull = reqPrefix + userPath + reqNick
|
||||
break
|
||||
if not exists:
|
||||
print('Manual follow accept: ' + approveHandleFull +
|
||||
' not in requests file "' +
|
||||
|
|
31
markdown.py
31
markdown.py
|
@ -140,29 +140,22 @@ def markdownToHtml(markdown: str) -> str:
|
|||
linesList = markdown.split('\n')
|
||||
htmlStr = ''
|
||||
ctr = 0
|
||||
titles = {
|
||||
"h5": '#####',
|
||||
"h4": '####',
|
||||
"h3": '###',
|
||||
"h2": '##',
|
||||
"h1": '#'
|
||||
}
|
||||
for line in linesList:
|
||||
if ctr > 0:
|
||||
htmlStr += '<br>'
|
||||
if line.startswith('#####'):
|
||||
line = line.replace('#####', '').strip()
|
||||
line = '<h5>' + line + '</h5>'
|
||||
ctr = -1
|
||||
elif line.startswith('####'):
|
||||
line = line.replace('####', '').strip()
|
||||
line = '<h4>' + line + '</h4>'
|
||||
ctr = -1
|
||||
elif line.startswith('###'):
|
||||
line = line.replace('###', '').strip()
|
||||
line = '<h3>' + line + '</h3>'
|
||||
ctr = -1
|
||||
elif line.startswith('##'):
|
||||
line = line.replace('##', '').strip()
|
||||
line = '<h2>' + line + '</h2>'
|
||||
ctr = -1
|
||||
elif line.startswith('#'):
|
||||
line = line.replace('#', '').strip()
|
||||
line = '<h1>' + line + '</h1>'
|
||||
for h, hashes in titles.items():
|
||||
if line.startswith(hashes):
|
||||
line = line.replace(hashes, '').strip()
|
||||
line = '<' + h + '>' + line + '</' + h + '>'
|
||||
ctr = -1
|
||||
break
|
||||
htmlStr += line
|
||||
ctr += 1
|
||||
return htmlStr
|
||||
|
|
Loading…
Reference in New Issue