source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Implement schwarze@'s much more elegant version of my %T/%J fix.
Date: Sat, 25 Dec 2010 18:25:54 -0500 (EST)	[thread overview]
Message-ID: <201012252325.oBPNPsDm031131@krisdoz.my.domain> (raw)

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

                 reply	other threads:[~2010-12-25 23:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201012252325.oBPNPsDm031131@krisdoz.my.domain \
    --to=kristaps@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).