summaryrefslogtreecommitdiffstatshomepage
path: root/term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-02-28 20:13:06 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-02-28 20:13:06 +0000
commitdf65ac42a497f4acfc4cf57335efee9070d1c8a2 (patch)
treecbe09ad8bcffc2b5669f642a46e5cd7994c3bcb3 /term.c
parent04ec167793e3dfd1707ea22132ce12f5b7b45e85 (diff)
downloadmandoc-df65ac42a497f4acfc4cf57335efee9070d1c8a2.tar.gz
mandoc-df65ac42a497f4acfc4cf57335efee9070d1c8a2.tar.zst
mandoc-df65ac42a497f4acfc4cf57335efee9070d1c8a2.zip
More fixes (hard-escapes, etc.).
Diffstat (limited to 'term.c')
-rw-r--r--term.c44
1 files changed, 26 insertions, 18 deletions
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 <kristaps@kth.se>
*
@@ -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);
}