discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Kristaps Dzonsons <kristaps@bsd.lv>
To: discuss@mdocml.bsd.lv
Cc: Jason McIntyre <jmc@kerhand.co.uk>
Subject: Re: Giant .Bk magically doing the right thing?!
Date: Sun, 27 Jun 2010 21:37:57 +0200	[thread overview]
Message-ID: <4C27A895.5000704@bsd.lv> (raw)
In-Reply-To: <20100627191143.GM19398@iris.usta.de>

> Jason just pointed me to a couple of instances of very strange .Bk
> usage that seem to magically do what you want - but i have no idea
> why, or how to implement this in mandoc.  For example, from ifconfig(8):
> 
> .Sh TUNNEL
> .Nm ifconfig
> .Bk -words
> .Ar tunnel-interface
> .Op Cm deletetunnel Ar src_address dest_address
> .Op Cm tunnel Ar src_address dest_address
> .Op Cm tunneldomain Ar route-id
> .Ek
> 
> This gives, with both old and new groff:
> 
> TUNNEL
>      ifconfig tunnel-interface [deletetunnel src_address dest_address]
>      [tunnel src_address dest_address] [tunneldomain route-id]
> 
> Without the .Bk, of course, groff gives:
> 
> TUNNEL
>      ifconfig tunnel-interface [deletetunnel src_address dest_address] [tunnel
>      src_address dest_address] [tunneldomain route-id]
> 
> Now, as far as i have understood and as i have documented in mdoc(7),
> i think .Bk is supposed to keep the words in its block together.
> How is groff telling the difference between the two spaces in the
> string "dest_address] [tunnel src_address"?
> 
> If the markup were
> 
> .Sh TUNNEL
> .Nm ifconfig
> .Bk -words
> .Ar tunnel-interface
> .Op Cm deletetunnel Ar src_address dest_address
> .Ek
> .Bk -words
> .Op Cm tunnel Ar src_address dest_address
> .Ek
> .Bk -words
> .Op Cm tunneldomain Ar route-id
> .Ek
> 
> i would understand.  But as it is, it looks like magic...

If you look at NetBSD's tmac file, which is easier to read than 
OpenBSD's (which reliably makes my eyes bleed), you may see that `Bk' 
defines "hard-space", which is only invoked within parsed /words/.

So in effect, hard-space is defined between words of the Op, but not 
between words and sub-expressions.

Which macros get "words" and which macros get parsed subexpressions is 
entirely on a macro-by-macro basis.

Note I say you "may see", because the tmacs themselves are mind-bending 
horrors without a single line of documentation.  I mean not a SINGLE 
line following the license.

You can always post this question to the groff mailing list. :-)

Kristaps
--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

  reply	other threads:[~2010-06-27 19:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-27 19:11 Ingo Schwarze
2010-06-27 19:37 ` Kristaps Dzonsons [this message]
2010-06-27 19:40   ` Joerg Sonnenberger

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=4C27A895.5000704@bsd.lv \
    --to=kristaps@bsd.lv \
    --cc=discuss@mdocml.bsd.lv \
    --cc=jmc@kerhand.co.uk \
    /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).