]> git.cameronkatri.com Git - mandoc.git/blobdiff - mdoc_macro.c
discard .Rs head arguments and improve .Rs diagnostics
[mandoc.git] / mdoc_macro.c
index 5ffb6a2a841070d7e93250820c3fa2124d07c005..7cf30c42cec9b5f420459e42f75d2a122287a983 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: mdoc_macro.c,v 1.172 2015/02/03 18:22:05 schwarze Exp $ */
+/*     $Id: mdoc_macro.c,v 1.173 2015/02/04 18:03:47 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1027,8 +1027,6 @@ blk_full(MACRO_PROT_ARGS)
                la = *pos;
                lac = ac;
                ac = mdoc_args(mdoc, line, pos, buf, tok, &p);
-               if (ac == ARGS_PUNCT)
-                       break;
                if (ac == ARGS_EOLN) {
                        if (lac != ARGS_PPHRASE && lac != ARGS_PHRASE)
                                break;
@@ -1044,6 +1042,13 @@ blk_full(MACRO_PROT_ARGS)
                        body = mdoc_body_alloc(mdoc, line, ppos, tok);
                        break;
                }
+               if (tok == MDOC_Rs) {
+                       mandoc_vmsg(MANDOCERR_ARG_SKIP, mdoc->parse,
+                           line, la, "Rs %s", buf + la);
+                       break;
+               }
+               if (ac == ARGS_PUNCT)
+                       break;
 
                /*
                 * Emit leading punctuation (i.e., punctuation before
@@ -1100,7 +1105,7 @@ blk_full(MACRO_PROT_ARGS)
                return;
        if (head == NULL)
                head = mdoc_head_alloc(mdoc, line, ppos, tok);
-       if (nl)
+       if (nl && tok != MDOC_Rs)
                append_delims(mdoc, line, pos, buf);
        if (body != NULL)
                goto out;