Changeset 454
- Timestamp:
- 01-11-09 17:05:09 (4 years ago)
- Location:
- trunk/moap/extern/command
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
command.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/moap/extern/command/ChangeLog
r453 r454 1 2009-11-01 Thomas Vander Stichele <thomas at apestaart dot org> 2 3 * command.py: 4 Allow natural formatting of a list, identified by a line that 5 starts with a space then a dash. 6 1 7 2009-11-01 Thomas Vander Stichele <thomas at apestaart dot org> 2 8 -
trunk/moap/extern/command/command.py
r453 r454 33 33 34 34 def format_description(self, description, width=None): 35 36 35 # textwrap doesn't allow for a way to preserve double newlines 37 36 # to separate paragraphs, so we do it here. 38 blocks = description.split('\n\n') 37 paragraphs = description.split('\n\n') 38 print paragraphs 39 39 rets = [] 40 40 41 for block in blocks: 42 rets.append(optparse.IndentedHelpFormatter.format_description(self, 43 block)) 41 for paragraph in paragraphs: 42 # newlines starting with a space/dash are treated as a table, ie as 43 # is 44 lines = paragraph.split('\n -') 45 formatted = [] 46 for line in lines: 47 formatted.append(optparse.IndentedHelpFormatter.format_description(self, 48 line)) 49 rets.append(" -".join(formatted)) 50 44 51 ret = "\n".join(rets) 45 52
Note: See TracChangeset
for help on using the changeset viewer.
