1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-09-11 23:23:27 +02:00

Avoid conflicting func/var names

This commit is contained in:
Daniel Martí 2015-12-03 12:41:50 +01:00
parent 1b43d8e33c
commit 992406de0e

View File

@ -524,41 +524,41 @@ class DescriptionFormatter:
self.state = self.stNONE self.state = self.stNONE
def formatted(self, txt, html): def formatted(self, txt, html):
formatted = '' res = ''
if html: if html:
txt = cgi.escape(txt) txt = cgi.escape(txt)
while True: while True:
index = txt.find("''") index = txt.find("''")
if index == -1: if index == -1:
return formatted + txt return res + txt
formatted += txt[:index] res += txt[:index]
txt = txt[index:] txt = txt[index:]
if txt.startswith("'''"): if txt.startswith("'''"):
if html: if html:
if self.bold: if self.bold:
formatted += '</b>' res += '</b>'
else: else:
formatted += '<b>' res += '<b>'
self.bold = not self.bold self.bold = not self.bold
txt = txt[3:] txt = txt[3:]
else: else:
if html: if html:
if self.ital: if self.ital:
formatted += '</i>' res += '</i>'
else: else:
formatted += '<i>' res += '<i>'
self.ital = not self.ital self.ital = not self.ital
txt = txt[2:] txt = txt[2:]
def linkify(self, txt): def linkify(self, txt):
linkified_plain = '' res_plain = ''
linkified_html = '' res_html = ''
while True: while True:
index = txt.find("[") index = txt.find("[")
if index == -1: if index == -1:
return (linkified_plain + self.formatted(txt, False), linkified_html + self.formatted(txt, True)) return (res_plain + self.formatted(txt, False), res_html + self.formatted(txt, True))
linkified_plain += self.formatted(txt[:index], False) res_plain += self.formatted(txt[:index], False)
linkified_html += self.formatted(txt[:index], True) res_html += self.formatted(txt[:index], True)
txt = txt[index:] txt = txt[index:]
if txt.startswith("[["): if txt.startswith("[["):
index = txt.find("]]") index = txt.find("]]")
@ -569,8 +569,8 @@ class DescriptionFormatter:
url, urltext = self.linkResolver(url) url, urltext = self.linkResolver(url)
else: else:
urltext = url urltext = url
linkified_html += '<a href="' + url + '">' + cgi.escape(urltext) + '</a>' res_html += '<a href="' + url + '">' + cgi.escape(urltext) + '</a>'
linkified_plain += urltext res_plain += urltext
txt = txt[index + 2:] txt = txt[index + 2:]
else: else:
index = txt.find("]") index = txt.find("]")
@ -585,10 +585,10 @@ class DescriptionFormatter:
url = url[:index2] url = url[:index2]
if url == urltxt: if url == urltxt:
raise MetaDataException("Url title is just the URL - use [url]") raise MetaDataException("Url title is just the URL - use [url]")
linkified_html += '<a href="' + url + '">' + cgi.escape(urltxt) + '</a>' res_html += '<a href="' + url + '">' + cgi.escape(urltxt) + '</a>'
linkified_plain += urltxt res_plain += urltxt
if urltxt != url: if urltxt != url:
linkified_plain += ' (' + url + ')' res_plain += ' (' + url + ')'
txt = txt[index + 1:] txt = txt[index + 1:]
def addtext(self, txt): def addtext(self, txt):