Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

man generator does not insert correct preprocessor hint #6803

Closed
magicus opened this issue Nov 3, 2020 · 5 comments
Closed

man generator does not insert correct preprocessor hint #6803

magicus opened this issue Nov 3, 2020 · 5 comments

Comments

@magicus
Copy link

magicus commented Nov 3, 2020

For some obscure reason, pandoc outputs an initial "t" line comment for man pages if the source markdown file contains a table.

Steps to reproduce:

cat << EOF | pandoc -f markdown -t man --standalone   
Col1 Col2
---- ----
Val1 Val2
EOF

Actual output:

.\"t
.\" Automatically generated by Pandoc 2.11.0.4
.\"
.TH "" "" "" "" ""
.hy
.PP
.TS
tab(@);
l l.
T{
Col1
T}@T{
Col2
T}
_
T{
Val1
T}@T{
Val2
T}
.TE

Expected output:

.\" Automatically generated by Pandoc 2.11.0.4
.\"
.TH "" "" "" "" ""
.hy
.PP
.TS
tab(@);
l l.
T{
Col1
T}@T{
Col2
T}
_
T{
Val1
T}@T{
Val2
T}
.TE

(note the absence of the initial .\"t in the expected output)

This has been present from at least 2.3.1. to 2.11.0.4 (latest released binary).

@jgm
Copy link
Owner

jgm commented Nov 3, 2020

There's a reason for this. Including a comment .\"t at the beginning forces groff to use the tbl preprocessor. Otherwise tables won't necessarily be processed. I suspect you'll find that man pages on your system that include the .TS and .TE macros have this comment at the start. On my system, I can see it in e.g. javadoc.1, reset.1, troff.1, and others.

Now, it may be that this is a holdover from earlier days, and that systems are now configured to run tbl by default. I'm really not sure. But I'm not sure I'd want to count on every system being configured this way.

@magicus
Copy link
Author

magicus commented Nov 3, 2020

Oh, ok, I. bow to your superior knowledge of ancient systems. :-)

@magicus magicus closed this as completed Nov 3, 2020
@magicus
Copy link
Author

magicus commented Nov 3, 2020

(Just for clarity: javadoc.1 contains this since it is generated by pandoc, so it is a bit of a circular evidence of this behavior; I actually noticed this behavior when I was working on the OpenJDK documentation.)

@jgm
Copy link
Owner

jgm commented Nov 3, 2020

I found the relevant documentation, in the groff_man(7) man page:

       When a preprocessor like tbl or eqn is needed, a hint can be  given  to
       the man page formatter by making the first line of a man page look like
       this:

              '\" word

       Note that the line starts with an apostrophe ('), not a dot, and that a
       single  space character follows the double quote.  The word consists of
       one letter for each needed preprocessor: `e' for eqn,  `r'  for  refer,
       and  `t'  for tbl.  Modern implementations of the man program interpret
       this first line and automatically call the right preprocessor(s).

@magicus
Copy link
Author

magicus commented Nov 3, 2020

Oh, but then pandoc is buggy anyway! ;-)

The pandoc output starts with a dot, not an apostrophe. And there is no space after the double quote.

So it should be '\" t instead of .\"t.

@magicus magicus reopened this Nov 3, 2020
@magicus magicus changed the title man generator inserts "t" as comment if source contains table man generator does not insert correct preprocessor hint Nov 3, 2020
@jgm jgm closed this as completed in 1b18278 Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants