comparison 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
comparison
equal deleted inserted replaced
20654:af9d9b778550 20655:37f3be9d1541
48 allopts.append("--%s" % longopt) 48 allopts.append("--%s" % longopt)
49 if isinstance(default, list): 49 if isinstance(default, list):
50 allopts[-1] += " <%s[+]>" % optlabel 50 allopts[-1] += " <%s[+]>" % optlabel
51 elif (default is not None) and not isinstance(default, bool): 51 elif (default is not None) and not isinstance(default, bool):
52 allopts[-1] += " <%s>" % optlabel 52 allopts[-1] += " <%s>" % optlabel
53 if '\n' in desc:
54 # only remove line breaks and indentation
55 desc = ' '.join(l.lstrip() for l in desc.split('\n'))
53 desc += default and _(" (default: %s)") % default or "" 56 desc += default and _(" (default: %s)") % default or ""
54 yield (", ".join(allopts), desc) 57 yield (", ".join(allopts), desc)
55 58
56 def get_cmd(cmd, cmdtable): 59 def get_cmd(cmd, cmdtable):
57 d = {} 60 d = {}