summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--mdoc.h11
-rw-r--r--mdoc_html.c8
-rw-r--r--mdoc_term.c21
-rw-r--r--mdoc_validate.c27
4 files changed, 33 insertions, 34 deletions
diff --git a/mdoc.h b/mdoc.h
index 741c63f1..24811c90 100644
--- a/mdoc.h
+++ b/mdoc.h
@@ -1,4 +1,4 @@
-/* $Id: mdoc.h,v 1.86 2010/06/12 11:58:22 kristaps Exp $ */
+/* $Id: mdoc.h,v 1.87 2010/06/12 12:10:55 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -273,13 +273,14 @@ enum mdoc_disp {
};
struct mdoc_bd {
- const char *offs;
- enum mdoc_disp type;
- int comp;
+ const char *offs; /* -offset */
+ enum mdoc_disp type; /* -ragged, etc. */
+ int comp; /* -compact */
};
struct mdoc_bl {
- enum mdoc_list type;
+ enum mdoc_list type; /* -tag, -enum, etc. */
+ int comp; /* -compact */
};
/* Node in AST. */
diff --git a/mdoc_html.c b/mdoc_html.c
index e4337efb..ac58c701 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.81 2010/06/12 11:58:22 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.82 2010/06/12 12:10:55 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -1036,6 +1036,7 @@ mdoc_it_pre(MDOC_ARGS)
bl = bl->parent;
type = bl->data.Bl.type;
+ comp = bl->data.Bl.comp;
/* Set default width and offset. */
@@ -1059,7 +1060,7 @@ mdoc_it_pre(MDOC_ARGS)
/* Get width, offset, and compact arguments. */
wp = -1;
- for (comp = i = 0; bl->args && i < (int)bl->args->argc; i++)
+ for (i = 0; bl->args && i < (int)bl->args->argc; i++)
switch (bl->args->argv[i].arg) {
case (MDOC_Column):
wp = i; /* Save for later. */
@@ -1070,9 +1071,6 @@ mdoc_it_pre(MDOC_ARGS)
case (MDOC_Offset):
a2offs(bl->args->argv[i].value[0], &offs);
break;
- case (MDOC_Compact):
- comp = 1;
- break;
default:
break;
}
diff --git a/mdoc_term.c b/mdoc_term.c
index fe657446..e1007e1c 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.149 2010/06/12 11:58:22 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.150 2010/06/12 12:10:55 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -61,7 +61,6 @@ static int arg_getattrs(const int *, int *, size_t,
const struct mdoc_node *);
static int arg_getattr(int, const struct mdoc_node *);
static void print_bvspace(struct termp *,
- const struct mdoc_node *,
const struct mdoc_node *);
static void print_mdoc_node(DECL_ARGS);
static void print_mdoc_nodelist(DECL_ARGS);
@@ -564,15 +563,15 @@ arg_getattrs(const int *keys, int *vals,
* too.
*/
static void
-print_bvspace(struct termp *p,
- const struct mdoc_node *bl,
- const struct mdoc_node *n)
+print_bvspace(struct termp *p, const struct mdoc_node *n)
{
const struct mdoc_node *nn;
- /* FIXME: MDOC_Bd == bl->tok && bl->data.Bd.comp */
term_newln(p);
- if (arg_hasattr(MDOC_Compact, bl))
+
+ if (MDOC_Bl == n->tok && n->data.Bl.comp)
+ return;
+ if (MDOC_Bd == n->tok && n->data.Bd.comp)
return;
/* Do not vspace directly after Ss/Sh. */
@@ -591,13 +590,13 @@ print_bvspace(struct termp *p,
/* A `-column' does not assert vspace within the list. */
- if (MDOC_Bl == bl->tok && LIST_column == bl->data.Bl.type)
+ if (MDOC_Bl == n->tok && LIST_column == n->data.Bl.type)
if (n->prev && MDOC_It == n->prev->tok)
return;
/* A `-diag' without body does not vspace. */
- if (MDOC_Bl == bl->tok && LIST_diag == bl->data.Bl.type)
+ if (MDOC_Bl == n->tok && LIST_diag == n->data.Bl.type)
if (n->prev && MDOC_It == n->prev->tok) {
assert(n->prev->body);
if (NULL == n->prev->body->child)
@@ -646,7 +645,7 @@ termp_it_pre(DECL_ARGS)
enum mdoc_list type;
if (MDOC_BLOCK == n->type) {
- print_bvspace(p, n->parent->parent, n);
+ print_bvspace(p, n);
return(1);
}
@@ -1607,7 +1606,7 @@ termp_bd_pre(DECL_ARGS)
const struct mdoc_node *nn;
if (MDOC_BLOCK == n->type) {
- print_bvspace(p, n, n);
+ print_bvspace(p, n);
return(1);
} else if (MDOC_HEAD == n->type)
return(0);
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 62a126b3..b15fe397 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.96 2010/06/12 11:58:22 kristaps Exp $ */
+/* $Id: mdoc_validate.c,v 1.97 2010/06/12 12:10:55 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -532,7 +532,7 @@ pre_display(PRE_ARGS)
static int
pre_bl(PRE_ARGS)
{
- int i, width, offs, cmpt, dupl;
+ int i, width, offs, comp, dup;
enum mdoc_list lt;
if (MDOC_BLOCK != n->type) {
@@ -552,12 +552,12 @@ pre_bl(PRE_ARGS)
*/
assert(LIST__NONE == n->data.Bl.type);
- offs = width = cmpt = -1;
+ offs = width = -1;
/* LINTED */
for (i = 0; n->args && i < (int)n->args->argc; i++) {
lt = LIST__NONE;
- dupl = 0;
+ dup = comp = 0;
switch (n->args->argv[i].arg) {
/* Set list types. */
case (MDOC_Bullet):
@@ -595,27 +595,28 @@ pre_bl(PRE_ARGS)
break;
/* Set list arguments. */
case (MDOC_Compact):
- if (cmpt >= 0)
- dupl++;
- cmpt = i;
+ dup = n->data.Bl.comp;
+ comp = 1;
break;
case (MDOC_Width):
if (width >= 0)
- dupl++;
+ dup++;
width = i;
break;
case (MDOC_Offset):
if (offs >= 0)
- dupl++;
+ dup++;
offs = i;
break;
}
/* Check: duplicate auxiliary arguments. */
- if (dupl)
- if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_ARGVREP))
- return(0);
+ if (dup && ! mdoc_nmsg(mdoc, n, MANDOCERR_ARGVREP))
+ return(0);
+
+ if (comp && ! dup)
+ n->data.Bl.comp = comp;
/* Check: multiple list types. */
@@ -631,7 +632,7 @@ pre_bl(PRE_ARGS)
/* The list type should come first. */
if (n->data.Bl.type == LIST__NONE)
- if (width >= 0 || offs >= 0 || cmpt >= 0)
+ if (width >= 0 || offs >= 0 || n->data.Bl.comp)
if ( ! mdoc_nmsg(mdoc, n, MANDOCERR_LISTFIRST))
return(0);