jeaye / stdman

Formatted C++20 stdlib man pages (cppreference)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`apropos` does not show CPPreference manpages

eclig opened this issue · comments

Thank you very much for providing this converter!

I've found a minor issue here: the command apropos (aka man -k)
uses a "whatis" database built using the command mandb to show a
list of manual pages matching a given keyword (at least on Linux).

The program mandb fails to extract the expected information from the
CPPreference manpages because they do not have a "NAME" section.

The following patch fixes this:

diff --git a/src/groff.hpp b/src/groff.hpp
index 1554a62..db1d41a 100644
--- a/src/groff.hpp
+++ b/src/groff.hpp
@@ -39,7 +39,9 @@ class groff
       /* First two lines are always the same. */
       state.lines[0] = ".TH " + name + " 3 "
                        "\"" + state.creation_date + "\" \"" + state.version + " | http://cppreference.com\" "
-                       "\"C++ Standard Libary\"";
+                       "\"C++ Standard Libary\""
+                       "\n" ".SH NAME\n" +
+                        name + " \\- " + name + "\n" ;
       state.lines[1] = "Synopsis";

       groff_detail::section(state.lines);

Note that I simply use the name of the method as its description. It's very
rough, maybe there is a way to extract a one-line description from the
text.

If you make a PR, I'd be happy to merge it can give you the proper credit. Let me know if this is something you'd like, otherwise we can work with the patch.

it's not worth the trouble for such a small change. But thanks anyway!

On Wed, Nov 04, 2015 at 05:33:53AM -0800, eclig wrote:

it's not worth the trouble for such a small change. But thanks anyway!

Not a problem; thanks for pointing out the issue and suggesting a patch. I'll see that this is taken care of.

@eclig This has been integrated now, as well as a reminder to run sudo mandb after installing. Thanks again.