From df65ac42a497f4acfc4cf57335efee9070d1c8a2 Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sat, 28 Feb 2009 20:13:06 +0000 Subject: More fixes (hard-escapes, etc.). --- macro.c | 4 +++- mdocterm.c | 9 ++++++++- term.c | 44 ++++++++++++++++++++++++++------------------ 3 files changed, 37 insertions(+), 20 deletions(-) diff --git a/macro.c b/macro.c index 673eec30..30518a7e 100644 --- a/macro.c +++ b/macro.c @@ -1,4 +1,4 @@ -/* $Id: macro.c,v 1.54 2009/02/27 09:39:40 kristaps Exp $ */ +/* $Id: macro.c,v 1.55 2009/02/28 20:13:06 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons * @@ -796,6 +796,8 @@ macro_text(MACRO_PROT_ARGS) return(0); } + /* FIXME: .Fl and .Ar handling of `|'. */ + if (ARGS_QWORD != w && mdoc_isdelim(p)) { if (0 == lastpunct && ! rewind_elem(mdoc, tok)) { mdoc_argv_free(argc, argv); diff --git a/mdocterm.c b/mdocterm.c index 398794ca..dd52e287 100644 --- a/mdocterm.c +++ b/mdocterm.c @@ -1,4 +1,4 @@ -/* $Id: mdocterm.c,v 1.19 2009/02/28 14:43:35 kristaps Exp $ */ +/* $Id: mdocterm.c,v 1.20 2009/02/28 20:13:06 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons * @@ -554,7 +554,14 @@ word(struct termp *p, const char *word) if ( ! xisspace(word[i])) { j++; continue; + } + + /* Escaped spaces don't delimit... */ + if (i > 0 && xisspace(word[i]) && '\\' == word[i - 1]) { + j++; + continue; } + if (0 == j) continue; assert(i >= j); diff --git a/term.c b/term.c index 5ad67a8b..66847ea2 100644 --- a/term.c +++ b/term.c @@ -1,4 +1,4 @@ -/* $Id: term.c,v 1.28 2009/02/28 19:15:28 kristaps Exp $ */ +/* $Id: term.c,v 1.29 2009/02/28 20:13:06 kristaps Exp $ */ /* * Copyright (c) 2009 Kristaps Dzonsons * @@ -25,7 +25,7 @@ #include "term.h" -#define INDENT 8 +#define INDENT 6 /* * Performs actions on nodes of the abstract syntax tree. Both pre- and @@ -174,7 +174,7 @@ const struct termact __termacts[MDOC_MAX] = { { termp_ss_pre, termp_ss_post }, /* Ss */ { termp_pp_pre, NULL }, /* Pp */ { termp_d1_pre, termp_d1_post }, /* D1 */ - { NULL, NULL }, /* Dl */ + { termp_d1_pre, termp_d1_post }, /* Dl */ { termp_bd_pre, termp_bd_post }, /* Bd */ { NULL, NULL }, /* Ed */ { NULL, termp_bl_post }, /* Bl */ @@ -208,16 +208,16 @@ const struct termact __termacts[MDOC_MAX] = { { termp_vt_pre, termp_vt_post }, /* Vt */ { termp_xr_pre, NULL }, /* Xr */ { NULL, termp____post }, /* %A */ - { NULL, NULL }, /* %B */ + { NULL, termp____post }, /* %B */ { NULL, termp____post }, /* %D */ - { NULL, NULL }, /* %I */ + { NULL, termp____post }, /* %I */ { NULL, termp____post }, /* %J */ - { NULL, NULL }, /* %N */ - { NULL, NULL }, /* %O */ - { NULL, NULL }, /* %P */ - { NULL, NULL }, /* %R */ + { NULL, termp____post }, /* %N */ + { NULL, termp____post }, /* %O */ + { NULL, termp____post }, /* %P */ + { NULL, termp____post }, /* %R */ { termp__t_pre, termp__t_post }, /* %T */ - { NULL, NULL }, /* %V */ + { NULL, termp____post }, /* %V */ { NULL, NULL }, /* Ac */ { termp_aq_pre, termp_aq_post }, /* Ao */ { termp_aq_pre, termp_aq_post }, /* Aq */ @@ -303,7 +303,7 @@ arg_width(const struct mdoc_arg *arg) } } - return(strlen(*arg->value) + 1); + return(strlen(*arg->value) + 2); } @@ -395,10 +395,10 @@ termp_it_pre(DECL_ARGS) bl = &n->data.block; if (MDOC_BLOCK == node->type) { - if (arg_hasattr(MDOC_Compact, bl->argc, bl->argv)) - newln(p); - else - vspace(p); + newln(p); + if ( ! arg_hasattr(MDOC_Compact, bl->argc, bl->argv)) + if (node->prev || n->prev) + vspace(p); return(1); } @@ -563,6 +563,9 @@ static int termp_nm_pre(DECL_ARGS) { + if (SEC_SYNOPSIS == node->sec) + newln(p); + TERMPAIR_SETFLAG(pair, ttypes[TTYPE_PROG]); if (NULL == node->child) word(p, meta->name); @@ -587,9 +590,14 @@ static int termp_ar_pre(DECL_ARGS) { - TERMPAIR_SETFLAG(pair, ttypes[TTYPE_CMD_ARG]); - if (NULL == node->child) - word(p, "..."); + if (node->child) { + TERMPAIR_SETFLAG(pair, ttypes[TTYPE_CMD_ARG]); + return(1); + } + p->flags |= ttypes[TTYPE_CMD_ARG]; + word(p, "file"); + word(p, "..."); + p->flags &= ~ttypes[TTYPE_CMD_ARG]; return(1); } -- cgit v1.2.3-56-ge451