From: Kristaps Dzonsons <kristaps@bsd.lv>
To: discuss@mdocml.bsd.lv
Subject: Re: desired .Bk semantics?
Date: Sat, 03 Jul 2010 18:24:47 +0200 [thread overview]
Message-ID: <4C2F644F.3070307@bsd.lv> (raw)
In-Reply-To: <20100703141126.GB20174@bramka.kerhand.co.uk>
[-- Attachment #1: Type: text/plain, Size: 2145 bytes --]
> i agree (with kristaps).
>
>> What we should do is ignore `Bk' and follow an easy algorithm for
>> SYNOPSIS mode regarding breaking between children. This, I think, is
>> easier for us and manual writers alike.
>>
>
> absolutely! SYNOPSIS is a hugely important part of the page - it's the
> first thing people see. and we don;t want it looking like shit. and we
> don;t want man page writers fannying around trying to make it look ok.
> it should just work sanely.
>
>> Is `Bk' used often outside of this where .nr nS 1 is otherwise
>> unacceptable (like those OpenBSD .9 manuals)?
>>
>
> it is a synopsis-only thing. obviously we sometimes have mini synopses
> outside the main SYNOPSIS section. in those cases we could currently
> find Bk. i'm not aware of any other places it would normally occur.
Ingo and Jason,
I propose the following. I've enclosed a patch that demonstrates this.
First, I disabled `Bk' completely.
Second, when `Op' or `Oo' is encountered with MDOC_SYNPRETTY (i.e., in a
SYNOPSIS section or with ".nr nS 1"), spaces are made non-breaking.
Example (mandoc -Owidth=70 ssh.1):
SYNOPSIS
ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address]
[-c cipher_spec] [-D [bind_address:]port] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport] [-l login_name]
[-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-W host:port] [-w local_tun[:remote_tun]] [user@]hostname
[command]
Note: this is after removing the escaped spaces that the manual author
had added here and there.
Example (mandoc -Owidth=70 spamd.8):
spamd [-45bdv] [-B maxblack] [-c maxcon]
[-G passtime:greyexp:whiteexp] [-h hostname] [-l address]
[-M address] [-n name] [-p port] [-S secs] [-s secs]
[-w window] [-Y synctarget] [-y synclisten]
This removes the `Bk' mess and gives a nice, regular algorithm for
formatting in MDOC_SYNPRETTY.
It can/will be trivially extended to the function macros, Fa and Fn and
family.
Thoughts?
Kristaps
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2026 bytes --]
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.168
diff -u -r1.168 mdoc_term.c
--- mdoc_term.c 2 Jul 2010 15:03:14 -0000 1.168
+++ mdoc_term.c 3 Jul 2010 16:26:03 -0000
@@ -72,7 +72,6 @@
static void termp_an_post(DECL_ARGS);
static void termp_aq_post(DECL_ARGS);
static void termp_bd_post(DECL_ARGS);
-static void termp_bk_post(DECL_ARGS);
static void termp_bl_post(DECL_ARGS);
static void termp_bq_post(DECL_ARGS);
static void termp_brq_post(DECL_ARGS);
@@ -98,7 +97,6 @@
static int termp_aq_pre(DECL_ARGS);
static int termp_bd_pre(DECL_ARGS);
static int termp_bf_pre(DECL_ARGS);
-static int termp_bk_pre(DECL_ARGS);
static int termp_bl_pre(DECL_ARGS);
static int termp_bold_pre(DECL_ARGS);
static int termp_bq_pre(DECL_ARGS);
@@ -238,7 +236,7 @@
{ NULL, NULL }, /* Fc */
{ termp_op_pre, termp_op_post }, /* Oo */
{ NULL, NULL }, /* Oc */
- { termp_bk_pre, termp_bk_post }, /* Bk */
+ { NULL, NULL }, /* Bk */
{ NULL, NULL }, /* Ek */
{ termp_bt_pre, NULL }, /* Bt */
{ NULL, NULL }, /* Hf */
@@ -1279,6 +1277,8 @@
if (MDOC_BODY != n->type)
return;
+ if (MDOC_SYNPRETTY & n->flags)
+ p->flags &= ~TERMP_KEEP;
p->flags |= TERMP_NOSPACE;
term_word(p, "\\(rB");
}
@@ -1460,6 +1460,8 @@
case (MDOC_BODY):
term_word(p, "\\(lB");
p->flags |= TERMP_NOSPACE;
+ if (MDOC_SYNPRETTY & n->flags)
+ p->flags |= TERMP_KEEP;
break;
default:
break;
@@ -2138,37 +2140,6 @@
return(0);
}
-
-/* ARGSUSED */
-static int
-termp_bk_pre(DECL_ARGS)
-{
-
- switch (n->type) {
- case (MDOC_BLOCK):
- break;
- case (MDOC_HEAD):
- return(0);
- case (MDOC_BODY):
- p->flags |= TERMP_PREKEEP;
- break;
- default:
- abort();
- /* NOTREACHED */
- }
-
- return(1);
-}
-
-
-/* ARGSUSED */
-static void
-termp_bk_post(DECL_ARGS)
-{
-
- if (MDOC_BODY == n->type)
- p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
-}
/* ARGSUSED */
static int
next prev parent reply other threads:[~2010-07-03 16:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-02 23:43 Ingo Schwarze
2010-07-03 6:54 ` Jason McIntyre
2010-07-03 12:27 ` Kristaps Dzonsons
2010-07-03 14:11 ` Jason McIntyre
2010-07-03 16:24 ` Kristaps Dzonsons [this message]
2010-07-03 16:52 ` Jason McIntyre
2010-07-03 17:25 ` desired .Bk semantics? [UPDATED PATCH] Kristaps Dzonsons
2010-07-03 17:28 ` desired .Bk semantics? Ingo Schwarze
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=4C2F644F.3070307@bsd.lv \
--to=kristaps@bsd.lv \
--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).