5 from mercurial.utils import ( |
5 from mercurial.utils import ( |
6 stringutil, |
6 stringutil, |
7 ) |
7 ) |
8 |
8 |
9 def debugformat(text, form, **kwargs): |
9 def debugformat(text, form, **kwargs): |
|
10 blocks, pruned = minirst.parse(text, **kwargs) |
10 if form == b'html': |
11 if form == b'html': |
11 print("html format:") |
12 print("html format:") |
12 out = minirst.format(text, style=form, **kwargs) |
13 out = minirst.format(text, style=form, **kwargs) |
13 else: |
14 else: |
14 print("%d column format:" % form) |
15 print("%d column format:" % form) |
15 out = minirst.format(text, width=form, **kwargs) |
16 out = minirst.format(text, width=form, **kwargs) |
16 |
17 |
17 print("-" * 70) |
18 print("-" * 70) |
18 if type(out) == tuple: |
19 print(out[:-1].decode('utf8')) |
19 print(out[0][:-1].decode('utf8')) |
20 if kwargs.get('keep'): |
20 print("-" * 70) |
21 print("-" * 70) |
21 print(stringutil.pprint(out[1]).decode('utf8')) |
22 print(stringutil.pprint(pruned).decode('utf8')) |
22 else: |
|
23 print(out[:-1].decode('utf8')) |
|
24 print("-" * 70) |
23 print("-" * 70) |
25 print() |
24 print() |
26 |
25 |
27 def debugformats(title, text, **kwargs): |
26 def debugformats(title, text, **kwargs): |
28 print("== %s ==" % title) |
27 print("== %s ==" % title) |