summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-02-28 19:15:28 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-02-28 19:15:28 +0000
commit04ec167793e3dfd1707ea22132ce12f5b7b45e85 (patch)
treea8e26ae4e9a4cceb3d2840bd0352c4d82076b3d6
parentf300e7e80f1ad8d7416dbc604d1f2322668e6d72 (diff)
downloadmandoc-04ec167793e3dfd1707ea22132ce12f5b7b45e85.tar.gz
mandoc-04ec167793e3dfd1707ea22132ce12f5b7b45e85.tar.zst
mandoc-04ec167793e3dfd1707ea22132ce12f5b7b45e85.zip
Initial Rs/Re support.
Fixed default Ds width.
-rw-r--r--action.c4
-rw-r--r--term.c64
2 files changed, 57 insertions, 11 deletions
diff --git a/action.c b/action.c
index c24830ad..f18bb780 100644
--- a/action.c
+++ b/action.c
@@ -1,4 +1,4 @@
-/* $Id: action.c,v 1.25 2009/02/28 14:43:35 kristaps Exp $ */
+/* $Id: action.c,v 1.26 2009/02/28 19:15:28 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -397,7 +397,7 @@ post_bl_width(struct mdoc *mdoc)
"%s argument deprecated",
mdoc_argnames[MDOC_Width]))
return(0);
- width = 6;
+ width = 8;
} else if (MDOC_MAX == (tok = mdoc_find(mdoc, *p)))
return(1);
else if (0 == (width = mdoc_macro2len(tok)))
diff --git a/term.c b/term.c
index f44b7a51..5ad67a8b 100644
--- a/term.c
+++ b/term.c
@@ -1,4 +1,4 @@
-/* $Id: term.c,v 1.27 2009/02/27 09:39:40 kristaps Exp $ */
+/* $Id: term.c,v 1.28 2009/02/28 19:15:28 kristaps Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -25,7 +25,7 @@
#include "term.h"
-#define INDENT 6
+#define INDENT 8
/*
* Performs actions on nodes of the abstract syntax tree. Both pre- and
@@ -108,6 +108,7 @@ static void name##_post(DECL_ARGS)
DECL_PRE(name); \
DECL_POST(name);
+DECL_PREPOST(termp__t);
DECL_PREPOST(termp_aq);
DECL_PREPOST(termp_bd);
DECL_PREPOST(termp_bq);
@@ -150,6 +151,7 @@ DECL_PRE(termp_nx);
DECL_PRE(termp_ox);
DECL_PRE(termp_pa);
DECL_PRE(termp_pp);
+DECL_PRE(termp_rs);
DECL_PRE(termp_rv);
DECL_PRE(termp_sm);
DECL_PRE(termp_st);
@@ -160,6 +162,7 @@ DECL_PRE(termp_ux);
DECL_PRE(termp_va);
DECL_PRE(termp_xr);
+DECL_POST(termp___);
DECL_POST(termp_bl);
const struct termact __termacts[MDOC_MAX] = {
@@ -204,16 +207,16 @@ const struct termact __termacts[MDOC_MAX] = {
{ termp_va_pre, NULL }, /* Va */
{ termp_vt_pre, termp_vt_post }, /* Vt */
{ termp_xr_pre, NULL }, /* Xr */
- { NULL, NULL }, /* %A */
+ { NULL, termp____post }, /* %A */
{ NULL, NULL }, /* %B */
- { NULL, NULL }, /* %D */
+ { NULL, termp____post }, /* %D */
{ NULL, NULL }, /* %I */
- { NULL, NULL }, /* %J */
+ { NULL, termp____post }, /* %J */
{ NULL, NULL }, /* %N */
{ NULL, NULL }, /* %O */
{ NULL, NULL }, /* %P */
{ NULL, NULL }, /* %R */
- { NULL, NULL }, /* %T */
+ { termp__t_pre, termp__t_post }, /* %T */
{ NULL, NULL }, /* %V */
{ NULL, NULL }, /* Ac */
{ termp_aq_pre, termp_aq_post }, /* Ao */
@@ -248,7 +251,7 @@ const struct termact __termacts[MDOC_MAX] = {
{ termp_qq_pre, termp_qq_post }, /* Qo */
{ termp_qq_pre, termp_qq_post }, /* Qq */
{ NULL, NULL }, /* Re */
- { NULL, NULL }, /* Rs */
+ { termp_rs_pre, NULL }, /* Rs */
{ NULL, NULL }, /* Sc */
{ termp_sq_pre, termp_sq_post }, /* So */
{ termp_sq_pre, termp_sq_post }, /* Sq */
@@ -300,7 +303,7 @@ arg_width(const struct mdoc_arg *arg)
}
}
- return(strlen(*arg->value));
+ return(strlen(*arg->value) + 1);
}
@@ -628,6 +631,17 @@ termp_st_pre(DECL_ARGS)
/* ARGSUSED */
static int
+termp_rs_pre(DECL_ARGS)
+{
+
+ if (MDOC_BLOCK == node->type)
+ vspace(p);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static int
termp_rv_pre(DECL_ARGS)
{
int i;
@@ -1173,7 +1187,7 @@ termp_sq_pre(DECL_ARGS)
if (MDOC_BODY != node->type)
return(1);
- word(p, "\'");
+ word(p, "`");
p->flags |= TERMP_NOSPACE;
return(1);
}
@@ -1485,3 +1499,35 @@ termp_sm_pre(DECL_ARGS)
return(0);
}
+
+
+/* ARGSUSED */
+static int
+termp__t_pre(DECL_ARGS)
+{
+
+ word(p, "\"");
+ p->flags |= TERMP_NOSPACE;
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+termp__t_post(DECL_ARGS)
+{
+
+ p->flags |= TERMP_NOSPACE;
+ word(p, "\"");
+ word(p, node->next ? "," : ".");
+}
+
+
+/* ARGSUSED */
+static void
+termp____post(DECL_ARGS)
+{
+
+ p->flags |= TERMP_NOSPACE;
+ word(p, node->next ? "," : ".");
+}