lucc / nvimpager

Use nvim as a pager to view manpages, diffs, etc with nvim's syntax highlighting
Other
366 stars 19 forks source link

following fields table missing in man page #54

Closed docwhat closed 6 months ago

docwhat commented 2 years ago

The manpage isn't right for me. The "following fields" table is missing.

I'm using scdoc version 1.11.1 on the develop branch (49315df) and there are no errors when building.

When I view the page, I get this:

❯ man nvimpager        
/usr/bin/tbl:<standard input>:106: unrecognised format `T'
/usr/bin/tbl:<standard input>:106: giving up on this table

The macOS man uses the builtin version of /usr/bin/tbl which is GNU tbl (groff) version 1.19.2.

lucc commented 2 years ago

I have trouble reproducing this. I do not have macos (which version btw?) and so I was looking for a way to install this version of groff in some VM or container. This is what I found:

  1. The version of groff that you use is very old (16 years): https://git.savannah.gnu.org/cgit/groff.git/refs/
  2. It looks like there are very view systems/repositories that have such an old version of groff: https://repology.org/project/groff/versions (Is there a page that shows us the version info of different software packages for macos versions? Like this preinstalled groff and so on.)
  3. my first try was a podman cotainer with centos6 but the repos for centos6 are dead so I not install man on the container

I am now wandering: Maybe you can just install a newer version of groff (with homebrew or macports or so) and this could be solved?

docwhat commented 2 years ago

I have macOS 11.6

macOS comes with that version of groff 1.19.2. I can (and did) install a newer groff via Homebrew.

You can look these up here https://opensource.apple.com – Note, 11.6 isn't there yet... it can take a while for it all to clear their review. 11.5 is "close enough" I suspect.

lucc commented 2 years ago

so what happens with the newer groff?

docwhat commented 2 years ago

The binary /usr/bin/man on macOS has hardcoded paths to tools like /usr/bin/tbl, so I can't upgrade it.

❯ strings =man | grep /usr/bin/
/usr/bin/mandoc
/usr/bin/apropos
/usr/bin/whatis
/usr/bin/groff -Tps -mandoc -c
/usr/bin/groff -Wall -mtty-char -Tascii -mandoc -c
/usr/bin/groff -Tnippon -mandocj -c
/usr/bin/eqn -Tps
/usr/bin/eqn -Tascii
/usr/bin/eqn -Tnippon
/usr/bin/tbl
/usr/bin/refer
/usr/bin/pic
/usr/bin/less -is
/usr/bin/cmp -s

Sorry I took song long to reply.

docwhat commented 2 years ago

I have trouble reproducing this. I do not have macos (which version btw?) and so I was looking for a way to install this version of groff in some VM or container.

You can create a GitHub action (or other CI system) that uses macOS as the worker. This would let you see what errors, etc. come out the other end.

lucc commented 2 years ago

We are actually already running the tests on osx: https://github.com/lucc/nvimpager/blob/develop/.travis.yml#L30-L34

I am wondering what command could be used to test what you experience. I can display the man page but that does not fail and one has to look at the test output to see the problem: https://app.travis-ci.com/github/lucc/nvimpager/jobs/544681386

docwhat commented 2 years ago

Maybe use a multi-line regexp to look for a lack of a table via perl?

lucc commented 1 year ago

@docwhat I created the test/osx-man-page branch. Can you please check if that works for you.

docwhat commented 1 year ago

Looks good! The table is all there. There is no wrapping, but I think that's how it is meant to be.

macOS: 13beta scdoc: 1.11.2

lucc commented 1 year ago

What do you mean "The table is all there"? I thought the whole point of this issue is that the table is not shown on macOS.

docwhat commented 1 year ago

In the generated man page:

Yay! 🎉

lucc commented 1 year ago

I am very confused. Can you help me understand what exactly is goiing on?

  1. which branch/commit of nvimpager are you using?
  2. how do you build the man page? make clean nvimpager.1 or make clean nvimpager.1 LEGACY_ROFF=true (only applicable on the test/osx-man-page branch)
  3. what version of groff or tbl is your man executable using (are you using the one from macOS or did you install a different version of man/groff/tbl with brew or nix)?
lucc commented 1 year ago

I am asking because I would just throw away the branch test/osx-man-page if everything now works without it on macOS. I am not very keen on maintaining different versions of the man page with some fragile conversion code.

lucc commented 6 months ago

@docwhat is this resolved? I am still unsure about your last comment.

By accident I found a possible workaround to have the macOS version of man use a newer groff: https://tkurtbond.github.io/posts/2021/07/26/making-a-newer-version-of-groff-work-with-man-and-emacs-on-macos/

docwhat commented 6 months ago

It is resolved:

image