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