=================================================================== RCS file: /cvs/mandoc/mdoc_term.c,v retrieving revision 1.236 retrieving revision 1.240 diff -u -p -r1.236 -r1.240 --- mandoc/mdoc_term.c 2011/10/16 12:20:34 1.236 +++ mandoc/mdoc_term.c 2012/07/08 22:49:29 1.240 @@ -1,7 +1,7 @@ -/* $Id: mdoc_term.c,v 1.236 2011/10/16 12:20:34 schwarze Exp $ */ +/* $Id: mdoc_term.c,v 1.240 2012/07/08 22:49:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons - * Copyright (c) 2010 Ingo Schwarze + * Copyright (c) 2010, 2012 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -34,9 +34,6 @@ #include "mdoc.h" #include "main.h" -#define INDENT 5 -#define HALFINDENT 3 - struct termpair { struct termpair *ppair; int count; @@ -194,7 +191,7 @@ static const struct termact termacts[MDOC_MAX] = { { NULL, NULL }, /* Ec */ /* FIXME: no space */ { NULL, NULL }, /* Ef */ { termp_under_pre, NULL }, /* Em */ - { NULL, NULL }, /* Eo */ + { termp_quote_pre, termp_quote_post }, /* Eo */ { termp_xx_pre, NULL }, /* Fx */ { termp_bold_pre, NULL }, /* Ms */ { termp_igndelim_pre, NULL }, /* No */ @@ -259,6 +256,9 @@ terminal_mdoc(void *arg, const struct mdoc *mdoc) p = (struct termp *)arg; + if (0 == p->defindent) + p->defindent = 5; + p->overstep = 0; p->maxrmargin = p->defrmargin; p->tabwidth = term_len(p, 5); @@ -562,9 +562,9 @@ a2offs(const struct termp *p, const char *v) else if (0 == strcmp(v, "left")) return(0); else if (0 == strcmp(v, "indent")) - return(term_len(p, INDENT + 1)); + return(term_len(p, p->defindent + 1)); else if (0 == strcmp(v, "indent-two")) - return(term_len(p, (INDENT + 1) * 2)); + return(term_len(p, (p->defindent + 1) * 2)); else if ( ! a2roffsu(v, &su, SCALE_MAX)) SCALE_HS_INIT(&su, term_strlen(p, v)); @@ -1424,7 +1424,9 @@ termp_sh_pre(DECL_ARGS) term_fontpush(p, TERMFONT_BOLD); break; case (MDOC_BODY): - p->offset = term_len(p, INDENT); + p->offset = term_len(p, p->defindent); + if (SEC_AUTHORS == n->sec) + p->flags &= ~(TERMP_SPLIT|TERMP_NOSPLIT); break; default: break; @@ -1492,7 +1494,7 @@ termp_d1_pre(DECL_ARGS) if (MDOC_BLOCK != n->type) return(1); term_newln(p); - p->offset += term_len(p, (INDENT + 1)); + p->offset += term_len(p, p->defindent + 1); return(1); } @@ -1797,7 +1799,7 @@ termp_ss_pre(DECL_ARGS) break; case (MDOC_HEAD): term_fontpush(p, TERMFONT_BOLD); - p->offset = term_len(p, HALFINDENT); + p->offset = term_len(p, (p->defindent+1)/2); break; default: break; @@ -1925,6 +1927,8 @@ termp_quote_pre(DECL_ARGS) case (MDOC_Dq): term_word(p, "``"); break; + case (MDOC_Eo): + break; case (MDOC_Po): /* FALLTHROUGH */ case (MDOC_Pq): @@ -1989,6 +1993,8 @@ termp_quote_post(DECL_ARGS) case (MDOC_Dq): term_word(p, "''"); break; + case (MDOC_Eo): + break; case (MDOC_Po): /* FALLTHROUGH */ case (MDOC_Pq): @@ -2153,25 +2159,24 @@ termp_li_pre(DECL_ARGS) static int termp_lk_pre(DECL_ARGS) { - const struct mdoc_node *nn, *sv; + const struct mdoc_node *link, *descr; - term_fontpush(p, TERMFONT_UNDER); + if (NULL == (link = n->child)) + return(0); - nn = sv = n->child; + if (NULL != (descr = link->next)) { + term_fontpush(p, TERMFONT_UNDER); + while (NULL != descr) { + term_word(p, descr->string); + descr = descr->next; + } + p->flags |= TERMP_NOSPACE; + term_word(p, ":"); + term_fontpop(p); + } - if (NULL == nn || NULL == nn->next) - return(1); - - for (nn = nn->next; nn; nn = nn->next) - term_word(p, nn->string); - - term_fontpop(p); - - p->flags |= TERMP_NOSPACE; - term_word(p, ":"); - term_fontpush(p, TERMFONT_BOLD); - term_word(p, sv->string); + term_word(p, link->string); term_fontpop(p); return(0);