source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: better handle .In .Sh .Ss .St .Xr without arguments
@ 2015-02-06  1:07 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2015-02-06  1:07 UTC (permalink / raw)
  To: source

Log Message:
-----------
better handle .In .Sh .Ss .St .Xr without arguments

Modified Files:
--------------
    mdocml:
        mdoc_macro.c
        mdoc_validate.c

Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v
retrieving revision 1.271
retrieving revision 1.272
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.271 -r1.272
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -156,7 +156,7 @@ static	const struct valids mdoc_valids[M
 	{ NULL, post_fn },			/* Fn */
 	{ NULL, NULL },				/* Ft */
 	{ NULL, NULL },				/* Ic */
-	{ NULL, ewarn_eq1 },			/* In */
+	{ NULL, NULL },				/* In */
 	{ NULL, post_defaults },		/* Li */
 	{ NULL, post_nd },			/* Nd */
 	{ NULL, post_nm },			/* Nm */
@@ -167,7 +167,7 @@ static	const struct valids mdoc_valids[M
 	{ NULL, post_st },			/* St */
 	{ NULL, NULL },				/* Va */
 	{ NULL, post_vt },			/* Vt */
-	{ NULL, ewarn_ge1 },			/* Xr */
+	{ NULL, NULL },				/* Xr */
 	{ NULL, ewarn_ge1 },			/* %A */
 	{ NULL, post_hyphtext },		/* %B */ /* FIXME: can be used outside Rs/Re. */
 	{ NULL, ewarn_ge1 },			/* %D */
@@ -1640,13 +1640,6 @@ post_st(POST_ARGS)
 	n = mdoc->last;
 	nch = n->child;
 
-	if (NULL == nch) {
-		mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
-		    n->line, n->pos, mdoc_macronames[n->tok]);
-		mdoc_node_delete(mdoc, n);
-		return;
-	}
-
 	assert(MDOC_TEXT == nch->type);
 
 	if (NULL == (p = mdoc_a2st(nch->string))) {
@@ -2076,7 +2069,6 @@ post_ignpar(POST_ARGS)
 {
 	struct mdoc_node *np;
 
-	check_count(mdoc, MDOC_HEAD, CHECK_GT, 0);
 	post_hyph(mdoc);
 
 	if (MDOC_BODY != mdoc->last->type)
Index: mdoc_macro.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_macro.c,v
retrieving revision 1.176
retrieving revision 1.177
diff -Lmdoc_macro.c -Lmdoc_macro.c -u -p -r1.176 -r1.177
--- mdoc_macro.c
+++ mdoc_macro.c
@@ -904,6 +904,12 @@ blk_full(MACRO_PROT_ARGS)
 
 	nl = MDOC_NEWLINE & mdoc->flags;
 
+	if (buf[*pos] == '\0' && (tok == MDOC_Sh || tok == MDOC_Ss)) {
+		mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
+		    line, ppos, mdoc_macronames[tok]);
+		return;
+	}
+
 	if ( ! (mdoc_macros[tok].flags & MDOC_EXPLICIT)) {
 
 		/* Here, tok is one of Sh Ss Nm Nd It. */
@@ -1367,6 +1373,11 @@ in_line_argn(MACRO_PROT_ARGS)
 	}
 
 	if (j == 0) {
+		if (tok == MDOC_In || tok == MDOC_St || tok == MDOC_Xr) {
+			mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
+			    line, ppos, mdoc_macronames[tok]);
+			return;
+		}
 		mdoc_elem_alloc(mdoc, line, ppos, tok, arg);
 		if (ac == ARGS_PUNCT && tok == MDOC_Pf)
 			append_delims(mdoc, line, pos, buf);
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-06  1:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-06  1:07 mdocml: better handle .In .Sh .Ss .St .Xr without arguments schwarze

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).