make-directive-index: allow pages to specify the path to search

So far, make-directive-index would look for
./valistentry/term/varname for elements to add to the directive man page.

This commit allows to specify xpath= in the varlist directive to tell
the generator what to look for.
This commit is contained in:
Jérémy Rosen 2020-04-14 20:15:19 +02:00
parent d512670a1f
commit acbfdec33e
1 changed files with 2 additions and 1 deletions

View File

@ -180,9 +180,10 @@ def _extract_directives(directive_groups, formatting, page):
storopt = directive_groups['options']
for variablelist in t.iterfind('.//variablelist'):
klass = variablelist.attrib.get('class')
searchpath = variablelist.attrib.get('xpath','./varlistentry/term/varname')
storvar = directive_groups[klass or 'miscellaneous']
# <option>s go in OPTIONS, unless class is specified
for xpath, stor in (('./varlistentry/term/varname', storvar),
for xpath, stor in ((searchpath, storvar),
('./varlistentry/term/option',
storvar if klass else storopt)):
for name in variablelist.iterfind(xpath):