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 writer: use default middle header when calling .TH when metadata does not include one #9943

Closed
dimztimz opened this issue Jul 3, 2024 · 0 comments
Labels

Comments

@dimztimz
Copy link

dimztimz commented Jul 3, 2024

Explain the problem.

The following input:

---
title: HELLO
section: 1
---

# DESCRIPTION

hello world

Using the following command line: pandoc --from markdown --to man --standalone

Produces the following output:

.TH "HELLO" "1" "" "" ""
.SH DESCRIPTION
hello world

What I expect is that the last argument to the .TH macro to be omitted:

.TH "HELLO" "1" "" ""

Pandoc version?

Tested with v3.1.3, but also on online version

Rationale

The .TH macro has some optional arguments. See groff_man(7) and man-pages(7). If the last argument is omitted, the header in the rendered man-page will be the default one which depends on the section number. See relevant quotes:

.TH identifier section [footer-middle [footer-inside [header-middle]]]
...
header-middle is centered in the header. If section is an integer between 1 and 9 (inclusive), there is no need to specify header-middle; an.tmac will supply text for it.

The first command in a man page should be a TH command:

.TH title section date source manual-section
...
manual-section: Normally, this should be empty, since the default value will be good.

More insight

See following line in the template for standalone output:

.TH "$title/nowrap$" "$section/nowrap$" "$date/nowrap$" "$footer/nowrap$" "$header/nowrap$"

Is it possible to change this so that if the variable header is undefined, then the last argument is omitted instead of writing empty double quotes ("")?

@dimztimz dimztimz added the bug label Jul 3, 2024
@jgm jgm closed this as completed in 60c0149 Jul 3, 2024
jgm added a commit that referenced this issue Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant