state = stNONE
text_wiki = ''
text_html = ''
+ text_txt = ''
linkResolver = None
def __init__(self, linkres):
def parseline(self, line):
self.text_wiki += "%s\n" % line
+ self.text_txt += "%s\n" % line
if not line:
self.endcur()
elif line.startswith('* '):
self.endcur()
+# Parse multiple lines of description as written in a metadata file, returning
+# a single string in text format and wrapped to 80 columns.
+def description_txt(lines):
+ ps = DescriptionFormatter(None)
+ for line in lines:
+ ps.parseline(line)
+ ps.end()
+ return ps.text_txt
+
+
# 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,
# because it's the same format.
t = metafieldtype(field)
if t == 'list':
value = ','.join(value)
+ elif t == 'multiline':
+ if type(value) == list:
+ value = '\n' + '\n'.join(value) + '\n.'
+ else:
+ value = '\n' + value + '.'
mf.write("%s:%s\n" % (field, value))
def writefield_nonempty(field, value=None):
writefield_nonempty('Name')
writefield_nonempty('Auto Name')
writefield('Summary')
- writefield('Description', '')
- for line in app['Description']:
- mf.write("%s\n" % line)
- mf.write('.\n')
+ writefield('Description', description_txt(app['Description']))
mf.write('\n')
if app['Requires Root']:
writefield('Requires Root', 'yes')
mf.write('\n')
if app['Maintainer Notes']:
- writefield('Maintainer Notes', '')
- for line in app['Maintainer Notes']:
- mf.write("%s\n" % line)
- mf.write('.\n')
+ writefield('Maintainer Notes', app['Maintainer Notes'])
mf.write('\n')
writefield_nonempty('Archive Policy')