##// END OF EJS Templates
test-minirst: hide trailing whitespace from check-code
Matt Mackall -
r10289:987df17f default
parent child Browse files
Show More
@@ -1,148 +1,145 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2
2
3 from mercurial import minirst
3 from mercurial import minirst
4
4
5 def debugformat(title, text, width):
5 def debugformat(title, text, width):
6 print "%s formatted to fit within %d characters:" % (title, width)
6 print "%s formatted to fit within %d characters:" % (title, width)
7 print "-" * 70
7 print "-" * 70
8 print minirst.format(text, width)
8 print minirst.format(text, width)
9 print "-" * 70
9 print "-" * 70
10 print
10 print
11
11
12 paragraphs = """
12 paragraphs = """
13 This is some text in the first paragraph.
13 This is some text in the first paragraph.
14
14
15 A small indented paragraph.
15 A small indented paragraph.
16 It is followed by some lines
16 It is followed by some lines
17 containing random whitespace.
17 containing random whitespace.
18
18 \n \n \nThe third and final paragraph.
19
20
21 The third and final paragraph.
22 """
19 """
23
20
24 debugformat('paragraphs', paragraphs, 60)
21 debugformat('paragraphs', paragraphs, 60)
25 debugformat('paragraphs', paragraphs, 30)
22 debugformat('paragraphs', paragraphs, 30)
26
23
27
24
28 definitions = """
25 definitions = """
29 A Term
26 A Term
30 Definition. The indented
27 Definition. The indented
31 lines make up the definition.
28 lines make up the definition.
32 Another Term
29 Another Term
33 Another definition. The final line in the
30 Another definition. The final line in the
34 definition determines the indentation, so
31 definition determines the indentation, so
35 this will be indented with four spaces.
32 this will be indented with four spaces.
36
33
37 A Nested/Indented Term
34 A Nested/Indented Term
38 Definition.
35 Definition.
39 """
36 """
40
37
41 debugformat('definitions', definitions, 60)
38 debugformat('definitions', definitions, 60)
42 debugformat('definitions', definitions, 30)
39 debugformat('definitions', definitions, 30)
43
40
44
41
45 literals = r"""
42 literals = r"""
46 The fully minimized form is the most
43 The fully minimized form is the most
47 convenient form::
44 convenient form::
48
45
49 Hello
46 Hello
50 literal
47 literal
51 world
48 world
52
49
53 In the partially minimized form a paragraph
50 In the partially minimized form a paragraph
54 simply ends with space-double-colon. ::
51 simply ends with space-double-colon. ::
55
52
56 ////////////////////////////////////////
53 ////////////////////////////////////////
57 long un-wrapped line in a literal block
54 long un-wrapped line in a literal block
58 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
55 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
59
56
60 ::
57 ::
61
58
62 This literal block is started with '::',
59 This literal block is started with '::',
63 the so-called expanded form. The paragraph
60 the so-called expanded form. The paragraph
64 with '::' disappears in the final output.
61 with '::' disappears in the final output.
65 """
62 """
66
63
67 debugformat('literals', literals, 60)
64 debugformat('literals', literals, 60)
68 debugformat('literals', literals, 30)
65 debugformat('literals', literals, 30)
69
66
70
67
71 lists = """
68 lists = """
72 - This is the first list item.
69 - This is the first list item.
73
70
74 Second paragraph in the first list item.
71 Second paragraph in the first list item.
75
72
76 - List items need not be separated
73 - List items need not be separated
77 by a blank line.
74 by a blank line.
78 - And will be rendered without
75 - And will be rendered without
79 one in any case.
76 one in any case.
80
77
81 We can have indented lists:
78 We can have indented lists:
82
79
83 - This is an indented list item
80 - This is an indented list item
84
81
85 - Another indented list item::
82 - Another indented list item::
86
83
87 - A literal block in the middle
84 - A literal block in the middle
88 of an indented list.
85 of an indented list.
89
86
90 (The above is not a list item since we are in the literal block.)
87 (The above is not a list item since we are in the literal block.)
91
88
92 ::
89 ::
93
90
94 Literal block with no indentation (apart from
91 Literal block with no indentation (apart from
95 the two spaces added to all literal blocks).
92 the two spaces added to all literal blocks).
96
93
97 1. This is an enumerated list (first item).
94 1. This is an enumerated list (first item).
98 2. Continuing with the second item.
95 2. Continuing with the second item.
99
96
100 (1) foo
97 (1) foo
101 (2) bar
98 (2) bar
102
99
103 1) Another
100 1) Another
104 2) List
101 2) List
105 """
102 """
106
103
107 debugformat('lists', lists, 60)
104 debugformat('lists', lists, 60)
108 debugformat('lists', lists, 30)
105 debugformat('lists', lists, 30)
109
106
110
107
111 options = """
108 options = """
112 There is support for simple option lists,
109 There is support for simple option lists,
113 but only with long options:
110 but only with long options:
114
111
115 --all Output all.
112 --all Output all.
116 --both Output both (this description is
113 --both Output both (this description is
117 quite long).
114 quite long).
118 --long Output all day long.
115 --long Output all day long.
119
116
120 --par This option has two paragraphs in its description.
117 --par This option has two paragraphs in its description.
121 This is the first.
118 This is the first.
122
119
123 This is the second. Blank lines may be omitted between
120 This is the second. Blank lines may be omitted between
124 options (as above) or left in (as here).
121 options (as above) or left in (as here).
125
122
126 The next paragraph looks like an option list, but lacks the two-space
123 The next paragraph looks like an option list, but lacks the two-space
127 marker after the option. It is treated as a normal paragraph:
124 marker after the option. It is treated as a normal paragraph:
128
125
129 --foo bar baz
126 --foo bar baz
130 """
127 """
131
128
132 debugformat('options', options, 60)
129 debugformat('options', options, 60)
133 debugformat('options', options, 30)
130 debugformat('options', options, 30)
134
131
135
132
136 fields = """
133 fields = """
137 :a: First item.
134 :a: First item.
138 :ab: Second item. Indentation and wrapping
135 :ab: Second item. Indentation and wrapping
139 is handled automatically.
136 is handled automatically.
140
137
141 Next list:
138 Next list:
142
139
143 :small: The larger key below triggers full indentation here.
140 :small: The larger key below triggers full indentation here.
144 :much too large: This key is big enough to get its own line.
141 :much too large: This key is big enough to get its own line.
145 """
142 """
146
143
147 debugformat('fields', fields, 60)
144 debugformat('fields', fields, 60)
148 debugformat('fields', fields, 30)
145 debugformat('fields', fields, 30)
General Comments 0
You need to be logged in to leave comments. Login now