diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-02-28 20:13:06 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-02-28 20:13:06 +0000 |
commit | 253af51ade9f0c1525a5f7f3ac3c074524a1b7c3 (patch) | |
tree | f83d14970fe29b701b6847f69d11c28cfa4db1a6 | |
parent | 2df248c6ce60c428883b2fa11fdde63dd091d8a4 (diff) | |
download | mandoc-253af51ade9f0c1525a5f7f3ac3c074524a1b7c3.tar.gz |
More fixes (hard-escapes, etc.).
-rw-r--r-- | macro.c | 2 | ||||
-rw-r--r-- | mdocterm.c | 7 | ||||
-rw-r--r-- | term.c | 42 |
3 files changed, 34 insertions, 17 deletions
@@ -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); @@ -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); @@ -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); } |