summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--regress/usr.bin/mandoc/roff/Makefile4
-rw-r--r--regress/usr.bin/mandoc/roff/ti/Makefile5
-rw-r--r--regress/usr.bin/mandoc/roff/ti/basic-man.in18
-rw-r--r--regress/usr.bin/mandoc/roff/ti/basic-man.out_ascii21
-rw-r--r--regress/usr.bin/mandoc/roff/ti/basic-mdoc.in21
-rw-r--r--regress/usr.bin/mandoc/roff/ti/basic-mdoc.out_ascii17
-rw-r--r--share/man/man7/roff.716
-rw-r--r--usr.bin/mandoc/mdoc_man.c14
-rw-r--r--usr.bin/mandoc/roff.c8
-rw-r--r--usr.bin/mandoc/roff.h4
-rw-r--r--usr.bin/mandoc/roff_html.c3
-rw-r--r--usr.bin/mandoc/roff_term.c44
-rw-r--r--usr.bin/mandoc/roff_validate.c3
-rw-r--r--usr.bin/mandoc/term.h3
-rw-r--r--usr.bin/mandoc/term_ascii.c8
-rw-r--r--usr.bin/mandoc/term_ps.c7
16 files changed, 170 insertions, 26 deletions
diff --git a/regress/usr.bin/mandoc/roff/Makefile b/regress/usr.bin/mandoc/roff/Makefile
index 05bb9effd1b..7c180a341d6 100644
--- a/regress/usr.bin/mandoc/roff/Makefile
+++ b/regress/usr.bin/mandoc/roff/Makefile
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile,v 1.21 2017/05/07 17:30:58 schwarze Exp $
+# $OpenBSD: Makefile,v 1.22 2017/05/08 15:33:43 schwarze Exp $
SUBDIR = args cond esc scale string
-SUBDIR += br cc de ds ft ig it ll na nr ps rm sp ta tr
+SUBDIR += br cc de ds ft ig it ll na nr ps rm sp ta ti tr
.include "../Makefile.sub"
.include <bsd.subdir.mk>
diff --git a/regress/usr.bin/mandoc/roff/ti/Makefile b/regress/usr.bin/mandoc/roff/ti/Makefile
new file mode 100644
index 00000000000..6203d4f4821
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/ti/Makefile
@@ -0,0 +1,5 @@
+# $OpenBSD: Makefile,v 1.1 2017/05/08 15:33:43 schwarze Exp $
+
+REGRESS_TARGETS = basic-mdoc basic-man
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/mandoc/roff/ti/basic-man.in b/regress/usr.bin/mandoc/roff/ti/basic-man.in
new file mode 100644
index 00000000000..deb1542f040
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/ti/basic-man.in
@@ -0,0 +1,18 @@
+.TH TI-BASIC-MAN 1 "May 8, 2014" OpenBSD
+.SH NAME
+ti-basic-man \- temporary indentation in man(7)
+.SH DESCRIPTION
+initial text
+.ti 10n
+This text is indented.
+However, the indent is temporary,
+so as soon as the line wraps, it is gone.
+.ti +10n
+The temporary indent can be relative.
+All the same, it will expire in the usual way.
+.ti -3n
+It is also possible to temporarily reduce the indentation,
+but that will also last until the next line break only.
+.ti -10n
+Reducing by more than the current offset
+starts the next line at the physical left margin.
diff --git a/regress/usr.bin/mandoc/roff/ti/basic-man.out_ascii b/regress/usr.bin/mandoc/roff/ti/basic-man.out_ascii
new file mode 100644
index 00000000000..acc53f45383
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/ti/basic-man.out_ascii
@@ -0,0 +1,21 @@
+TI-BASIC-MAN(1) General Commands Manual TI-BASIC-MAN(1)
+
+
+
+NNAAMMEE
+ ti-basic-man - temporary indentation in man(7)
+
+DDEESSCCRRIIPPTTIIOONN
+ initial text
+ This text is indented. However, the indent is temporary, so as soon
+ as the line wraps, it is gone.
+ The temporary indent can be relative. All the same, it will
+ expire in the usual way.
+ It is also possible to temporarily reduce the indentation, but that will
+ also last until the next line break only.
+Reducing by more than the current offset starts the next line at the physical
+ left margin.
+
+
+
+OpenBSD May 8, 2014 TI-BASIC-MAN(1)
diff --git a/regress/usr.bin/mandoc/roff/ti/basic-mdoc.in b/regress/usr.bin/mandoc/roff/ti/basic-mdoc.in
new file mode 100644
index 00000000000..0b165bc1869
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/ti/basic-mdoc.in
@@ -0,0 +1,21 @@
+.Dd May 8, 2017
+.Dt TI-BASIC-MDOC 1
+.Os OpenBSD
+.Sh NAME
+.Nm ti-basic-mdoc
+.Nd temporary indent in mdoc(7)
+.Sh DESCRIPTION
+initial text
+.ti 10n
+This text is indented.
+However, the indent is temporary,
+so as soon as the line wraps, it is gone.
+.ti +10n
+The temporary indent can be relative.
+All the same, it will expire in the usual way.
+.ti -3n
+It is also possible to temporarily reduce the indentation,
+but that will also last until the next line break only.
+.ti -10n
+Reducing by more than the current offset
+starts the next line at the physical left margin.
diff --git a/regress/usr.bin/mandoc/roff/ti/basic-mdoc.out_ascii b/regress/usr.bin/mandoc/roff/ti/basic-mdoc.out_ascii
new file mode 100644
index 00000000000..a115b02d53b
--- /dev/null
+++ b/regress/usr.bin/mandoc/roff/ti/basic-mdoc.out_ascii
@@ -0,0 +1,17 @@
+TI-BASIC-MDOC(1) General Commands Manual TI-BASIC-MDOC(1)
+
+NNAAMMEE
+ ttii--bbaassiicc--mmddoocc - temporary indent in mdoc(7)
+
+DDEESSCCRRIIPPTTIIOONN
+ initial text
+ This text is indented. However, the indent is temporary, so as soon
+ as the line wraps, it is gone.
+ The temporary indent can be relative. All the same, it will
+ expire in the usual way.
+ It is also possible to temporarily reduce the indentation, but that will
+ also last until the next line break only.
+Reducing by more than the current offset starts the next line at the physical
+ left margin.
+
+OpenBSD May 8, 2017 OpenBSD
diff --git a/share/man/man7/roff.7 b/share/man/man7/roff.7
index 7fd72a9b20b..4054e4e59bf 100644
--- a/share/man/man7/roff.7
+++ b/share/man/man7/roff.7
@@ -1,7 +1,7 @@
-.\" $OpenBSD: roff.7,v 1.59 2017/05/08 03:55:09 schwarze Exp $
+.\" $OpenBSD: roff.7,v 1.60 2017/05/08 15:33:43 schwarze Exp $
.\"
.\" Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
-.\" Copyright (c) 2010, 2011, 2013-2015 Ingo Schwarze <schwarze@openbsd.org>
+.\" Copyright (c) 2010,2011,2013-2015,2017 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
@@ -1583,9 +1583,15 @@ Currently unsupported.
End a table context.
See
.Sx \&TS .
-.It Ic \&tii Oo Cm + Ns | Ns Cm - Oc Ns Ar width
-Temporary indent.
-Currently unsupported.
+.It Ic \&ti Oo Cm + Ns | Ns Cm - Oc Ns Ar width
+Break the output line and indent the next output line by
+.Ar width .
+If a sign is specified, the temporary indentation is calculated
+relative to the current indentation; otherwise, it is absolute.
+The argument follows the syntax of
+.Sx Scaling Widths
+and the default scaling unit is
+.Cm m .
.It Ic \&tkf Ar font minps width1 maxps width2
Enable track kerning for a font.
Currently ignored.
diff --git a/usr.bin/mandoc/mdoc_man.c b/usr.bin/mandoc/mdoc_man.c
index f20d39c82e4..027af713485 100644
--- a/usr.bin/mandoc/mdoc_man.c
+++ b/usr.bin/mandoc/mdoc_man.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mdoc_man.c,v 1.112 2017/05/07 17:30:58 schwarze Exp $ */
+/* $OpenBSD: mdoc_man.c,v 1.113 2017/05/08 15:33:43 schwarze Exp $ */
/*
* Copyright (c) 2011-2017 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -99,10 +99,10 @@ static int pre_in(DECL_ARGS);
static int pre_it(DECL_ARGS);
static int pre_lk(DECL_ARGS);
static int pre_li(DECL_ARGS);
-static void pre_ll(DECL_ARGS);
static int pre_nm(DECL_ARGS);
static int pre_no(DECL_ARGS);
static int pre_ns(DECL_ARGS);
+static void pre_onearg(DECL_ARGS);
static int pre_pp(DECL_ARGS);
static int pre_rs(DECL_ARGS);
static int pre_sm(DECL_ARGS);
@@ -125,9 +125,10 @@ static void print_node(DECL_ARGS);
static const void_fp roff_manacts[ROFF_MAX] = {
pre_br,
pre_ft,
- pre_ll,
+ pre_onearg,
pre_sp,
pre_ta,
+ pre_onearg,
};
static const struct manact __manacts[MDOC_MAX - MDOC_Dd] = {
@@ -1563,9 +1564,12 @@ pre_lk(DECL_ARGS)
}
static void
-pre_ll(DECL_ARGS)
+pre_onearg(DECL_ARGS)
{
- print_line(".ll", 0);
+ outflags |= MMAN_nl;
+ print_word(".");
+ outflags &= ~MMAN_spc;
+ print_word(roff_name[n->tok]);
if (n->child != NULL)
print_word(n->child->string);
outflags |= MMAN_nl;
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index 3448c46da18..f2395296b30 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.c,v 1.172 2017/05/07 17:30:58 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.173 2017/05/08 15:33:43 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -211,7 +211,7 @@ static enum rofferr roff_userdef(ROFF_ARGS);
const char *__roff_name[MAN_MAX + 1] = {
"br", "ft", "ll", "sp",
- "ta", NULL,
+ "ta", "ti", NULL,
"ab", "ad", "af", "aln",
"als", "am", "am1", "ami",
"ami1", "as", "as1", "asciify",
@@ -262,7 +262,7 @@ const char *__roff_name[MAN_MAX + 1] = {
"spacewidth", "special", "spreadwarn", "ss",
"sty", "substring", "sv", "sy",
"T&", "tc", "TE",
- "TH", "ti", "tkf", "tl",
+ "TH", "tkf", "tl",
"tm", "tm1", "tmc", "tr",
"track", "transchar", "trf", "trimat",
"trin", "trnt", "troff", "TS",
@@ -322,6 +322,7 @@ static struct roffmac roffs[TOKEN_NONE] = {
{ roff_onearg, NULL, NULL, 0 }, /* ll */
{ roff_onearg, NULL, NULL, 0 }, /* sp */
{ roff_manyarg, NULL, NULL, 0 }, /* ta */
+ { roff_onearg, NULL, NULL, 0 }, /* ti */
{ NULL, NULL, NULL, 0 }, /* ROFF_MAX */
{ roff_unsupp, NULL, NULL, 0 }, /* ab */
{ roff_line_ignore, NULL, NULL, 0 }, /* ad */
@@ -523,7 +524,6 @@ static struct roffmac roffs[TOKEN_NONE] = {
{ roff_unsupp, NULL, NULL, 0 }, /* tc */
{ roff_TE, NULL, NULL, 0 }, /* TE */
{ roff_TH, NULL, NULL, 0 }, /* TH */
- { roff_unsupp, NULL, NULL, 0 }, /* ti */
{ roff_line_ignore, NULL, NULL, 0 }, /* tkf */
{ roff_unsupp, NULL, NULL, 0 }, /* tl */
{ roff_line_ignore, NULL, NULL, 0 }, /* tm */
diff --git a/usr.bin/mandoc/roff.h b/usr.bin/mandoc/roff.h
index 61c72bf4baa..59384b5caf6 100644
--- a/usr.bin/mandoc/roff.h
+++ b/usr.bin/mandoc/roff.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.h,v 1.29 2017/05/07 17:30:58 schwarze Exp $ */
+/* $OpenBSD: roff.h,v 1.30 2017/05/08 15:33:43 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -71,6 +71,7 @@ enum roff_tok {
ROFF_ll,
ROFF_sp,
ROFF_ta,
+ ROFF_ti,
ROFF_MAX,
ROFF_ab,
ROFF_ad,
@@ -275,7 +276,6 @@ enum roff_tok {
ROFF_tc,
ROFF_TE,
ROFF_TH,
- ROFF_ti,
ROFF_tkf,
ROFF_tl,
ROFF_tm,
diff --git a/usr.bin/mandoc/roff_html.c b/usr.bin/mandoc/roff_html.c
index 7778d94c433..a031d98aeac 100644
--- a/usr.bin/mandoc/roff_html.c
+++ b/usr.bin/mandoc/roff_html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff_html.c,v 1.4 2017/05/07 17:30:58 schwarze Exp $ */
+/* $OpenBSD: roff_html.c,v 1.5 2017/05/08 15:33:43 schwarze Exp $ */
/*
* Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2014, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -37,6 +37,7 @@ static const roff_html_pre_fp roff_html_pre_acts[ROFF_MAX] = {
NULL, /* ll */
roff_html_pre_sp, /* sp */
NULL, /* ta */
+ NULL, /* ti */
};
diff --git a/usr.bin/mandoc/roff_term.c b/usr.bin/mandoc/roff_term.c
index 770fed68e6b..4d5b50ff47b 100644
--- a/usr.bin/mandoc/roff_term.c
+++ b/usr.bin/mandoc/roff_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff_term.c,v 1.5 2017/05/07 17:30:58 schwarze Exp $ */
+/* $OpenBSD: roff_term.c,v 1.6 2017/05/08 15:33:43 schwarze Exp $ */
/*
* Copyright (c) 2010, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -32,6 +32,7 @@ static void roff_term_pre_ft(ROFF_TERM_ARGS);
static void roff_term_pre_ll(ROFF_TERM_ARGS);
static void roff_term_pre_sp(ROFF_TERM_ARGS);
static void roff_term_pre_ta(ROFF_TERM_ARGS);
+static void roff_term_pre_ti(ROFF_TERM_ARGS);
static const roff_term_pre_fp roff_term_pre_acts[ROFF_MAX] = {
roff_term_pre_br, /* br */
@@ -39,6 +40,7 @@ static const roff_term_pre_fp roff_term_pre_acts[ROFF_MAX] = {
roff_term_pre_ll, /* ft */
roff_term_pre_sp, /* sp */
roff_term_pre_ta, /* ta */
+ roff_term_pre_ti, /* ti */
};
@@ -121,3 +123,43 @@ roff_term_pre_ta(ROFF_TERM_ARGS)
for (n = n->child; n != NULL; n = n->next)
term_tab_set(p, n->string);
}
+
+static void
+roff_term_pre_ti(ROFF_TERM_ARGS)
+{
+ struct roffsu su;
+ const char *cp;
+ int len, sign;
+
+ roff_term_pre_br(p, n);
+
+ if (n->child == NULL)
+ return;
+ cp = n->child->string;
+ if (*cp == '+') {
+ sign = 1;
+ cp++;
+ } else if (*cp == '-') {
+ sign = -1;
+ cp++;
+ } else
+ sign = 0;
+
+ if (a2roffsu(cp, &su, SCALE_EM) == 0)
+ return;
+ len = term_hspan(p, &su) / 24;
+
+ if (sign == 0) {
+ p->ti = len - p->offset;
+ p->offset = len;
+ } else if (sign == 1) {
+ p->ti = len;
+ p->offset += len;
+ } else if ((size_t)len < p->offset) {
+ p->ti = -len;
+ p->offset -= len;
+ } else {
+ p->ti = -p->offset;
+ p->offset = 0;
+ }
+}
diff --git a/usr.bin/mandoc/roff_validate.c b/usr.bin/mandoc/roff_validate.c
index 154b66a90e9..558255ddb44 100644
--- a/usr.bin/mandoc/roff_validate.c
+++ b/usr.bin/mandoc/roff_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff_validate.c,v 1.4 2017/05/07 17:30:58 schwarze Exp $ */
+/* $OpenBSD: roff_validate.c,v 1.5 2017/05/08 15:33:43 schwarze Exp $ */
/*
* Copyright (c) 2010, 2017 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -36,6 +36,7 @@ static const roff_valid_fp roff_valids[ROFF_MAX] = {
NULL, /* ll */
NULL, /* sp */
NULL, /* ta */
+ NULL, /* ti */
};
diff --git a/usr.bin/mandoc/term.h b/usr.bin/mandoc/term.h
index f2bcca05902..6e14411e55c 100644
--- a/usr.bin/mandoc/term.h
+++ b/usr.bin/mandoc/term.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: term.h,v 1.64 2017/05/07 17:30:58 schwarze Exp $ */
+/* $OpenBSD: term.h,v 1.65 2017/05/08 15:33:43 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -68,6 +68,7 @@ struct termp {
size_t viscol; /* Chars on current line. */
size_t trailspace; /* See termp_flushln(). */
int overstep; /* See termp_flushln(). */
+ int ti; /* Temporary indent for one line. */
int skipvsp; /* Vertical space to skip. */
int flags;
#define TERMP_SENTENCE (1 << 0) /* Space before a sentence. */
diff --git a/usr.bin/mandoc/term_ascii.c b/usr.bin/mandoc/term_ascii.c
index 6700c2ec3f3..7162db9a894 100644
--- a/usr.bin/mandoc/term_ascii.c
+++ b/usr.bin/mandoc/term_ascii.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: term_ascii.c,v 1.40 2017/05/07 17:30:58 schwarze Exp $ */
+/* $OpenBSD: term_ascii.c,v 1.41 2017/05/08 15:33:43 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -203,6 +203,8 @@ ascii_endline(struct termp *p)
{
p->line++;
+ p->offset -= p->ti;
+ p->ti = 0;
putchar('\n');
}
@@ -356,6 +358,8 @@ locale_endline(struct termp *p)
{
p->line++;
+ p->offset -= p->ti;
+ p->ti = 0;
putwchar(L'\n');
}
diff --git a/usr.bin/mandoc/term_ps.c b/usr.bin/mandoc/term_ps.c
index 9a12dc50bd3..ca19ff5cde8 100644
--- a/usr.bin/mandoc/term_ps.c
+++ b/usr.bin/mandoc/term_ps.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: term_ps.c,v 1.47 2017/02/09 17:19:07 schwarze Exp $ */
+/* $OpenBSD: term_ps.c,v 1.48 2017/05/08 15:33:43 schwarze Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -1215,6 +1215,9 @@ ps_endline(struct termp *p)
}
ps_closepage(p);
+
+ p->offset -= p->ti;
+ p->ti = 0;
}
static void