Indent text by prepending a given prefix to each line.
(self, text, prefix=' ')
| 1280 | return ''.join(ch + '\b' + ch for ch in text) |
| 1281 | |
| 1282 | def indent(self, text, prefix=' '): |
| 1283 | """Indent text by prepending a given prefix to each line.""" |
| 1284 | if not text: return '' |
| 1285 | lines = [(prefix + line).rstrip() for line in text.split('\n')] |
| 1286 | return '\n'.join(lines) |
| 1287 | |
| 1288 | def section(self, title, contents): |
| 1289 | """Format a section with a given heading.""" |