From d78af72a5fc16f78890e7b519b7b1b5da7aabd39 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Tue, 25 Jan 2011 15:17:18 +0000 Subject: Have `Bx' accept two arguments, not just one, and join these arguments with "xxBSD-yy" --- TODO | 8 +------- mdoc_html.c | 22 +++++++++++++++------- mdoc_macro.c | 4 +++- mdoc_term.c | 28 +++++++++++++++++++++------- 4 files changed, 40 insertions(+), 22 deletions(-) diff --git a/TODO b/TODO index 3b1425fb..3f47d148 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,6 @@ ************************************************************************ * Official mandoc TODO. -* $Id: TODO,v 1.84 2011/01/25 10:37:49 kristaps Exp $ +* $Id: TODO,v 1.85 2011/01/25 15:17:18 kristaps Exp $ ************************************************************************ ************************************************************************ @@ -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 15d87f7e..c36ea0bb 100644 --- a/mdoc_html.c +++ b/mdoc_html.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_html.c,v 1.144 2011/01/13 14:30:13 kristaps Exp $ */ +/* $Id: mdoc_html.c,v 1.145 2011/01/25 15:17:18 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * @@ -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 d41d6fd4..925f4a19 100644 --- a/mdoc_macro.c +++ b/mdoc_macro.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_macro.c,v 1.100 2011/01/12 17:00:07 kristaps Exp $ */ +/* $Id: mdoc_macro.c,v 1.101 2011/01/25 15:17:18 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -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 91954258..169b2b4b 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.210 2011/01/25 10:37:49 kristaps Exp $ */ +/* $Id: mdoc_term.c,v 1.211 2011/01/25 15:17:18 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -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); } -- cgit v1.2.3-56-ge451