summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/mandoc')
-rw-r--r--usr.bin/mandoc/man_html.c26
-rw-r--r--usr.bin/mandoc/man_macro.c7
-rw-r--r--usr.bin/mandoc/man_term.c62
-rw-r--r--usr.bin/mandoc/man_validate.c4
-rw-r--r--usr.bin/mandoc/roff.c5
-rw-r--r--usr.bin/mandoc/roff.h6
6 files changed, 102 insertions, 8 deletions
diff --git a/usr.bin/mandoc/man_html.c b/usr.bin/mandoc/man_html.c
index 9f1867071b5..a0ef1f75a51 100644
--- a/usr.bin/mandoc/man_html.c
+++ b/usr.bin/mandoc/man_html.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_html.c,v 1.108 2018/08/17 20:31:52 schwarze Exp $ */
+/* $OpenBSD: man_html.c,v 1.109 2018/08/18 02:03:41 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -59,6 +59,7 @@ static int man_RS_pre(MAN_ARGS);
static int man_SH_pre(MAN_ARGS);
static int man_SM_pre(MAN_ARGS);
static int man_SS_pre(MAN_ARGS);
+static int man_SY_pre(MAN_ARGS);
static int man_UR_pre(MAN_ARGS);
static int man_alt_pre(MAN_ARGS);
static int man_ign_pre(MAN_ARGS);
@@ -99,6 +100,8 @@ static const struct man_html_act man_html_acts[MAN_MAX - MAN_TH] = {
{ man_ign_pre, NULL }, /* PD */
{ man_ign_pre, NULL }, /* AT */
{ man_in_pre, NULL }, /* in */
+ { man_SY_pre, NULL }, /* SY */
+ { NULL, NULL }, /* YS */
{ man_OP_pre, NULL }, /* OP */
{ NULL, NULL }, /* EX */
{ NULL, NULL }, /* EE */
@@ -620,6 +623,27 @@ man_RS_pre(MAN_ARGS)
}
static int
+man_SY_pre(MAN_ARGS)
+{
+ switch (n->type) {
+ case ROFFT_BLOCK:
+ print_otag(h, TAG_TABLE, "c", "Nm");
+ print_otag(h, TAG_TR, "");
+ break;
+ case ROFFT_HEAD:
+ print_otag(h, TAG_TD, "");
+ print_otag(h, TAG_CODE, "cT", "Nm");
+ break;
+ case ROFFT_BODY:
+ print_otag(h, TAG_TD, "");
+ break;
+ default:
+ abort();
+ }
+ return 1;
+}
+
+static int
man_UR_pre(MAN_ARGS)
{
char *cp;
diff --git a/usr.bin/mandoc/man_macro.c b/usr.bin/mandoc/man_macro.c
index 30c26ba4da2..7e760adb45f 100644
--- a/usr.bin/mandoc/man_macro.c
+++ b/usr.bin/mandoc/man_macro.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_macro.c,v 1.89 2018/08/17 20:31:52 schwarze Exp $ */
+/* $OpenBSD: man_macro.c,v 1.90 2018/08/18 02:03:41 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2012-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -69,6 +69,8 @@ static const struct man_macro man_macros[MAN_MAX - MAN_TH] = {
{ in_line_eoln, MAN_NSCOPED }, /* PD */
{ in_line_eoln, 0 }, /* AT */
{ in_line_eoln, MAN_NSCOPED }, /* in */
+ { blk_exp, MAN_BSCOPE }, /* SY */
+ { blk_close, MAN_BSCOPE }, /* YS */
{ in_line_eoln, 0 }, /* OP */
{ in_line_eoln, MAN_BSCOPE }, /* EX */
{ in_line_eoln, MAN_BSCOPE }, /* EE */
@@ -221,6 +223,9 @@ blk_close(MACRO_PROT_ARGS)
return;
}
break;
+ case MAN_YS:
+ ntok = MAN_SY;
+ break;
case MAN_UE:
ntok = MAN_UR;
break;
diff --git a/usr.bin/mandoc/man_term.c b/usr.bin/mandoc/man_term.c
index d4a7708989e..bdcd51af32c 100644
--- a/usr.bin/mandoc/man_term.c
+++ b/usr.bin/mandoc/man_term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_term.c,v 1.167 2018/08/17 20:31:52 schwarze Exp $ */
+/* $OpenBSD: man_term.c,v 1.168 2018/08/18 02:03:41 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -76,6 +76,7 @@ static int pre_PP(DECL_ARGS);
static int pre_RS(DECL_ARGS);
static int pre_SH(DECL_ARGS);
static int pre_SS(DECL_ARGS);
+static int pre_SY(DECL_ARGS);
static int pre_TP(DECL_ARGS);
static int pre_UR(DECL_ARGS);
static int pre_alternate(DECL_ARGS);
@@ -88,6 +89,7 @@ static void post_HP(DECL_ARGS);
static void post_RS(DECL_ARGS);
static void post_SH(DECL_ARGS);
static void post_SS(DECL_ARGS);
+static void post_SY(DECL_ARGS);
static void post_TP(DECL_ARGS);
static void post_UR(DECL_ARGS);
@@ -122,6 +124,8 @@ static const struct man_term_act man_term_acts[MAN_MAX - MAN_TH] = {
{ pre_PD, NULL, MAN_NOTEXT }, /* PD */
{ pre_ign, NULL, 0 }, /* AT */
{ pre_in, NULL, MAN_NOTEXT }, /* in */
+ { pre_SY, post_SY, 0 }, /* SY */
+ { NULL, NULL, 0 }, /* YS */
{ pre_OP, NULL, 0 }, /* OP */
{ pre_literal, NULL, 0 }, /* EX */
{ pre_literal, NULL, 0 }, /* EE */
@@ -847,6 +851,62 @@ post_RS(DECL_ARGS)
}
static int
+pre_SY(DECL_ARGS)
+{
+ const struct roff_node *nn;
+ int len;
+
+ switch (n->type) {
+ case ROFFT_BLOCK:
+ print_bvspace(p, n, mt->pardist);
+ return 1;
+ case ROFFT_HEAD:
+ case ROFFT_BODY:
+ break;
+ default:
+ abort();
+ }
+
+ nn = n->parent->head->child;
+ len = nn == NULL ? 0 : term_strlen(p, nn->string) + 1;
+
+ switch (n->type) {
+ case ROFFT_HEAD:
+ p->tcol->offset = mt->offset;
+ p->tcol->rmargin = mt->offset + len;
+ p->flags |= TERMP_NOBREAK;
+ term_fontrepl(p, TERMFONT_BOLD);
+ break;
+ case ROFFT_BODY:
+ mt->lmargin[mt->lmargincur] = len;
+ p->tcol->offset = mt->offset + len;
+ p->tcol->rmargin = p->maxrmargin;
+ p->flags |= TERMP_NOSPACE;
+ break;
+ default:
+ abort();
+ }
+ return 1;
+}
+
+static void
+post_SY(DECL_ARGS)
+{
+ switch (n->type) {
+ case ROFFT_HEAD:
+ term_flushln(p);
+ p->flags &= ~TERMP_NOBREAK;
+ break;
+ case ROFFT_BODY:
+ term_newln(p);
+ p->tcol->offset = mt->offset;
+ break;
+ default:
+ break;
+ }
+}
+
+static int
pre_UR(DECL_ARGS)
{
diff --git a/usr.bin/mandoc/man_validate.c b/usr.bin/mandoc/man_validate.c
index 01e38bc6f83..c0d1a6f9a65 100644
--- a/usr.bin/mandoc/man_validate.c
+++ b/usr.bin/mandoc/man_validate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: man_validate.c,v 1.107 2018/08/16 23:40:19 schwarze Exp $ */
+/* $OpenBSD: man_validate.c,v 1.108 2018/08/18 02:03:41 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -83,6 +83,8 @@ static const v_check man_valids[MAN_MAX - MAN_TH] = {
NULL, /* PD */
post_AT, /* AT */
post_in, /* in */
+ NULL, /* SY */
+ NULL, /* YS */
post_OP, /* OP */
NULL, /* EX */
NULL, /* EE */
diff --git a/usr.bin/mandoc/roff.c b/usr.bin/mandoc/roff.c
index c2f6f982300..364c6b1cb79 100644
--- a/usr.bin/mandoc/roff.c
+++ b/usr.bin/mandoc/roff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: roff.c,v 1.204 2018/08/16 23:40:19 schwarze Exp $ */
+/* $OpenBSD: roff.c,v 1.205 2018/08/18 02:03:41 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -333,7 +333,8 @@ const char *__roff_name[MAN_MAX + 1] = {
"nf", "fi",
"RE", "RS", "DT", "UC",
"PD", "AT", "in",
- "OP", "EX", "EE", "UR",
+ "SY", "YS", "OP",
+ "EX", "EE", "UR",
"UE", "MT", "ME", NULL
};
const char *const *roff_name = __roff_name;
diff --git a/usr.bin/mandoc/roff.h b/usr.bin/mandoc/roff.h
index 1c5fd059b12..3fa35361f79 100644
--- a/usr.bin/mandoc/roff.h
+++ b/usr.bin/mandoc/roff.h
@@ -1,7 +1,7 @@
-/* $OpenBSD: roff.h,v 1.42 2018/08/16 23:40:19 schwarze Exp $ */
+/* $OpenBSD: roff.h,v 1.43 2018/08/18 02:03:41 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2013,2014,2015,2017,2018 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
@@ -464,6 +464,8 @@ enum roff_tok {
MAN_PD,
MAN_AT,
MAN_in,
+ MAN_SY,
+ MAN_YS,
MAN_OP,
MAN_EX,
MAN_EE,