summaryrefslogtreecommitdiffstats
path: root/term.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-03-02 17:14:46 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-03-02 17:14:46 +0000
commitf57412d689f445d6786167aac98dfde81c90ea12 (patch)
tree412635fca540b14d5139e91a039f78f70a7cf3d8 /term.c
parentaaee43f80d524f98453fc13d60a657085867666f (diff)
downloadmandoc-f57412d689f445d6786167aac98dfde81c90ea12.tar.gz
Added new old escape sequence \*[nn].
Initial correct .Bd support (still only text in literal displays). Symbols put into tables (character-encoding).
Diffstat (limited to 'term.c')
-rw-r--r--term.c56
1 files changed, 42 insertions, 14 deletions
diff --git a/term.c b/term.c
index d742795b..ab2dd9b1 100644
--- a/term.c
+++ b/term.c
@@ -1051,8 +1051,8 @@ static int
termp_bd_pre(DECL_ARGS)
{
const struct mdoc_block *bl;
- const struct mdoc_node *n;
- int i;
+ const struct mdoc_node *n;
+ int i, type;
if (MDOC_BLOCK == node->type) {
if (node->prev)
@@ -1061,31 +1061,55 @@ termp_bd_pre(DECL_ARGS)
} else if (MDOC_BODY != node->type)
return(1);
- assert(MDOC_BLOCK == node->parent->type);
pair->offset = p->offset;
-
bl = &node->parent->data.block;
+ for (type = -1, i = 0; i < (int)bl->argc; i++) {
+ switch (bl->argv[i].arg) {
+ case (MDOC_Ragged):
+ /* FALLTHROUGH */
+ case (MDOC_Filled):
+ /* FALLTHROUGH */
+ case (MDOC_Unfilled):
+ /* FALLTHROUGH */
+ case (MDOC_Literal):
+ type = bl->argv[i].arg;
+ i = (int)bl->argc;
+ break;
+ default:
+ errx(1, "display type not supported");
+ }
+ }
+
+ assert(-1 != type);
+
i = arg_getattr(MDOC_Offset, bl->argc, bl->argv);
if (-1 != i) {
assert(1 == bl->argv[i].sz);
p->offset += arg_offset(&bl->argv[i]);
}
+
+ switch (type) {
+ case (MDOC_Literal):
+ /* FALLTHROUGH */
+ case (MDOC_Unfilled):
+ break;
+ default:
+ return(1);
+ }
+
p->flags |= TERMP_LITERAL;
for (n = node->child; n; n = n->next) {
- if (MDOC_TEXT != n->type)
- errx(1, "non-text displays unsupported");
- if ((*n->data.text.string)) {
- word(p, n->data.text.string);
- flushln(p);
- } else
- vspace(p);
-
+ if (MDOC_TEXT != n->type) {
+ warnx("non-text children not yet allowed");
+ continue;
+ }
+ word(p, n->data.text.string);
+ flushln(p);
}
- p->flags &= ~TERMP_LITERAL;
return(0);
}
@@ -1097,7 +1121,11 @@ termp_bd_post(DECL_ARGS)
if (MDOC_BODY != node->type)
return;
- newln(p);
+
+ if ( ! (p->flags & TERMP_LITERAL))
+ flushln(p);
+
+ p->flags &= ~TERMP_LITERAL;
p->offset = pair->offset;
}