summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-07-22 23:03:15 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-07-22 23:03:15 +0000
commit4dde5d7bbdceeec0032e163e7a8e8cac3233d659 (patch)
treec504c0e1f43a060e8f30fc4b2dcfcd6c62afc083
parent2764eb0999f7c7e2835d85c1b9b44e5fa1f6f6c2 (diff)
downloadmandoc-4dde5d7bbdceeec0032e163e7a8e8cac3233d659.tar.gz
mandoc-4dde5d7bbdceeec0032e163e7a8e8cac3233d659.tar.zst
mandoc-4dde5d7bbdceeec0032e163e7a8e8cac3233d659.zip
Added `in' macro support for -man -Tascii. This is not yet supported in
-Thtml (I'm surprised to note that neither is LITERAL mode).
-rw-r--r--man.715
-rw-r--r--man.c3
-rw-r--r--man.h3
-rw-r--r--man_action.c3
-rw-r--r--man_html.c3
-rw-r--r--man_macro.c3
-rw-r--r--man_term.c45
-rw-r--r--man_validate.c11
-rw-r--r--out.c3
9 files changed, 75 insertions, 14 deletions
diff --git a/man.7 b/man.7
index a0ec6207..9c9cad79 100644
--- a/man.7
+++ b/man.7
@@ -1,4 +1,4 @@
-.\" $Id: man.7,v 1.78 2010/07/19 23:21:39 schwarze Exp $
+.\" $Id: man.7,v 1.79 2010/07/22 23:03:15 kristaps Exp $
.\"
.\" Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: July 19 2010 $
+.Dd $Mdocdate: July 22 2010 $
.Dt MAN 7
.Os
.Sh NAME
@@ -427,6 +427,7 @@ The syntax is as follows:
.It Sx \&br Ta 0 Ta current Ta compat
.It Sx \&fi Ta 0 Ta current Ta compat
.It Sx \&i Ta n Ta current Ta compat
+.It Sx \&in Ta 1 Ta current Ta compat
.It Sx \&na Ta 0 Ta current Ta compat
.It Sx \&nf Ta 0 Ta current Ta compat
.It Sx \&r Ta 0 Ta current Ta compat
@@ -853,6 +854,16 @@ See also
.Sx \&b ,
and
.Sx \&r .
+.Ss \&in
+Indent relative to the current indentation:
+.Pp
+.D1 Pf \. Sx \&in Op Cm width
+.Pp
+If
+.Cm width
+is signed, the new offset is relative.
+Otherwise, it is absolute.
+This value is reset upon the next paragraph, section, or sub-section.
.Ss \&na
Don't align to the right margin.
.Ss \&nf
diff --git a/man.c b/man.c
index 9439d755..b35d7e07 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.83 2010/07/18 17:00:26 schwarze Exp $ */
+/* $Id: man.c,v 1.84 2010/07/22 23:03:15 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -41,6 +41,7 @@ const char *const __man_macronames[MAN_MAX] = {
"nf", "fi", "r", "RE",
"RS", "DT", "UC", "PD",
"Sp", "Vb", "Ve", "AT",
+ "in"
};
const char * const *man_macronames = __man_macronames;
diff --git a/man.h b/man.h
index dfe6c5a7..2f03f450 100644
--- a/man.h
+++ b/man.h
@@ -1,4 +1,4 @@
-/* $Id: man.h,v 1.40 2010/06/27 16:18:13 kristaps Exp $ */
+/* $Id: man.h,v 1.41 2010/07/22 23:03:15 kristaps Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -56,6 +56,7 @@ enum mant {
MAN_Vb,
MAN_Ve,
MAN_AT,
+ MAN_in,
MAN_MAX
};
diff --git a/man_action.c b/man_action.c
index e63d342b..c82f50fa 100644
--- a/man_action.c
+++ b/man_action.c
@@ -1,4 +1,4 @@
-/* $Id: man_action.c,v 1.39 2010/05/26 14:03:54 kristaps Exp $ */
+/* $Id: man_action.c,v 1.40 2010/07/22 23:03:15 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -73,6 +73,7 @@ const struct actions man_actions[MAN_MAX] = {
{ post_nf }, /* Vb */
{ post_fi }, /* Ve */
{ post_AT }, /* AT */
+ { NULL }, /* in */
};
diff --git a/man_html.c b/man_html.c
index 0433a8d6..ea36c77d 100644
--- a/man_html.c
+++ b/man_html.c
@@ -1,4 +1,4 @@
-/* $Id: man_html.c,v 1.42 2010/07/13 23:53:20 schwarze Exp $ */
+/* $Id: man_html.c,v 1.43 2010/07/22 23:03:15 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -108,6 +108,7 @@ static const struct htmlman mans[MAN_MAX] = {
{ man_ign_pre, NULL }, /* Vb */
{ NULL, NULL }, /* Ve */
{ man_ign_pre, NULL }, /* AT */
+ { man-in_pre, NULL }, /* in */
};
diff --git a/man_macro.c b/man_macro.c
index bf36e799..531a8f58 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -1,4 +1,4 @@
-/* $Id: man_macro.c,v 1.48 2010/06/26 16:07:08 kristaps Exp $ */
+/* $Id: man_macro.c,v 1.49 2010/07/22 23:03:15 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -83,6 +83,7 @@ const struct man_macro __man_macros[MAN_MAX] = {
{ in_line_eoln, 0 }, /* Vb */
{ in_line_eoln, 0 }, /* Ve */
{ in_line_eoln, 0 }, /* AT */
+ { in_line_eoln, 0 }, /* in */
};
const struct man_macro * const man_macros = __man_macros;
diff --git a/man_term.c b/man_term.c
index 9b7cb7ea..685e53a6 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.82 2010/07/22 13:47:50 kristaps Exp $ */
+/* $Id: man_term.c,v 1.83 2010/07/22 23:03:15 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -94,6 +94,7 @@ static int pre_SS(DECL_ARGS);
static int pre_TP(DECL_ARGS);
static int pre_fi(DECL_ARGS);
static int pre_ign(DECL_ARGS);
+static int pre_in(DECL_ARGS);
static int pre_nf(DECL_ARGS);
static int pre_sp(DECL_ARGS);
@@ -141,6 +142,7 @@ static const struct termact termacts[MAN_MAX] = {
{ pre_nf, NULL, 0 }, /* Vb */
{ pre_fi, NULL, 0 }, /* Ve */
{ pre_ign, NULL, 0 }, /* AT */
+ { pre_in, NULL, MAN_NOTEXT }, /* in */
};
@@ -354,6 +356,47 @@ pre_B(DECL_ARGS)
/* ARGSUSED */
static int
+pre_in(DECL_ARGS)
+{
+ int len, less;
+ size_t v;
+ const char *cp;
+
+ term_newln(p);
+
+ if (NULL == n->child) {
+ p->offset = mt->offset;
+ return(0);
+ }
+
+ cp = n->child->string;
+ less = 0;
+
+ if ('-' == *cp)
+ less = -1;
+ else if ('+' == *cp)
+ less = 1;
+ else
+ cp--;
+
+ if ((len = a2width(p, ++cp)) < 0)
+ return(0);
+
+ v = (size_t)len;
+
+ if (less < 0)
+ p->offset -= p->offset > v ? v : p->offset;
+ else if (less > 0)
+ p->offset += v;
+ else
+ p->offset = v;
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
pre_sp(DECL_ARGS)
{
size_t i, len;
diff --git a/man_validate.c b/man_validate.c
index 16561b2b..0e0010dd 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -1,4 +1,4 @@
-/* $Id: man_validate.c,v 1.46 2010/07/20 14:56:42 kristaps Exp $ */
+/* $Id: man_validate.c,v 1.47 2010/07/22 23:03:15 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -83,9 +83,9 @@ static const struct man_valid man_valids[MAN_MAX] = {
{ NULL, NULL }, /* I */
{ NULL, NULL }, /* IR */
{ NULL, NULL }, /* RI */
- { NULL, posts_eq0 }, /* na */
+ { NULL, posts_eq0 }, /* na */ /* FIXME: should warn only. */
{ NULL, NULL }, /* i */
- { NULL, posts_le1 }, /* sp */
+ { NULL, posts_le1 }, /* sp */ /* FIXME: should warn only. */
{ pres_bline, posts_eq0 }, /* nf */
{ pres_bline, posts_eq0 }, /* fi */
{ NULL, NULL }, /* r */
@@ -94,10 +94,11 @@ static const struct man_valid man_valids[MAN_MAX] = {
{ NULL, NULL }, /* DT */
{ NULL, NULL }, /* UC */
{ NULL, NULL }, /* PD */
- { NULL, posts_le1 }, /* Sp */
- { pres_bline, posts_le1 }, /* Vb */
+ { NULL, posts_le1 }, /* Sp */ /* FIXME: should warn only. */
+ { pres_bline, posts_le1 }, /* Vb */ /* FIXME: should warn only. */
{ pres_bline, posts_eq0 }, /* Ve */
{ NULL, NULL }, /* AT */
+ { NULL, NULL }, /* in */
};
diff --git a/out.c b/out.c
index d501aecc..93f70add 100644
--- a/out.c
+++ b/out.c
@@ -1,4 +1,4 @@
-/* $Id: out.c,v 1.22 2010/07/22 14:03:50 kristaps Exp $ */
+/* $Id: out.c,v 1.23 2010/07/22 23:03:15 kristaps Exp $ */
/*
* Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -116,6 +116,7 @@ a2roffsu(const char *src, struct roffsu *dst, enum roffscale def)
return(0);
}
+ /* FIXME: do this in the caller. */
if ((dst->scale = atof(buf)) < 0)
dst->scale = 0;
dst->unit = unit;