source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Implement schwarze@'s much more elegant version of my %T/%J fix.
@ 2010-12-25 23:25 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-12-25 23:25 UTC (permalink / raw)
  To: source

Log Message:
-----------
Implement schwarze@'s much more elegant version of my %T/%J fix.

Modified Files:
--------------
    mdocml:
        mdoc.h
        mdoc_term.c
        mdoc_validate.c

Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.148
retrieving revision 1.149
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.148 -r1.149
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -1649,19 +1649,8 @@ post_rs(POST_ARGS)
 {
 	struct mdoc_node *nn, *next, *prev;
 	int		  i, j;
-	int		 *tj;
-#define	RS_JOURNAL	 (1 << 0)
-#define	RS_TITLE	 (1 << 1)
 
-	/* Mark whether we're carrying both a %T and %J. */
-
-	tj = &mdoc->last->norm->Rs.titlejournal;
-
-	if (MDOC_BLOCK == mdoc->last->type) {
-		if ( ! (RS_JOURNAL & *tj && RS_TITLE & *tj))
-			*tj = 0;
-		return(1);
-	} else if (MDOC_BODY != mdoc->last->type)
+	if (MDOC_BODY != mdoc->last->type)
 		return(1);
 
 	/*
@@ -1677,10 +1666,8 @@ post_rs(POST_ARGS)
 				break;
 
 		if (i < RSORD_MAX) {
-			if (MDOC__T == rsord[i])
-				*tj |= RS_TITLE;
-			else if (MDOC__J == rsord[i])
-				*tj |= RS_JOURNAL;
+			if (MDOC__J == rsord[i])
+				mdoc->last->norm->Rs.child_J = nn;
 			next = nn->next;
 			continue;
 		}
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.203
retrieving revision 1.204
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.203 -r1.204
--- mdoc_term.c
+++ mdoc_term.c
@@ -2148,8 +2148,8 @@ termp__t_post(DECL_ARGS)
 	 * If we're in an `Rs' and there's a journal present, then quote
 	 * us instead of underlining us (for disambiguation).
 	 */
-	if (n->parent && MDOC_Rs == n->parent->tok &&
-			n->parent->norm->Rs.titlejournal)
+	if (n->parent && MDOC_Rs == n->parent->tok && 
+			n->parent->norm->Rs.child_J)
 		termp_quote_post(p, pair, m, n);
 
 	termp____post(p, pair, m, n);
@@ -2165,7 +2165,7 @@ termp__t_pre(DECL_ARGS)
 	 * us instead of underlining us (for disambiguation).
 	 */
 	if (n->parent && MDOC_Rs == n->parent->tok &&
-			n->parent->norm->Rs.titlejournal)
+			n->parent->norm->Rs.child_J)
 		return(termp_quote_pre(p, pair, m, n));
 
 	term_fontpush(p, TERMFONT_UNDER);
Index: mdoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.h,v
retrieving revision 1.111
retrieving revision 1.112
diff -Lmdoc.h -Lmdoc.h -u -p -r1.111 -r1.112
--- mdoc.h
+++ mdoc.h
@@ -354,7 +354,7 @@ struct	mdoc_an {
 };
 
 struct	mdoc_rs {
-	int		  titlejournal; /* whether %T and %J */
+	struct mdoc_node *child_J; /* pointer to %J */
 };
 
 /*
--
 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-12-25 23:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-25 23:25 mdocml: Implement schwarze@'s much more elegant version of my %T/%J fix 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).