equal
deleted
inserted
replaced
1317 ret += c |
1317 ret += c |
1318 pos += 1 |
1318 pos += 1 |
1319 |
1319 |
1320 return ret |
1320 return ret |
1321 |
1321 |
|
1322 def prettyformat(tree): |
|
1323 def _prettyformat(tree, level, lines): |
|
1324 if not isinstance(tree, tuple) or tree[0] in ('string', 'symbol'): |
|
1325 lines.append((level, str(tree))) |
|
1326 else: |
|
1327 lines.append((level, '(%s' % tree[0])) |
|
1328 for s in tree[1:]: |
|
1329 _prettyformat(s, level + 1, lines) |
|
1330 lines[-1:] = [(lines[-1][0], lines[-1][1] + ')')] |
|
1331 |
|
1332 lines = [] |
|
1333 _prettyformat(tree, 0, lines) |
|
1334 output = '\n'.join((' '*l + s) for l, s in lines) |
|
1335 return output |
|
1336 |
1322 # tell hggettext to extract docstrings from these functions: |
1337 # tell hggettext to extract docstrings from these functions: |
1323 i18nfunctions = symbols.values() |
1338 i18nfunctions = symbols.values() |