discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Identifying doc formats
@ 2015-07-07 17:23 Warren Block
  2015-07-07 17:30 ` Anthony J. Bentley
  0 siblings, 1 reply; 3+ messages in thread
From: Warren Block @ 2015-07-07 17:23 UTC (permalink / raw)
  To: discuss

[-- Attachment #1: Type: text/plain, Size: 1855 bytes --]

Can mandoc just detect and display the input format?

file(1) says both tcpdump.1 and ls.1 in FreeBSD are "troff or 
preprocessor input, ASCII text", although one is man and the other is 
mdoc.


In a related note, the mandoc man page is a bit confusing about the 
input format option.  The synopsis says that input formats are

   [-mformat]

That implies--to me, at least--that it would be used as

   -mmdoc

or

   -mman

But...

   % mandoc -mman tcpdump.1
   man: Bad argument
   % mandoc -man tcpdump.1
   (works)

This seems to imply that the input formats could really be "doc", "an", 
and "andoc", and that's obviously not right.

The existing option might also assume that any future input formats will 
start with an "m".  That could be the way the code checks for the option 
internally, but think big.

This diff, also attached, is less confusing to me:

--- mandoc.1.orig	2015-07-07 11:10:38.756334000 -0600
+++ mandoc.1	2015-07-07 11:16:08.358326000 -0600
@@ -23,7 +23,7 @@
  .Sh SYNOPSIS
  .Nm mandoc
  .Op Fl V
-.Op Fl m Ns Ar format
+.Op Fl mdoc Ns | Ns Fl man Ns | Ns Fl mandoc
  .Op Fl O Ns Ar option
  .Op Fl T Ns Ar output
  .Op Fl W Ns Ar level
@@ -49,7 +49,7 @@
  .Pp
  The arguments are as follows:
  .Bl -tag -width Ds
-.It Fl m Ns Ar format
+.It Fl mdoc Ns | Ns Fl man Ns | Ns Fl mandoc
  Input format.
  See
  .Sx Input Formats

This renders as:

SYNOPSIS
      mandoc [-V] [-mdoc|-man|-mandoc] [-Ooption] [-Toutput] [-Wlevel]
             [file ...]

DESCRIPTION
      The mandoc utility formats UNIX manual pages for display.

      By default, mandoc reads mdoc(7) or man(7) text from stdin, implying
      -mandoc, and produces -Tascii output.

      The arguments are as follows:

      -mdoc|-man|-mandoc
              Input format.  See Input Formats for available formats.  Defaults
              to -mandoc.


Thanks!

[-- Attachment #2: Type: text/plain, Size: 496 bytes --]

--- mandoc.1.orig	2015-07-07 11:10:38.756334000 -0600
+++ mandoc.1	2015-07-07 11:16:08.358326000 -0600
@@ -23,7 +23,7 @@
 .Sh SYNOPSIS
 .Nm mandoc
 .Op Fl V
-.Op Fl m Ns Ar format
+.Op Fl mdoc Ns | Ns Fl man Ns | Ns Fl mandoc
 .Op Fl O Ns Ar option
 .Op Fl T Ns Ar output
 .Op Fl W Ns Ar level
@@ -49,7 +49,7 @@
 .Pp
 The arguments are as follows:
 .Bl -tag -width Ds
-.It Fl m Ns Ar format
+.It Fl mdoc Ns | Ns Fl man Ns | Ns Fl mandoc
 Input format.
 See
 .Sx Input Formats

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-07 22:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-07 17:23 Identifying doc formats Warren Block
2015-07-07 17:30 ` Anthony J. Bentley
2015-07-07 22:22   ` Warren Block

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).