summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-01-25 15:17:18 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-01-25 15:17:18 +0000
commit99f9e0ced799039092a15e576a2ba9f04fff9d0a (patch)
tree6ee3c1b0bef7f50ae8d988e0792388c48da9e5de
parent7af39d09674498b502965c63cb5f54c73013e86b (diff)
downloadmandoc-99f9e0ced799039092a15e576a2ba9f04fff9d0a.tar.gz
Have `Bx' accept two arguments, not just one, and join these arguments
with "xxBSD-yy"
-rw-r--r--TODO6
-rw-r--r--mdoc_html.c20
-rw-r--r--mdoc_macro.c2
-rw-r--r--mdoc_term.c26
4 files changed, 36 insertions, 18 deletions
diff --git a/TODO b/TODO
index 769e2176..c745ae59 100644
--- a/TODO
+++ b/TODO
@@ -228,12 +228,6 @@
- The space character joining .Dx .Fx .Nx .Ox (are these all?) to its
argument is non-breaking. See the cdio(1) HISTORY and many others.
-- .Bx uses a dash before its argument, not a space,
- see for example the chpass(1) and column(1) HISTORY.
- Besides, the second argument is capitalized, for example,
- .Bx 4.3 tahoe .
- produces 4.3BSD-Tahoe.
-
- In .Bl -tag, if a tag exceeds the right margin and must be continued
on the next line, it must be indented by -width, not width+1;
see "rule block|pass" in OpenBSD ifconfig(8).
diff --git a/mdoc_html.c b/mdoc_html.c
index 1697ac32..9d83553d 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -832,19 +832,27 @@ mdoc_xx_pre(MDOC_ARGS)
static int
mdoc_bx_pre(MDOC_ARGS)
{
- const struct mdoc_node *nn;
- struct htmlpair tag;
+ struct htmlpair tag;
PAIR_CLASS_INIT(&tag, "unix");
print_otag(h, TAG_SPAN, 1, &tag);
- for (nn = n->child; nn; nn = nn->next)
- print_mdoc_node(m, nn, h);
+ if (NULL != (n = n->child)) {
+ print_text(h, n->string);
+ h->flags |= HTML_NOSPACE;
+ print_text(h, "BSD");
+ } else {
+ print_text(h, "BSD");
+ return(0);
+ }
- if (n->child)
+ if (NULL != (n = n->next)) {
h->flags |= HTML_NOSPACE;
+ print_text(h, "-");
+ h->flags |= HTML_NOSPACE;
+ print_text(h, n->string);
+ }
- print_text(h, "BSD");
return(0);
}
diff --git a/mdoc_macro.c b/mdoc_macro.c
index 55cdc2e5..ac5b2c24 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1461,6 +1461,8 @@ in_line_argn(MACRO_PROT_ARGS)
case (MDOC_Ux):
maxargs = 0;
break;
+ case (MDOC_Bx):
+ /* FALLTHROUGH */
case (MDOC_Xr):
maxargs = 2;
break;
diff --git a/mdoc_term.c b/mdoc_term.c
index ee369f09..703f2d06 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -73,7 +73,6 @@ static void termp_an_post(DECL_ARGS);
static void termp_bd_post(DECL_ARGS);
static void termp_bk_post(DECL_ARGS);
static void termp_bl_post(DECL_ARGS);
-static void termp_bx_post(DECL_ARGS);
static void termp_d1_post(DECL_ARGS);
static void termp_fo_post(DECL_ARGS);
static void termp_in_post(DECL_ARGS);
@@ -95,6 +94,7 @@ static int termp_bk_pre(DECL_ARGS);
static int termp_bl_pre(DECL_ARGS);
static int termp_bold_pre(DECL_ARGS);
static int termp_bt_pre(DECL_ARGS);
+static int termp_bx_pre(DECL_ARGS);
static int termp_cd_pre(DECL_ARGS);
static int termp_d1_pre(DECL_ARGS);
static int termp_ex_pre(DECL_ARGS);
@@ -187,7 +187,7 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_quote_pre, termp_quote_post }, /* Bo */
{ termp_quote_pre, termp_quote_post }, /* Bq */
{ termp_xx_pre, NULL }, /* Bsx */
- { NULL, termp_bx_post }, /* Bx */
+ { termp_bx_pre, NULL }, /* Bx */
{ NULL, NULL }, /* Db */
{ NULL, NULL }, /* Dc */
{ termp_quote_pre, termp_quote_post }, /* Do */
@@ -1674,13 +1674,27 @@ termp_bd_post(DECL_ARGS)
/* ARGSUSED */
-static void
-termp_bx_post(DECL_ARGS)
+static int
+termp_bx_pre(DECL_ARGS)
{
- if (n->child)
+ if (NULL != (n = n->child)) {
+ term_word(p, n->string);
+ p->flags |= TERMP_NOSPACE;
+ term_word(p, "BSD");
+ } else {
+ term_word(p, "BSD");
+ return(0);
+ }
+
+ if (NULL != (n = n->next)) {
p->flags |= TERMP_NOSPACE;
- term_word(p, "BSD");
+ term_word(p, "-");
+ p->flags |= TERMP_NOSPACE;
+ term_word(p, n->string);
+ }
+
+ return(0);
}