diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-06-29 17:10:31 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2010-06-29 17:10:31 +0000 |
commit | 86790a5497ca5ec2a7a2c4332cde0535bd2cdcb5 (patch) | |
tree | 2e4f9df55663684ad8cc094bf68a433e8615227a /usr.bin/mandoc/mdoc.h | |
parent | fa0849e019181497ed312d27e9ee6480b00eca34 (diff) |
Support for badly nested blocks, written around the time of
the Rostock mandoc hackathon and tested and polished since,
supporting constructs like:
.Ao Bo Ac Bc (exp breaking exp)
.Aq Bo eol Bc (imp breaking exp)
.Ao Bq Ac eol (exp breaking imp)
.Ao Bo So Bc Ac Sc (double break, inner before outer)
.Ao Bo So Ac Bc Sc (double break, outer before inner)
.Ao Bo Ac So Bc Sc (broken breaker)
.Ao Bo So Bc Do Ac Sc Dc (broken double breaker)
There are still two known issues which are tricky:
1) Breaking two identical explicit blocks (Ao Bo Bo Ac or Aq Bo Bo eol)
fails outright, triggering a bogus syntax error.
2) Breaking a block by two identical explicit blocks (Ao Ao Bo Ac Ac Bc
or Ao Ao Bq Ac Ac eol) still has a minor rendering error left:
"<ao1 <ao2 [bo ac2> ac1> bc]>" should not have the final ">".
We can fix these later in the tree, let's not grow this diff too large.
"get it in" kristaps@
Diffstat (limited to 'usr.bin/mandoc/mdoc.h')
-rw-r--r-- | usr.bin/mandoc/mdoc.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/mandoc/mdoc.h b/usr.bin/mandoc/mdoc.h index 66754f450c3..f1d430170da 100644 --- a/usr.bin/mandoc/mdoc.h +++ b/usr.bin/mandoc/mdoc.h @@ -1,4 +1,4 @@ -/* $Id: mdoc.h,v 1.29 2010/06/27 21:54:42 schwarze Exp $ */ +/* $Id: mdoc.h,v 1.30 2010/06/29 17:10:29 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -249,6 +249,12 @@ struct mdoc_arg { unsigned int refcnt; }; +enum mdoc_endbody { + ENDBODY_NOT = 0, + ENDBODY_SPACE, + ENDBODY_NOSPACE, +}; + enum mdoc_list { LIST__NONE = 0, LIST_bullet, @@ -302,6 +308,7 @@ struct mdoc_node { #define MDOC_EOS (1 << 2) /* at sentence boundary */ #define MDOC_LINE (1 << 3) /* first macro/text on line */ #define MDOC_SYNPRETTY (1 << 4) /* SYNOPSIS-style formatting */ +#define MDOC_ENDED (1 << 5) /* rendering has been ended */ enum mdoc_type type; /* AST node type */ enum mdoc_sec sec; /* current named section */ /* FIXME: these can be union'd to shave a few bytes. */ @@ -311,6 +318,7 @@ struct mdoc_node { struct mdoc_node *body; /* BLOCK */ struct mdoc_node *tail; /* BLOCK */ char *string; /* TEXT */ + enum mdoc_endbody end; /* BODY */ union { struct mdoc_bl Bl; |