discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Warren Block <wblock@wonkity.com>
To: discuss@mdocml.bsd.lv
Subject: Identifying doc formats
Date: Tue, 7 Jul 2015 11:23:24 -0600 (MDT)	[thread overview]
Message-ID: <alpine.BSF.2.20.1507071100420.91939@wonkity.com> (raw)

[-- 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

             reply	other threads:[~2015-07-07 17:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07 17:23 Warren Block [this message]
2015-07-07 17:30 ` Anthony J. Bentley
2015-07-07 22:22   ` Warren Block

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.BSF.2.20.1507071100420.91939@wonkity.com \
    --to=wblock@wonkity.com \
    --cc=discuss@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).