File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -152,18 +152,19 @@ def get_error_codes(cls) -> Iterable[str]:
152
152
@classmethod
153
153
def to_rst (cls ) -> str :
154
154
"""Output the registry as reStructuredText, for documentation."""
155
- sep_line = '+' + 6 * '-' + '+' + '-' * 71 + '+\n '
156
- blank_line = '|' + 78 * ' ' + '|\n '
155
+ max_len = max (len (error .short_desc ) for group in cls .groups for error in group .errors )
156
+ sep_line = '+' + 6 * '-' + '+' + '-' * (max_len + 2 ) + '+\n '
157
+ blank_line = '|' + (max_len + 9 ) * ' ' + '|\n '
157
158
table = ''
158
159
for group in cls .groups :
159
160
table += sep_line
160
161
table += blank_line
161
- table += '|' + '**{}**' .format (group .name ).center (78 ) + '|\n '
162
+ table += '|' + '**{}**' .format (group .name ).center (max_len + 9 ) + '|\n '
162
163
table += blank_line
163
164
for error in group .errors :
164
165
table += sep_line
165
166
table += ('|' + error .code .center (6 ) + '| ' +
166
- error .short_desc .ljust (70 ) + '|\n ' )
167
+ error .short_desc .ljust (max_len + 1 ) + '|\n ' )
167
168
table += sep_line
168
169
return table
169
170
You can’t perform that action at this time.
0 commit comments