diff doc/gendoc.py @ 20655:37f3be9d1541

doc: gendoc.py creates valid output for option descriptions with newlines gendoc.py did not handle the hanging indentation for descriptions. Work around this by joining all in one single line (same as in minirst since previous patch). This problem occurred when translations of option lines were very long. Do not bother the translators with this detail. On a long option description, the translator continued on a new line as usual. gendoc.py created invalid rst syntax like this: -o, --option Description line 1 description line 2 The new output is: -o, --option Description line 1 description line 2 The lines could theoretically become very long, but line breaking is handled when generating the final documentation.
author Simon Heimberg <simohe@besonet.ch>
date Thu, 20 Feb 2014 09:17:22 +0100
parents 93f9d11603d8
children 401f9b661a2d
line wrap: on
line diff
--- a/doc/gendoc.py	Wed Feb 19 17:32:21 2014 +0100
+++ b/doc/gendoc.py	Thu Feb 20 09:17:22 2014 +0100
@@ -50,6 +50,9 @@
             allopts[-1] += " <%s[+]>" % optlabel
         elif (default is not None) and not isinstance(default, bool):
             allopts[-1] += " <%s>" % optlabel
+        if '\n' in desc:
+            # only remove line breaks and indentation
+            desc = ' '.join(l.lstrip() for l in desc.split('\n'))
         desc += default and _(" (default: %s)") % default or ""
         yield (", ".join(allopts), desc)