source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Have `Bx' accept two arguments, not just one, and join these
@ 2011-01-25 15:17 kristaps
  2011-01-25 15:28 ` Kristaps Dzonsons
  0 siblings, 1 reply; 2+ messages in thread
From: kristaps @ 2011-01-25 15:17 UTC (permalink / raw)
  To: source

Log Message:
-----------
Have `Bx' accept two arguments, not just one, and join these arguments
with "xxBSD-yy"

Modified Files:
--------------
    mdocml:
        TODO
        mdoc_html.c
        mdoc_macro.c
        mdoc_term.c

Revision Data
-------------
Index: TODO
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/TODO,v
retrieving revision 1.84
retrieving revision 1.85
diff -LTODO -LTODO -u -p -r1.84 -r1.85
--- TODO
+++ 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).
Index: mdoc_macro.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_macro.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -Lmdoc_macro.c -Lmdoc_macro.c -u -p -r1.100 -r1.101
--- mdoc_macro.c
+++ 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;
Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.144
retrieving revision 1.145
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.144 -r1.145
--- mdoc_html.c
+++ 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);
 }
 
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.210
retrieving revision 1.211
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.210 -r1.211
--- mdoc_term.c
+++ 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[MDO
 	{ 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");
+		term_word(p, "BSD");
+	} else {
+		term_word(p, "BSD");
+		return(0);
+	}
+
+	if (NULL != (n = n->next)) {
+		p->flags |= TERMP_NOSPACE;
+		term_word(p, "-");
+		p->flags |= TERMP_NOSPACE;
+		term_word(p, n->string);
+	}
+
+	return(0);
 }
 
 
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mdocml: Have `Bx' accept two arguments, not just one, and join these
  2011-01-25 15:17 mdocml: Have `Bx' accept two arguments, not just one, and join these kristaps
@ 2011-01-25 15:28 ` Kristaps Dzonsons
  0 siblings, 0 replies; 2+ messages in thread
From: Kristaps Dzonsons @ 2011-01-25 15:28 UTC (permalink / raw)
  To: source

> Log Message:
> -----------
> Have `Bx' accept two arguments, not just one, and join these arguments
> with "xxBSD-yy"

Ok, sent that off too soon... anyway, as said, join both arguments (if 
two are supplied) with "-".  To do this, I expect the mdoc_macro.c 
handler for `Bx' to accept two arguments and simply spliced them in the 
front-ends.  This removes a TODO by schwarze@ along with the next 
check-in...
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-25 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25 15:17 mdocml: Have `Bx' accept two arguments, not just one, and join these kristaps
2011-01-25 15:28 ` Kristaps Dzonsons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).