[libvirt] [keycodemapdb PATCH] keymap-gen: Name sections in pod output

Andrea Bolognani abologna at redhat.com
Mon Apr 15 12:31:11 UTC 2019


Properly formatted man pages have at least a NAME section,
which tools like apropos(1) parse and index.

The current implementation of PodLanguageGenerator doesn't
generate this section, and even if the user were to try and
work around the limitation by passing --varname=NAME, there
would still be nothing in the section to actually parse.

Change the generator so that varname will be used as the
contents of the NAME section, add a DESCRIPTION section in
which values are listed.

Signed-off-by: Andrea Bolognani <abologna at redhat.com>
---
Dan said on IRC he would accept keycodemapdb patches sent to
the mailing list of any project using the module, so here we
are :) I need this to fix generation of virkey{code,name}-*
man pages anyway.

 tools/keymap-gen | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/keymap-gen b/tools/keymap-gen
index 7965d37..78676a9 100755
--- a/tools/keymap-gen
+++ b/tools/keymap-gen
@@ -873,7 +873,11 @@ class PodLanguageGenerator(LanguageDocGenerator):
         print("#")
 
     def _array_start_name_doc(self, varname, namemap):
-        print("=head1 %s" % varname)
+        print("=head1 NAME")
+        print("")
+        print("%s" % varname)
+        print("")
+        print("=head1 DESCRIPTION")
         print("")
         print("List of %s key code names, with corresponding key code values" % namemap)
         print("")
@@ -881,7 +885,11 @@ class PodLanguageGenerator(LanguageDocGenerator):
         print("")
 
     def _array_start_code_doc(self, varname, codemap, namemap):
-        print("=head1 %s" % varname)
+        print("=head1 NAME")
+        print("")
+        print("%s" % varname)
+        print("")
+        print("=head1 DESCRIPTION")
         print("")
         print("List of %s key code values, with corresponding %s key code names" % (codemap, namemap))
         print("")
-- 
2.20.1




More information about the libvir-list mailing list