mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-06 15:30:28 +03:00
Plaintext descriptions are no longer needed
This commit is contained in:
parent
f60f1bc59e
commit
526813eae6
1 changed files with 1 additions and 17 deletions
|
|
@ -241,7 +241,7 @@ def check_metadata(info):
|
||||||
|
|
||||||
# Formatter for descriptions. Create an instance, and call parseline() with
|
# Formatter for descriptions. Create an instance, and call parseline() with
|
||||||
# each line of the description source from the metadata. At the end, call
|
# each line of the description source from the metadata. At the end, call
|
||||||
# end() and then text_plain, text_wiki and text_html will contain the result.
|
# end() and then text_wiki and text_html will contain the result.
|
||||||
class DescriptionFormatter:
|
class DescriptionFormatter:
|
||||||
stNONE = 0
|
stNONE = 0
|
||||||
stPARA = 1
|
stPARA = 1
|
||||||
|
|
@ -250,7 +250,6 @@ class DescriptionFormatter:
|
||||||
bold = False
|
bold = False
|
||||||
ital = False
|
ital = False
|
||||||
state = stNONE
|
state = stNONE
|
||||||
text_plain = ''
|
|
||||||
text_wiki = ''
|
text_wiki = ''
|
||||||
text_html = ''
|
text_html = ''
|
||||||
linkResolver = None
|
linkResolver = None
|
||||||
|
|
@ -269,7 +268,6 @@ class DescriptionFormatter:
|
||||||
self.endol()
|
self.endol()
|
||||||
|
|
||||||
def endpara(self):
|
def endpara(self):
|
||||||
self.text_plain += '\n'
|
|
||||||
self.text_html += '</p>'
|
self.text_html += '</p>'
|
||||||
self.state = self.stNONE
|
self.state = self.stNONE
|
||||||
|
|
||||||
|
|
@ -349,7 +347,6 @@ class DescriptionFormatter:
|
||||||
|
|
||||||
def addtext(self, txt):
|
def addtext(self, txt):
|
||||||
p, h = self.linkify(txt)
|
p, h = self.linkify(txt)
|
||||||
self.text_plain += p
|
|
||||||
self.text_html += h
|
self.text_html += h
|
||||||
|
|
||||||
def parseline(self, line):
|
def parseline(self, line):
|
||||||
|
|
@ -362,7 +359,6 @@ class DescriptionFormatter:
|
||||||
self.text_html += '<ul>'
|
self.text_html += '<ul>'
|
||||||
self.state = self.stUL
|
self.state = self.stUL
|
||||||
self.text_html += '<li>'
|
self.text_html += '<li>'
|
||||||
self.text_plain += '* '
|
|
||||||
self.addtext(line[1:])
|
self.addtext(line[1:])
|
||||||
self.text_html += '</li>'
|
self.text_html += '</li>'
|
||||||
elif line.startswith('# '):
|
elif line.startswith('# '):
|
||||||
|
|
@ -371,7 +367,6 @@ class DescriptionFormatter:
|
||||||
self.text_html += '<ol>'
|
self.text_html += '<ol>'
|
||||||
self.state = self.stOL
|
self.state = self.stOL
|
||||||
self.text_html += '<li>'
|
self.text_html += '<li>'
|
||||||
self.text_plain += '* ' # TODO: lazy - put the numbers in!
|
|
||||||
self.addtext(line[1:])
|
self.addtext(line[1:])
|
||||||
self.text_html += '</li>'
|
self.text_html += '</li>'
|
||||||
else:
|
else:
|
||||||
|
|
@ -381,23 +376,12 @@ class DescriptionFormatter:
|
||||||
self.state = self.stPARA
|
self.state = self.stPARA
|
||||||
elif self.state == self.stPARA:
|
elif self.state == self.stPARA:
|
||||||
self.text_html += ' '
|
self.text_html += ' '
|
||||||
self.text_plain += ' '
|
|
||||||
self.addtext(line)
|
self.addtext(line)
|
||||||
|
|
||||||
def end(self):
|
def end(self):
|
||||||
self.endcur()
|
self.endcur()
|
||||||
|
|
||||||
|
|
||||||
# Parse multiple lines of description as written in a metadata file, returning
|
|
||||||
# a single string in plain text format.
|
|
||||||
def description_plain(lines, linkres):
|
|
||||||
ps = DescriptionFormatter(linkres)
|
|
||||||
for line in lines:
|
|
||||||
ps.parseline(line)
|
|
||||||
ps.end()
|
|
||||||
return ps.text_plain
|
|
||||||
|
|
||||||
|
|
||||||
# Parse multiple lines of description as written in a metadata file, returning
|
# Parse multiple lines of description as written in a metadata file, returning
|
||||||
# a single string in wiki format. Used for the Maintainer Notes field as well,
|
# a single string in wiki format. Used for the Maintainer Notes field as well,
|
||||||
# because it's the same format.
|
# because it's the same format.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue