=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mdoc.c,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- src/usr.bin/mandoc/mdoc.c 2010/09/27 21:25:28 1.66 +++ src/usr.bin/mandoc/mdoc.c 2010/10/16 13:38:29 1.67 @@ -1,4 +1,4 @@ -/* $Id: mdoc.c,v 1.66 2010/09/27 21:25:28 schwarze Exp $ */ +/* $Id: mdoc.c,v 1.67 2010/10/16 13:38:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons * Copyright (c) 2010 Ingo Schwarze @@ -28,6 +28,10 @@ #include "libmdoc.h" #include "libmandoc.h" +#include "out.h" +#include "term.h" +#include "tbl.h" + const char *const __mdoc_macronames[MDOC_MAX] = { "Ap", "Dd", "Dt", "Os", "Sh", "Ss", "Pp", "D1", @@ -65,7 +69,7 @@ /* LINTED */ "Dx", "%Q", "br", "sp", /* LINTED */ - "%U", "Ta" + "%U", "Ta", "TS", "TE" }; const char *const __mdoc_argnames[MDOC_ARG_MAX] = { @@ -225,12 +229,22 @@ int mdoc_parseln(struct mdoc *m, int ln, char *buf, int offs) { + struct mdoc_node *n; if (MDOC_HALT & m->flags) return(0); m->flags |= MDOC_NEWLINE; + n = m->last; + + if (n && MDOC_TS == n->tok && MDOC_BODY == n->type && + strncmp(buf+offs, ".TE", 3)) { + n = n->parent; + return(tbl_read(n->data.TS, "", ln, buf+offs, + strlen(buf+offs)) ? 1 : 0); + } + /* * Let the roff nS register switch SYNOPSIS mode early, * such that the parser knows at all times @@ -524,6 +538,9 @@ if (MDOC_Bf == p->tok && MDOC_HEAD == p->type) if (p->data.Bf) free(p->data.Bf); + if (MDOC_TS == p->tok && MDOC_BLOCK == p->type) + if (p->data.TS) + tbl_free(p->data.TS); if (p->string) free(p->string);