Revision 2475
Added by Aaron Marcuse-Kubitza almost 13 years ago
lib/strings.py | ||
---|---|---|
97 | 97 |
|
98 | 98 |
##### Formatting |
99 | 99 |
|
100 |
def as_code(str_, lang=None): |
|
100 |
def as_code(str_, lang=None, multiline=True):
|
|
101 | 101 |
'''Wraps a string in Redmine tags to syntax-highlight it.''' |
102 | 102 |
str_ = '\n'+str_.rstrip()+'\n' |
103 | 103 |
if lang != None: str_ = '<code class="'+lang+'">'+str_+'</code>' |
104 |
return '<pre>'+str_+'</pre>' |
|
104 |
if multiline: str_ = '<pre>'+str_+'</pre>' |
|
105 |
return str_ |
Also available in: Unified diff
strings.py: as_code(): Added multiline param to disable multiline formatted output