Revision 2481
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/strings.py | ||
---|---|---|
109 | 109 |
def as_table(dict_, key_label='Output', value_label='Input'): |
110 | 110 |
'''Wraps a dict in Redmine tags to format it as a table.''' |
111 | 111 |
str_ = '' |
112 |
def row(entry): return ('|'.join(['']+entry+['']))+'\n'# '' for outer border
|
|
112 |
def row(entry): return (': '.join(entry))+'\n'
|
|
113 | 113 |
str_ += row([key_label, value_label]) |
114 |
for entry in dict_.iteritems(): str_ += row([as_tt(ustr(v)) for v in entry]) |
|
115 |
return str_+' ' # space protects last \n so blank line ends table |
|
114 |
for entry in dict_.iteritems(): str_ += row([ustr(v) for v in entry]) |
|
115 |
return '<pre>\n'+str_+'</pre>' |
Also available in: Unified diff
strings.py: as_table(): Changed to use