3

I am trying to use pandoc (if someone has a better conversion program I am all ears, please not ruby-dependent) to convert markdown files into manpages. It works fine until I go to do a doc with a table. Here is my test doc:

% Author Man
% TEST(1) This is a test | Version .01
% 18-April-2016

# Header1

# Format

foo

+-----------+-----------+-----------+
| linenum-1 | two       | three     |
|===========+===========+===========+
| three     | four      | fove      |
| 6         | 7         | 8         |
+-----------+-----------+-----------+

| linenum-1 | two       | three     |
|-----------|-----------|-----------|
| three     | four      | fove      |
| 6         | 7         | 8         |

| linenum-1 | two       | three
|-----------|-----------|--------:
| three     | four      | fove
| 6         | 7         | 8

I WAS HERE

| linenum-1 | two       | three
|---        |---        |---
| three     | four      | fove
| 6         | 7         | 8

here is some text

_italics_

**bold**

I was using

pandoc.exe -s -f markdown -t man ~/test.md | man -p t -l -

(I tried with and without the -p t to force the tbl preprocessor) with the same result:

Author Man()                                                                        Author Man()

Header1
Format
       foo

       tab(@); lw(11.7n) lw(11.7n) lw(11.7n).  T{

       linenum-1 ===========+ three 6 T}@T{

       two ===========+ four 7 T}@T{

       three ===========+ fove 8 T}

       tab(@); l l l.  T{ linenum-1 T}@T{ two T}@T{ three T} _ T{ three T}@T{ four T}@T{ fove T}
       T{ 6 T}@T{ 7 T}@T{ 8 T}

       tab(@); l l r.  T{ linenum-1 T}@T{ two T}@T{ three T} _ T{ three T}@T{ four T}@T{ fove T}
       T{ 6 T}@T{ 7 T}@T{ 8 T}

       I WAS HERE

       tab(@); l l l.  T{ linenum-1 T}@T{ two T}@T{ three T} _ T{ three T}@T{ four T}@T{ fove T}
       T{ 6 T}@T{ 7 T}@T{ 8 T}

       here is some text

       italics

       bold

AUTHORS
       TEST(1) This is a test | Version .01.

                                          18-April-2016                             Author Man()

The raw output without piping it to man is:

.\"t
.\" Automatically generated by Pandoc 1.17.0.2
.\"
.TH "Author Man" "" "18\-April\-2016" "" ""
.hy
.SH Header1
.SH Format
.PP
foo
.PP
.TS
tab(@);
lw(11.7n) lw(11.7n) lw(11.7n).
T{
.PP
linenum\-1 ===========+ three 6
T}@T{
.PP
two ===========+ four 7
T}@T{
.PP
three ===========+ fove 8
T}
.TE
.PP
.TS
tab(@);
l l l.
T{
linenum\-1
T}@T{
two
T}@T{
three
T}
_
T{
three
T}@T{
four
T}@T{
fove
T}
T{
6
T}@T{
7
T}@T{
8
T}
.TE
.PP
.TS
tab(@);
l l r.
T{
linenum\-1
T}@T{
two
T}@T{
three
T}
_
T{
three
T}@T{
four
T}@T{
fove
T}
T{
6
T}@T{
7
T}@T{
8
T}
.TE
.PP
I WAS HERE
.PP
.TS
tab(@);
l l l.
T{
linenum\-1
T}@T{
two
T}@T{
three
T}
_
T{
three
T}@T{
four
T}@T{
fove
T}
T{
6
T}@T{
7
T}@T{
8
T}
.TE
.PP
here is some text
.PP
\f[I]italics\f[]
.PP
\f[B]bold\f[]
.SH AUTHORS
TEST(1) This is a test | Version .01.

With the -d flag I get a lot, but only the last bit seems applicable:

final search path = /mingw64/share/man:/usr/share/man
restore_cwd: 3 (null)
pre-processors `t' from command line
page_encoding = UTF-8
source_encoding = ISO-8859-1
roff_encoding = ISO-8859-1
Terminal width 102
Terminal width 102 not within cat page range [80, 80]
formatted_encoding = UTF-8
opening -
opened -

And the fun part...

Pandoc on my debian 8.3 box generated the same output, but manpages displays that fine on debian/linux.

For a comparison

windows

  • pandoc.exe 1.17.0.2
  • man 2.7.4
  • GNU tbl (groff) version 1.22.3

linux

  • pandoc 1.12.4.2 [linux]
  • man 2.7.0.2

I've been reading through man man man groff_man man tbl etc for hours now and am no closer to solving this. Any ideas here would be GREATLY appreciated!!

Thank you -Eric

Edit - 1

The issue is without a doubt man and associated groff system on windows/msys. The pandoc output works fine on linux.

I found and tried an alternative rendering program:

http://embedeo.org/ws/doc/man_windows/

Which has no issue display the output from pandoc with the format

mandoc.exe foo.man.1 | less

Trying again a more direct

cat foo.man.1 | nroff -mandoc -Tlatin1 | less

Has the exact same effect as calling man -l -

I then tried downloading the gnuwin32 binaries direct and had the same result again

cat foo.man.1 | Downloads/groff-1.20.1-bin/bin/nroff -mandoc -Tlatin1 | less

1 Answer 1

3

Well apparently I am a bit slow this week...

simplest fix imaginable, and I only wasted 3 days:

pandoc.exe -s -f markdown -t man ~/test.md | dos2unix.exe | man -l -

(the key being the introduction of dos2unix.exe into the mix)

Yields a beautiful:

Author Man()                                                                                                                                                                             Author Man()

Header1
Format
       foo

              linenum-1             two                   three
              ===========+          ===========+          ===========+
              three                 four                  fove
              6                     7                     8

       linenum-1   two    three
       ─────────────────────────
       three       four   fove
       6           7      8

       linenum-1   two    three
       ─────────────────────────
       three       four    fove
       6           7          8

       I WAS HERE

       linenum-1   two    three
       ─────────────────────────
       three       four   fove
       6           7      8

       here is some text

       italics

       bold

AUTHORS
       TEST(1) This is a test | Version .01.

                                                                                            18-April-2016                                                                                Author Man()

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .