* mdocml: Multiple fixes with respect to .Pf: * The first argument of .Pf
@ 2014-11-30 5:29 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-11-30 5:29 UTC (permalink / raw)
To: source
Log Message:
-----------
Multiple fixes with respect to .Pf:
* The first argument of .Pf is not parsed.
* Normal delimiter handling does not apply to the first argument of .Pf.
* Warn if nothing follows a prefix (inspired by groff_mdoc(7)).
* In that case, do not suppress spacing.
Modified Files:
--------------
mdocml:
mandoc.1
mandoc.h
mdoc_html.c
mdoc_macro.c
mdoc_man.c
mdoc_term.c
mdoc_validate.c
read.c
Revision Data
-------------
Index: mandoc.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.h,v
retrieving revision 1.172
retrieving revision 1.173
diff -Lmandoc.h -Lmandoc.h -u -p -r1.172 -r1.173
--- mandoc.h
+++ mandoc.h
@@ -103,6 +103,7 @@ enum mandocerr {
MANDOCERR_IT_NOBODY, /* empty list item: Bl -type It */
MANDOCERR_BF_NOFONT, /* missing font type, using \fR: Bf */
MANDOCERR_BF_BADFONT, /* unknown font type, using \fR: Bf font */
+ MANDOCERR_PF_SKIP, /* nothing follows prefix: Pf arg */
MANDOCERR_ARG_STD, /* missing -std argument, adding it: macro */
MANDOCERR_EQN_NOBOX, /* missing eqn box, using "": op */
Index: mdoc_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_term.c,v
retrieving revision 1.297
retrieving revision 1.298
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.297 -r1.298
--- mdoc_term.c
+++ mdoc_term.c
@@ -1734,7 +1734,8 @@ static void
termp_pf_post(DECL_ARGS)
{
- p->flags |= TERMP_NOSPACE;
+ if ( ! (n->next == NULL || n->next->flags & MDOC_LINE))
+ p->flags |= TERMP_NOSPACE;
}
static int
Index: mdoc_macro.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_macro.c,v
retrieving revision 1.155
retrieving revision 1.156
diff -Lmdoc_macro.c -Lmdoc_macro.c -u -p -r1.155 -r1.156
--- mdoc_macro.c
+++ mdoc_macro.c
@@ -1396,7 +1396,7 @@ in_line_argn(MACRO_PROT_ARGS)
char *p;
enum mdoct ntok;
- nl = MDOC_NEWLINE & mdoc->flags;
+ nl = mdoc->flags & MDOC_NEWLINE;
/*
* A line macro that has a fixed number of arguments (maxargs).
@@ -1428,11 +1428,18 @@ in_line_argn(MACRO_PROT_ARGS)
mdoc_argv(mdoc, line, tok, &arg, pos, buf);
- for (flushed = j = 0; ; ) {
+ p = NULL;
+ flushed = j = 0;
+ for (;;) {
la = *pos;
ac = mdoc_args(mdoc, line, pos, buf, tok, &p);
- if (ac == ARGS_PUNCT || ac == ARGS_EOLN)
+ if (ac == ARGS_PUNCT || ac == ARGS_EOLN) {
+ if (j < 2 && tok == MDOC_Pf)
+ mandoc_vmsg(MANDOCERR_PF_SKIP,
+ mdoc->parse, line, ppos, "Pf %s",
+ p == NULL ? "at eol" : p);
break;
+ }
if ( ! (mdoc_macros[tok].flags & MDOC_IGNDELIM) &&
ac != ARGS_QWORD && j == 0 &&
@@ -1447,8 +1454,8 @@ in_line_argn(MACRO_PROT_ARGS)
flushed = 1;
}
- ntok = ac == ARGS_QWORD ? MDOC_MAX :
- lookup(mdoc, tok, line, la, p);
+ ntok = (ac == ARGS_QWORD || (tok == MDOC_Pf && j == 0)) ?
+ MDOC_MAX : lookup(mdoc, tok, line, la, p);
if (ntok != MDOC_MAX) {
if ( ! flushed)
@@ -1471,8 +1478,11 @@ in_line_argn(MACRO_PROT_ARGS)
j++;
}
- if (j == 0)
+ if (j == 0) {
mdoc_elem_alloc(mdoc, line, ppos, tok, arg);
+ if (ac == ARGS_PUNCT && tok == MDOC_Pf)
+ append_delims(mdoc, line, pos, buf);
+ }
if ( ! flushed)
rew_elem(mdoc, tok);
if (nl)
Index: mdoc_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v
retrieving revision 1.262
retrieving revision 1.263
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.262 -r1.263
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -210,7 +210,7 @@ static const struct valids mdoc_valids[M
{ NULL, NULL }, /* Nx */
{ NULL, NULL }, /* Ox */
{ NULL, NULL }, /* Pc */
- { NULL, ewarn_eq1 }, /* Pf */
+ { NULL, NULL }, /* Pf */
{ NULL, NULL }, /* Po */
{ NULL, NULL }, /* Pq */
{ NULL, NULL }, /* Qc */
Index: mandoc.1
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.1,v
retrieving revision 1.126
retrieving revision 1.127
diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.126 -r1.127
--- mandoc.1
+++ mandoc.1
@@ -1054,6 +1054,14 @@ argument is invalid.
The default font
.Cm \efR
is used instead.
+.It Sy "nothing follows prefix"
+.Pq mdoc
+A
+.Ic \&Pf
+macro has no argument, or only one argument and no macro follows
+on the same input line.
+This defeats its purpose; in particular, spacing is not suppressed
+before the text or macros following on the next input line.
.It Sy "missing -std argument, adding it"
.Pq mdoc
An
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_html.c,v
retrieving revision 1.213
retrieving revision 1.214
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.213 -r1.214
--- mdoc_html.c
+++ mdoc_html.c
@@ -1869,7 +1869,8 @@ static void
mdoc_pf_post(MDOC_ARGS)
{
- h->flags |= HTML_NOSPACE;
+ if ( ! (n->next == NULL || n->next->flags & MDOC_LINE))
+ h->flags |= HTML_NOSPACE;
}
static int
Index: read.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/read.c,v
retrieving revision 1.102
retrieving revision 1.103
diff -Lread.c -Lread.c -u -p -r1.102 -r1.103
--- read.c
+++ read.c
@@ -146,6 +146,7 @@ static const char * const mandocerrs[MAN
"empty list item",
"missing font type, using \\fR",
"unknown font type, using \\fR",
+ "nothing follows prefix",
"missing -std argument, adding it",
"missing eqn box, using \"\"",
Index: mdoc_man.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_man.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -Lmdoc_man.c -Lmdoc_man.c -u -p -r1.76 -r1.77
--- mdoc_man.c
+++ mdoc_man.c
@@ -1602,7 +1602,8 @@ static void
post_pf(DECL_ARGS)
{
- outflags &= ~MMAN_spc;
+ if ( ! (n->next == NULL || n->next->flags & MDOC_LINE))
+ outflags &= ~MMAN_spc;
}
static int
--
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:[~2014-11-30 5:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-30 5:29 mdocml: Multiple fixes with respect to .Pf: * The first argument of .Pf 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).