aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-03-30 08:24:01 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-03-30 08:24:01 +0000
commitecbb5760bd20a2d44bbb8cbffd7e53295b9bdca6 (patch)
treea6ed3bd27d85448f0eb98ffb6bd5606c20c69390
parent565acdb6487ad1d1aa0fd3ed5b5c13830792a150 (diff)
downloadmandoc-ecbb5760bd20a2d44bbb8cbffd7e53295b9bdca6.tar.gz
mandoc-ecbb5760bd20a2d44bbb8cbffd7e53295b9bdca6.tar.zst
mandoc-ecbb5760bd20a2d44bbb8cbffd7e53295b9bdca6.zip
Modified in_line_eoln() to handle leading punctuation.VERSION_1_9_20
-rw-r--r--Makefile4
-rw-r--r--index.sgml12
-rw-r--r--mdoc_macro.c56
3 files changed, 42 insertions, 30 deletions
diff --git a/Makefile b/Makefile
index 432c4f41..c1ce8c1c 100644
--- a/Makefile
+++ b/Makefile
@@ -10,8 +10,8 @@ INSTALL_DATA = install -m 0444
INSTALL_LIB = install -m 0644
INSTALL_MAN = $(INSTALL_DATA)
-VERSION = 1.9.18
-VDATE = 27 March 2010
+VERSION = 1.9.20
+VDATE = 30 March 2010
VFLAGS = -DVERSION="\"$(VERSION)\"" -DHAVE_CONFIG_H
WFLAGS = -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings
diff --git a/index.sgml b/index.sgml
index 280f401d..ad990a79 100644
--- a/index.sgml
+++ b/index.sgml
@@ -219,13 +219,13 @@
<COL CLASS="date">
<TBODY>
<TR>
- <TD VALIGN="top"><SPAN CLASS="date">29-03-2010</SPAN></TD>
+ <TD VALIGN="top"><SPAN CLASS="date">30-03-2010</SPAN></TD>
<TD VALIGN="top">
Version <SPAN CLASS="rev">1.9.20</SPAN>: more efforts to get roff instructions
- in -man documents under control. This seems to be working for all manuals I can
- find. Please let me know if you find ill-formatted -man manuals. Note that
- roff instructions embedded in line-scoped, next-line macros (e.g. <Q>B</Q>) are
- not supported.
+ in -man documents under control. Note that roff instructions embedded in
+ line-scoped, next-line macros (e.g. <Q>B</Q>) are not supported. Leading
+ punctuation for -mdoc macros, such as <Q>Fl ( ( a</Q>, are now correctly
+ handled.
</TD>
</TR>
<TR>
@@ -275,7 +275,7 @@
<TR>
<TD>
<DIV CLASS="foot">
- Copyright &#169; 2008&#8211;2010 Kristaps Dzonsons, $Date: 2010/03/29 10:10:35 $
+ Copyright &#169; 2008&#8211;2010 Kristaps Dzonsons, $Date: 2010/03/30 08:24:01 $
</DIV>
</TD>
</TR>
diff --git a/mdoc_macro.c b/mdoc_macro.c
index bf960d47..22da4d35 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.45 2010/03/30 06:52:08 kristaps Exp $ */
+/* $Id: mdoc_macro.c,v 1.46 2010/03/30 08:24:01 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -1209,7 +1209,13 @@ in_line_argn(MACRO_PROT_ARGS)
struct mdoc_arg *arg;
char *p;
- /* Fixed maximum arguments per macro, if applicable. */
+ /*
+ * A line macro that has a fixed number of arguments (maxargs).
+ * Only open the scope once the first non-leading-punctuation is
+ * found (unless MDOC_IGNDELIM is noted, like in `Pf'), then
+ * keep it open until the maximum number of arguments are
+ * exhausted.
+ */
switch (tok) {
case (MDOC_Ap):
@@ -1229,9 +1235,7 @@ in_line_argn(MACRO_PROT_ARGS)
break;
}
- /* Macro argument processing. */
-
- for (arg = NULL;; ) {
+ for (arg = NULL; ; ) {
la = *pos;
c = mdoc_argv(m, line, tok, &arg, pos, buf);
@@ -1249,22 +1253,8 @@ in_line_argn(MACRO_PROT_ARGS)
return(0);
}
- /* Open the element scope. */
-
- if ( ! mdoc_elem_alloc(m, line, ppos, tok, arg))
- return(0);
-
- /* Process element arguments. */
-
- for (flushed = j = 0; ; j++) {
+ for (flushed = j = 0; ; ) {
la = *pos;
-
- if (j == maxargs && ! flushed) {
- if ( ! rew_elem(m, tok))
- return(0);
- flushed = 1;
- }
-
c = mdoc_args(m, line, pos, buf, tok, &p);
if (ARGS_ERROR == c)
@@ -1274,12 +1264,28 @@ in_line_argn(MACRO_PROT_ARGS)
if (ARGS_EOLN == c)
break;
+ if ( ! (MDOC_IGNDELIM & mdoc_macros[tok].flags) &&
+ 0 == j && 1 == mdoc_isdelim(p)) {
+ if ( ! mdoc_word_alloc(m, line, la, p))
+ return(0);
+ continue;
+ } else if (0 == j)
+ if ( ! mdoc_elem_alloc(m, line, la, tok, arg))
+ return(0);
+
+ if (j == maxargs && ! flushed) {
+ if ( ! rew_elem(m, tok))
+ return(0);
+ flushed = 1;
+ }
+
if (MDOC_MAX != (c = lookup(tok, p))) {
if ( ! flushed && ! rew_elem(m, tok))
return(0);
flushed = 1;
if ( ! mdoc_macro(m, c, line, la, pos, buf))
return(0);
+ j++;
break;
}
@@ -1297,18 +1303,24 @@ in_line_argn(MACRO_PROT_ARGS)
* code is no here, it's unlikely to be removed.
*/
+#ifdef __OpenBSD__
if (MDOC_Xr == tok && j == maxargs) {
- if ( ! mdoc_elem_alloc(m, line, ppos, MDOC_Ns, NULL))
+ if ( ! mdoc_elem_alloc(m, line, la, MDOC_Ns, NULL))
return(0);
if ( ! rew_elem(m, MDOC_Ns))
return(0);
}
+#endif
if ( ! mdoc_word_alloc(m, line, la, p))
return(0);
+ j++;
}
- /* Close out and append delimiters. */
+ if (0 == j && ! mdoc_elem_alloc(m, line, la, tok, arg))
+ return(0);
+
+ /* Close out in a consistent state. */
if ( ! flushed && ! rew_elem(m, tok))
return(0);