Revision 2504
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/strings.py | ||
---|---|---|
110 | 110 |
if multiline: str_ = '<pre>'+str_+'</pre>' |
111 | 111 |
return str_ |
112 | 112 |
|
113 |
def as_inline_table(dict_, key_label='Output', value_label='Input'): |
|
113 |
def as_inline_table(dict_, key_label='Output', value_label='Input', ustr=ustr):
|
|
114 | 114 |
'''Wraps a dict in Redmine tags to format it as a table.''' |
115 | 115 |
str_ = '' |
116 | 116 |
def row(entry): return (': '.join(entry))+'\n' |
... | ... | |
118 | 118 |
for entry in dict_.iteritems(): str_ += row([ustr(v) for v in entry]) |
119 | 119 |
return '<pre>\n'+str_+'</pre>' |
120 | 120 |
|
121 |
def as_table(dict_, key_label='Output', value_label='Input'): |
|
121 |
def as_table(dict_, key_label='Output', value_label='Input', ustr=ustr):
|
|
122 | 122 |
'''Wraps a dict in Redmine tags to format it as a table.''' |
123 | 123 |
str_ = '' |
124 | 124 |
def row(entry): return ('|'.join(['']+entry+['']))+'\n'# '' for outer border |
Also available in: Unified diff
strings.py: as_*table(): Added ustr param to override the method (by default ustr()) used to convert each value to a string