Thanks for the handy answer, Ingo.

I am going to develop it better.

On 2020-06-15 04:13, Ingo Schwarze wrote:
Hi Abel,

Romero Perez, Abel wrote on Mon, Jun 15, 2020 at 03:06:26AM +0200:
Romero Perez, Abel wrote:

I tried to view the manuals in HTML format with lynx, but I couldn't

I assume what you mean is that you could, but the "-O tag" option had
no effect.

because lynx and links can't accept the /tmp/man.XXXXXX... file as
an URL...

In "-T html" output mode, the tag file isn't even written in the first
place.  Only the terminal formatter writes a tag file.

then I decided to add a new parameter (-U)

Absolutely not.  Adding new options to man(1) is completely out of
the question.  Option space is almost full and very messy already:

   https://mandoc.bsd.lv/man/man.options.1.html

It hardly matters that -U is already taken:

   https://mandoc.bsd.lv/man/man.options.1.html#U

You certainly can't take an option that is still free for this
purpose, either.

to pass the pager a formal file URL scheme as follows:
file:///tmp/man.XXXXXXX#tag
Then man spawns the pager (lynx for my case):
lynx -force_html file:///tmp/man.XXXXXXX#tag

That's an interesting idea.

It needs to be done by default when -T html -O tag is given, just
like tagging is enabled by default when the pager is less(1).

The testing command is:
PAGER="" MANPAGER="lynx -force_html" ./man -U -T html -O tag=k pfctl

The PAGER="" variable has no effect when MANPAGER is set,
see the man(1) manual.

So the goal is to make this work:

   MANPAGER="lynx -force_html" ./man -T html -O tag=k pfctl

Sorry, I didn't reviewed the code well. The first diff has some bugs.
As follows the stable diff (please, review):

I didn't review the diff closely, yet.

Obviously, using strncpy(3) or strncat(3) is not permitted,
but those should be easy to replace, perhaps with mandoc_asprintf(),
not sure yet.

It looks like you will have to pass outst into run_pager() and
spawn_pager() rather than outst.tag_files, such that you can check
for outst.outtype == OUTT_HTML inside spawn_pager().

In any case, thanks for the nice idea!

Yours,
   Ingo


Reply via email to