docutils: Fix handling of ", or None ...".

This commit is contained in:
Florian Bruhin 2015-02-14 19:41:10 +01:00
parent b78d3934d7
commit 53b024f246
2 changed files with 5 additions and 2 deletions

View File

@ -99,7 +99,7 @@ Download a given URL, or current page if no URL given.
==== positional arguments
* +'url'+: The URL to download. If not given, download the current page.
* +'dest'+: The file path to write the download to to ask.
* +'dest'+: The file path to write the download to, or not given to ask.
[[download-cancel]]
=== download-cancel

View File

@ -102,7 +102,10 @@ class DocstringParser:
if stop:
break
for k, v in self.arg_descs.items():
self.arg_descs[k] = ' '.join(v).replace(', or None', '')
desc = ' '.join(v)
desc = re.sub(r', or None($|\.)', r'\1', desc)
desc = re.sub(r', or None', r', or not given', desc)
self.arg_descs[k] = desc
self.long_desc = ' '.join(self.long_desc)
self.short_desc = ' '.join(self.short_desc)