summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2017-02-10 15:45:28 +0000
committerIngo Schwarze <schwarze@openbsd.org>2017-02-10 15:45:28 +0000
commit33be0794e265a46ae95f2b46b2d4e7d6f60e3f66 (patch)
tree5ee13f7cf5d5ada38d679d5bdc4210ad1b0e4e40
parent5b9da291e12f07f785311d286e2776f927683b2b (diff)
downloadmandoc-33be0794e265a46ae95f2b46b2d4e7d6f60e3f66.tar.gz
In -Ttree output mode, show the BROKEN node flag and
provide a -Onoval output option to show the unvalidated tree.
-rw-r--r--NEWS9
-rw-r--r--main.c6
-rw-r--r--manconf.h1
-rw-r--r--mandoc.113
-rw-r--r--manpath.c5
-rw-r--r--tree.c2
6 files changed, 29 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index cbaddbd7..25ba44fa 100644
--- a/NEWS
+++ b/NEWS
@@ -35,7 +35,8 @@ Changes in version 1.14.1, released on February XXX, 2017
* mdoc(7): Always do text production in the validator, never in the
formatters. Cleaner, simpler, shorter, helps NetBSD apropos(1)
and also makes -Ttree output more useful.
- * mdoc(7), man(7): Show metadata in -Ttree output.
+ * -Ttree: Show metadata and some additional node flags.
+ New -Onoval output option to show the unvalidated tree.
--- RELIABILITY BUGFIXES ---
* man(1): Make "man -l" work with standard input from a pipe or file,
as long as standard output is a terminal.
@@ -49,7 +50,7 @@ Changes in version 1.14.1, released on February XXX, 2017
shown was preformatted.
* mdoc(7): Fix syntax tree corruption leading to NULL dereference
for macro sequences like .Bl .Bl .It Bo .El .It.
- * mdoc(7): Fix syntax tree corruption leading to NULL dereference
+ * mdoc(7): Fix syntax tree corruption leading to NULL dereference
caused by .Ta following a nested .Bl -column breaking another block.
* mdoc(7) -Thtml: Fix a NULL dereference for .Bl -column with 0 columns.
* mdoc(7): Fix NULL dereference if the only child of the head
@@ -100,7 +101,7 @@ Changes in version 1.14.1, released on February XXX, 2017
Stuart Henderson, Ted Unangst, Theo de Raadt (OpenBSD), Abhinav
Upadhyay, Christos Zoulas, Kamil Rytarowski, Sevan Janiyan,
Thomas Klausner (NetBSD), Aaron M. Ucko, Bdale Garbee, Reiner
- Herrmann, Shane Kerr (Debian), Christian Neukirchen (Void Linux),
+ Herrmann, Shane Kerr (Debian), Leah Neukirchen (Void Linux),
Daniel Sabogal (Alpine Linux), Yuri Pankov (illumos),
Carsten Kunze (Heirloom roff), Kristaps Dzonsons (bsd.lv),
Anton Lindqvist, Jan Stary, Jeremy A. Mates, Mark Patruck,
@@ -218,7 +219,7 @@ Changes in version 1.13.4, released on July 14, 2016
again resulting in more than half a dozen important bug reports.
* Svyatoslav Mishyn (Crux Linux) for some patches, several bug
reports, and extensive release testing.
- * Christian Neukirchen (void Linux) for a number of compatibility
+ * Leah Neukirchen (Void Linux) for a number of compatibility
patches and suggestions and several bug reports.
* Christos Zoulas (NetBSD) for a bug fix patch and some useful
suggestions for cleanup.
diff --git a/main.c b/main.c
index 5382d0b2..70566436 100644
--- a/main.c
+++ b/main.c
@@ -742,7 +742,8 @@ parse(struct curparse *curp, int fd, const char *file)
if (man == NULL)
return;
if (man->macroset == MACROSET_MDOC) {
- mdoc_validate(man);
+ if (curp->outtype != OUTT_TREE || !curp->outopts->noval)
+ mdoc_validate(man);
switch (curp->outtype) {
case OUTT_HTML:
html_mdoc(curp->outdata, man);
@@ -765,7 +766,8 @@ parse(struct curparse *curp, int fd, const char *file)
}
}
if (man->macroset == MACROSET_MAN) {
- man_validate(man);
+ if (curp->outtype != OUTT_TREE || !curp->outopts->noval)
+ man_validate(man);
switch (curp->outtype) {
case OUTT_HTML:
html_man(curp->outdata, man);
diff --git a/manconf.h b/manconf.h
index 80578f6a..f5c678e8 100644
--- a/manconf.h
+++ b/manconf.h
@@ -35,6 +35,7 @@ struct manoutput {
int fragment;
int mdoc;
int synopsisonly;
+ int noval;
};
struct manconf {
diff --git a/mandoc.1 b/mandoc.1
index e05c99f6..322040cf 100644
--- a/mandoc.1
+++ b/mandoc.1
@@ -538,6 +538,8 @@ A closing parenthesis if the node is a closing delimiter.
.It
A full stop if the node ends a sentence.
.It
+BROKEN if the node is a block broken by another block.
+.It
NOSRC if the node is not in the input file,
but automatically generated from macros.
.It
@@ -545,6 +547,17 @@ NOPRT if the node is not supposed to generate output
for any output format.
.El
.El
+.Pp
+The following
+.Fl O
+argument is accepted:
+.Bl -tag -width Ds
+.It Cm noval
+Skip validation and show the unvalidated syntax tree.
+This can help to find out whether a given behaviour is caused by
+the parser or by the validator.
+Meta data is not available in this case.
+.El
.Sh ENVIRONMENT
.Bl -tag -width MANPAGER
.It Ev MANPAGER
diff --git a/manpath.c b/manpath.c
index ba50500d..f0f934ac 100644
--- a/manpath.c
+++ b/manpath.c
@@ -226,7 +226,7 @@ manconf_output(struct manoutput *conf, const char *cp, int fromfile)
{
const char *const toks[] = {
"includes", "man", "paper", "style",
- "indent", "width", "fragment", "mdoc"
+ "indent", "width", "fragment", "mdoc", "noval"
};
const char *errstr;
@@ -310,6 +310,9 @@ manconf_output(struct manoutput *conf, const char *cp, int fromfile)
case 7:
conf->mdoc = 1;
return 0;
+ case 8:
+ conf->noval = 1;
+ return 0;
default:
if (fromfile)
warnx("-O %s: Bad argument", cp);
diff --git a/tree.c b/tree.c
index 39e27753..4a04864f 100644
--- a/tree.c
+++ b/tree.c
@@ -192,6 +192,8 @@ print_mdoc(const struct roff_node *n, int indent)
putchar(')');
if (NODE_EOS & n->flags)
putchar('.');
+ if (NODE_BROKEN & n->flags)
+ printf(" BROKEN");
if (NODE_NOSRC & n->flags)
printf(" NOSRC");
if (NODE_NOPRT & n->flags)