From: Kristaps Dzonsons <kristaps@bsd.lv>
To: tech@mdocml.bsd.lv
Subject: Re: [WIP] SYNOPSIS indentation
Date: Sat, 26 Jun 2010 16:01:52 +0200 [thread overview]
Message-ID: <4C260850.3080100@bsd.lv> (raw)
In-Reply-To: <20100626134712.GC22002@iris.usta.de>
> here is the other patch i hacked up on the plane.
> It is still work in progress, there are few bugs in
> horizontal spacing still, but it mostly does the job
> and certainly shows the spirit.
> Again, this is based on OpenBSD-current, and needs to
> be rebased on bsd.lv HEAD.
>
> This is best used together with the .Bk patch just sent,
> but does not depend on it.
I'm quite pleased with the simplicity of this one. Nice! It needs to
be brought up to speed with term_strlen() and term_len(), but that's a
four-second operation (I noted the parts in-line).
Also, you'll need to modify mdoc.7 and mdoc.3 to note that `Nm' can be
two different types of variable.
Do make sure this doesn't break any assumptions of MDOC_ELEM in the
actioner/validator. I didn't double-check these.
Kristaps
> + switch (n->type) {
> + case (MDOC_BLOCK):
> + return(1);
> + case (MDOC_HEAD):
> + p->flags |= TERMP_NOBREAK | TERMP_HANG;
> + offset = n->child ? 6 : strlen(m->name)+1;
This'll be term_len(p, 6) and term_strlen(m->name) + term_len(p, 1).
> + p->rmargin = p->offset + offset;
> + break;
> + case (MDOC_BODY):
> + p->flags |= TERMP_NOLPAD | TERMP_NOSPACE;
> + offset = n->prev->child ? 6 : strlen(m->name)+1;
Same as above...
> + p->offset += offset;
> + return(1);
> + default:
> + break;
> + }
>
> if (NULL == n->child && NULL == m->name)
> return(1);
> @@ -1062,11 +1083,33 @@ termp_nm_pre(DECL_ARGS)
> term_fontpush(p, TERMFONT_BOLD);
> if (NULL == n->child)
> term_word(p, m->name);
> +
> return(1);
> }
>
>
> /* ARGSUSED */
> +static void
> +termp_nm_post(DECL_ARGS)
> +{
> +
> + switch (n->type) {
> + case (MDOC_HEAD):
> + term_flushln(p);
> + p->flags &= ~(TERMP_NOBREAK | TERMP_HANG);
> + break;
> + case (MDOC_BODY):
> + term_flushln(p);
> + p->flags &= ~TERMP_NOLPAD;
> + break;
> + default:
> + break;
> + }
> + return;
> +}
> +
> +
> +/* ARGSUSED */
> static int
> termp_fl_pre(DECL_ARGS)
> {
> --
> To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv
>
--
To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv
next prev parent reply other threads:[~2010-06-26 13:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-26 13:47 Ingo Schwarze
2010-06-26 14:01 ` Kristaps Dzonsons [this message]
2010-06-30 23:24 ` [PATCH] .Nm indentation in the SYNOPSIS Ingo Schwarze
2010-07-01 9:38 ` Kristaps Dzonsons
2010-07-01 12:59 ` Ingo Schwarze
2010-07-01 13:15 ` Kristaps Dzonsons
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=4C260850.3080100@bsd.lv \
--to=kristaps@bsd.lv \
--cc=tech@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).