source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Allow `.xx\}' where xx is a macro (e.g., `.br\}') to close
@ 2010-08-29 11:29 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-08-29 11:29 UTC (permalink / raw)
  To: source

Log Message:
-----------
Allow `.xx\}' where xx is a macro (e.g., `.br\}') to close scope.  This is
experimental and hasn't been rigorously tested.  It's only implemented in 
-mdoc for the time being.  This is absolutely required for pod2man.  It
does, however, make the pod2man preamble be processed in full.

Modified Files:
--------------
    mdocml:
        mdoc.c
        roff.c

Revision Data
-------------
Index: mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -Lmdoc.c -Lmdoc.c -u -p -r1.163 -r1.164
--- mdoc.c
+++ mdoc.c
@@ -758,11 +758,14 @@ mdoc_pmacro(struct mdoc *m, int ln, char
 
 	/* 
 	 * Copy the first word into a nil-terminated buffer.
-	 * Stop copying when a tab, space, or eoln is encountered.
+	 * Stop copying when a tab, space, backslash, or eoln is encountered.
 	 */
 
 	j = 0;
-	while (j < 4 && '\0' != buf[i] && ' ' != buf[i] && '\t' != buf[i])
+	while (j < 4 && '\0' != buf[i] && 
+			' ' != buf[i] && 
+			'\t' != buf[i] && 
+			'\\' != buf[i])
 		mac[j++] = buf[i++];
 	mac[j] = '\0';
 
Index: roff.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/roff.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -Lroff.c -Lroff.c -u -p -r1.99 -r1.100
--- roff.c
+++ roff.c
@@ -59,7 +59,7 @@ enum	rofft {
 	ROFF_rm,
 	ROFF_tr,
 	ROFF_cblock,
-	ROFF_ccond,
+	ROFF_ccond, /* FIXME: remove this. */
 	ROFF_nr,
 	ROFF_MAX
 };
@@ -764,8 +764,13 @@ roff_cond_sub(ROFF_ARGS)
 	if (l != r->last)
 		return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT);
 
-	if (ROFF_MAX == (t = roff_parse(*bufp, &pos)))
+	if (ROFF_MAX == (t = roff_parse(*bufp, &pos))) {
+		if ('\\' == (*bufp)[pos] && '}' == (*bufp)[pos + 1])
+			return(roff_ccond
+				(r, ROFF_ccond, bufp, szp, 
+				 ln, pos, pos + 2, offs));
 		return(ROFFRULE_DENY == rr ? ROFF_IGN : ROFF_CONT);
+	}
 
 	/*
 	 * A denied conditional must evaluate its children if and only
@@ -796,6 +801,8 @@ roff_cond_text(ROFF_ARGS)
 	 * We display the value of the text if out current evaluation
 	 * scope permits us to do so.
 	 */
+
+	/* FIXME: use roff_ccond? */
 
 	st = &(*bufp)[pos];
 	if (NULL == (ep = strstr(st, "\\}"))) {
--
 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:[~2010-08-29 11:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-29 11:29 mdocml: Allow `.xx\}' where xx is a macro (e.g., `.br\}') to close kristaps

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