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

Andrea Bolognani posted 1 patch 9 weeks ago
Failed in applying to current master (apply log)
tools/keymap-gen | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

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

Posted by Andrea Bolognani 9 weeks ago
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@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

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

Posted by Daniel P. Berrangé 9 weeks ago
On Mon, Apr 15, 2019 at 02:31:11PM +0200, Andrea Bolognani wrote:
> 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@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.

Thanks, I've pushed this.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list