man: skip directive starting with ".."

the target definition of hyper link looks like:

.. _a-reference-label:

there is chance that we need to add `:ref:` referencing man pages,
and add target definition at the beginning of the manapges for the
references. in that case, we need to skip the ref directives when
looking for the title of the manpage.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2018-08-15 13:28:53 +08:00
parent 4cf9e35cf5
commit ad93d71c8f

View File

@ -17,6 +17,8 @@ def _get_description(fname, base):
continue
if line.startswith(':') and line.endswith(':'):
continue
if line.startswith('.. '):
continue
one = line
break
two = f.readline().rstrip('\n')