From c9e80a007b446796d182d2e716659df296725f5a Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sat, 25 Dec 2010 23:25:53 +0000 Subject: Implement schwarze@'s much more elegant version of my %T/%J fix. --- mdoc.h | 4 ++-- mdoc_term.c | 8 ++++---- mdoc_validate.c | 21 ++++----------------- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/mdoc.h b/mdoc.h index 36e40d19..63dd9ac5 100644 --- a/mdoc.h +++ b/mdoc.h @@ -1,4 +1,4 @@ -/* $Id: mdoc.h,v 1.111 2010/12/25 13:50:37 kristaps Exp $ */ +/* $Id: mdoc.h,v 1.112 2010/12/25 23:25:53 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * @@ -354,7 +354,7 @@ struct mdoc_an { }; struct mdoc_rs { - int titlejournal; /* whether %T and %J */ + struct mdoc_node *child_J; /* pointer to %J */ }; /* diff --git a/mdoc_term.c b/mdoc_term.c index 55d7ef4b..f6a9a0fc 100644 --- a/mdoc_term.c +++ b/mdoc_term.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_term.c,v 1.203 2010/12/25 13:50:37 kristaps Exp $ */ +/* $Id: mdoc_term.c,v 1.204 2010/12/25 23:25:53 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -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); diff --git a/mdoc_validate.c b/mdoc_validate.c index b359df7e..aa167454 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.148 2010/12/25 13:50:37 kristaps Exp $ */ +/* $Id: mdoc_validate.c,v 1.149 2010/12/25 23:25:53 kristaps Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * @@ -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; } -- cgit v1.2.3-56-ge451