From 60c0149084e00649694b21bbb7513d992ea5622f Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 3 Jul 2024 16:25:55 -0600 Subject: [PATCH] Man writer: use default middle header when metadata does not... include `header`. This change causes pandoc to omit the middle header parameter when `header` is not set, rather than emitting `""`. The parameter is optional and man will use a default based on the section if it is not specified. Closes #9943. --- data/templates/default.man | 2 +- test/command/9943.md | 20 ++++++++++++++++++++ test/writer.man | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 test/command/9943.md diff --git a/data/templates/default.man b/data/templates/default.man index 84aa37d73..d806b4ac6 100644 --- a/data/templates/default.man +++ b/data/templates/default.man @@ -8,7 +8,7 @@ $endif$ $if(adjusting)$ .ad $adjusting$ $endif$ -.TH "$title/nowrap$" "$section/nowrap$" "$date/nowrap$" "$footer/nowrap$" "$header/nowrap$" +.TH "$title/nowrap$" "$section/nowrap$" "$date/nowrap$" "$footer/nowrap$"$if(header)$ "$header/nowrap$"$endif$ $for(header-includes)$ $header-includes$ $endfor$ diff --git a/test/command/9943.md b/test/command/9943.md new file mode 100644 index 000000000..fcca808bf --- /dev/null +++ b/test/command/9943.md @@ -0,0 +1,20 @@ +``` +% pandoc -t man -s -Vpandoc-version='' +--- +title: HELLO +section: 1 +--- +^D +.TH "HELLO" "1" "" "" +``` + +``` +% pandoc -t man -s -Vpandoc-version='' +--- +title: HELLO +section: 1 +header: Head +--- +^D +.TH "HELLO" "1" "" "" "Head" +``` diff --git a/test/writer.man b/test/writer.man index dfb234a07..4d6a96548 100644 --- a/test/writer.man +++ b/test/writer.man @@ -1,4 +1,4 @@ -.TH "Pandoc Test Suite" "" "July 17, 2006" "" "" +.TH "Pandoc Test Suite" "" "July 17, 2006" "" .PP This is a set of tests for pandoc. Most of them are adapted from John Gruber\[cq]s markdown test suite.