diff options
-rw-r--r-- | man_macro.c | 15 | ||||
-rw-r--r-- | regress/man/RS/Makefile | 2 | ||||
-rw-r--r-- | regress/man/RS/an-margin.in | 24 | ||||
-rw-r--r-- | regress/man/RS/an-margin.out_ascii | 17 |
4 files changed, 56 insertions, 2 deletions
diff --git a/man_macro.c b/man_macro.c index 7b4f8de8..4f00ff0a 100644 --- a/man_macro.c +++ b/man_macro.c @@ -235,6 +235,10 @@ blk_close(MACRO_PROT_ARGS) ntok = man->last->tok; man_unscope(man, nn); + if (tok == MAN_RE && nn->head->aux > 0) + roff_setreg(man->roff, "an-margin", + nn->head->aux, '-'); + /* Move a trailing paragraph behind the block. */ if (ntok == MAN_LP || ntok == MAN_PP || ntok == MAN_P) { @@ -256,8 +260,17 @@ blk_exp(MACRO_PROT_ARGS) head = roff_head_alloc(man, line, ppos, tok); la = *pos; - if (man_args(man, line, pos, buf, &p)) + if (man_args(man, line, pos, buf, &p)) { roff_word_alloc(man, line, la, p); + if (tok == MAN_RS) { + if (roff_getreg(man->roff, "an-margin") == 0) + roff_setreg(man->roff, "an-margin", + 7 * 24, '='); + if ((head->aux = strtod(p, NULL) * 24.0) > 0) + roff_setreg(man->roff, "an-margin", + head->aux, '+'); + } + } if (buf[*pos] != '\0') mandoc_vmsg(MANDOCERR_ARG_EXCESS, man->parse, line, diff --git a/regress/man/RS/Makefile b/regress/man/RS/Makefile index 4c62bb30..fda516e0 100644 --- a/regress/man/RS/Makefile +++ b/regress/man/RS/Makefile @@ -1,6 +1,6 @@ # $OpenBSD: Makefile,v 1.11 2015/04/06 13:34:54 schwarze Exp $ -REGRESS_TARGETS = breaking broken empty literal lonelyRE +REGRESS_TARGETS = an-margin breaking broken empty literal lonelyRE REGRESS_TARGETS += nested noRE nowidth REarg width LINT_TARGETS = empty lonelyRE noRE REarg diff --git a/regress/man/RS/an-margin.in b/regress/man/RS/an-margin.in new file mode 100644 index 00000000..b14b2cae --- /dev/null +++ b/regress/man/RS/an-margin.in @@ -0,0 +1,24 @@ +.TH RS-AN-MARGIN 1 "June 13, 2017" OpenBSD +.SH NAME +RS-an-margin \- reStructuredText peeks at an internal register +.SH DESCRIPTION +regular +text +.RS 0.0 +zero +indent +\n[an-margin] +.RS 3.5 +non-zero +indent +\n[an-margin] +.RE +back to +zero +indent +\n[an-margin] +.RE +back to +regular +text +\n[an-margin] diff --git a/regress/man/RS/an-margin.out_ascii b/regress/man/RS/an-margin.out_ascii new file mode 100644 index 00000000..be41d4ec --- /dev/null +++ b/regress/man/RS/an-margin.out_ascii @@ -0,0 +1,17 @@ +RS-AN-MARGIN(1) General Commands Manual RS-AN-MARGIN(1) + + + +NNAAMMEE + RS-an-margin - reStructuredText peeks at an internal register + +DDEESSCCRRIIPPTTIIOONN + regular text + zero indent 168 + non-zero indent 252 + back to zero indent 168 + back to regular text 168 + + + +OpenBSD June 13, 2017 RS-AN-MARGIN(1) |