man: sort options without "=" in the directives index

Some options would appear twice in the index, e.g. --collect= and
--collect. Some man pages use one form, some the other, and the argument
might be mandatory for some commands but not others. Anyway, let's display
them as one entry, to reduce the total number of items listed.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-11-21 22:02:07 +01:00
parent f8b68539d0
commit 8c6c56c36f
1 changed files with 3 additions and 0 deletions

View File

@ -187,6 +187,9 @@ def _extract_directives(directive_groups, formatting, page):
storvar if klass else storopt)):
for name in variablelist.iterfind(xpath):
text = re.sub(r'([= ]).*', r'\1', name.text).rstrip()
if text.startswith('-'):
# for options, merge options with and without mandatory arg
text = text.partition('=')[0]
stor[text].append((pagename, section))
if text not in formatting:
# use element as formatted display