From: Warren Block <wblock@wonkity.com>
To: discuss@mdocml.bsd.lv
Subject: Re: Identifying doc formats
Date: Tue, 7 Jul 2015 16:22:49 -0600 (MDT) [thread overview]
Message-ID: <alpine.BSF.2.20.1507071608080.39425@wonkity.com> (raw)
In-Reply-To: <15279.1436290257@CATHET.us>
On Tue, 7 Jul 2015, Anthony J. Bentley wrote:
> Warren Block writes:
>> 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.
>
> Yes, in -mandoc mode it is automatically detected; see mandoc(1):
>
> A third option, -mandoc, which is also the default, determines encoding
> on-the-fly: if the first non-comment macro is ?Dd? or ?Dt?, the mdoc(7)
> parser is used; otherwise, the man(7) parser is used.
Right, but that is not the goal. What I'm saying is that file(1) does
not tell whether a man page is mdoc or man format. mandoc knows, but
can it show just the detected format name rather than parsing and
displaying the man page?
That would also be a nice addition to file(1).
>> 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.
>
> This is exactly the case. Troff macro sets are specified to troff via the
> -m option. For example, if you look at a groff installation, the following
> files are used:
>
> /usr/local/share/groff/1.22.3/tmac/an.tmac
> /usr/local/share/groff/1.22.3/tmac/andoc.tmac
> /usr/local/share/groff/1.22.3/tmac/doc.tmac
That's... well, okay, I believe it. But that is not how those input
formats are shown in the mandoc man page currently. And I agree with
that, showing "-m(doc|an|andoc)" might be how the program does it
internally, but does not help make them mnemonic for the user.
--
To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv
prev parent reply other threads:[~2015-07-07 22:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-07 17:23 Warren Block
2015-07-07 17:30 ` Anthony J. Bentley
2015-07-07 22:22 ` Warren Block [this message]
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.1507071608080.39425@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).