aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--TODO8
-rw-r--r--roff.725
-rw-r--r--roff.c49
3 files changed, 64 insertions, 18 deletions
diff --git a/TODO b/TODO
index 121be434..9543c806 100644
--- a/TODO
+++ b/TODO
@@ -1,6 +1,6 @@
************************************************************************
* Official mandoc TODO.
-* $Id: TODO,v 1.266 2018/08/18 02:08:27 schwarze Exp $
+* $Id: TODO,v 1.267 2018/08/19 17:46:14 schwarze Exp $
************************************************************************
Many issues are annotated for difficulty as follows:
@@ -181,9 +181,6 @@ are mere guesses, and some may be wrong.
pali dot rohar at gmail dot com 16 Jul 2018 13:03:35 +0200
loc * exist *** algo *** size ** imp *
-- support .ds requests inside tbl(7) code,
- see tbl(1) for an example
-
- support mdoc(7) and man(7) macros inside tbl(7) code;
probably requires the parser reorg and letting tbl(7)
use roff_node such that macro sets can mix;
@@ -320,9 +317,6 @@ are mere guesses, and some may be wrong.
* formatting issues: ugly output
************************************************************************
-- .UR can nest inside .TP,
- see roff(7) for examples
-
- revisit empty in-line macros
look at the difference between "Em x Em ." and "Sq x Em ."
Carsten Kunze Fri, 12 Dec 2014 00:15:41 +0100
diff --git a/roff.7 b/roff.7
index 5377103c..5bf3ed25 100644
--- a/roff.7
+++ b/roff.7
@@ -1,4 +1,4 @@
-.\" $Id: roff.7,v 1.100 2018/08/18 21:37:01 schwarze Exp $
+.\" $Id: roff.7,v 1.101 2018/08/19 17:46:14 schwarze Exp $
.\"
.\" Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: August 18 2018 $
+.Dd $Mdocdate: August 19 2018 $
.Dt ROFF 7
.Os
.Sh NAME
@@ -1005,13 +1005,13 @@ is
or
.Sq o
.Pq odd page ,
-it evaluates to true.
+it evaluates to true, and the
+.Ar body
+starts with the next character.
.It
If the first character of
.Ar condition
is
-.Sq c
-.Pq character available ,
.Sq e
.Pq even page ,
.Sq t
@@ -1019,7 +1019,20 @@ is
or
.Sq v
.Pq vroff mode ,
-it evaluates to false.
+it evaluates to false, and the
+.Ar body
+starts with the next character.
+.It
+If the first character of
+.Ar condition
+is
+.Sq c
+.Pq character available ,
+it evaluates to true if the following character is an ASCII character
+or a valid character escape sequence, or to false otherwise.
+The
+.Ar body
+starts with the character following that next character.
.It
If the first character of
.Ar condition
diff --git a/roff.c b/roff.c
index 0c733006..9b3002ca 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.335 2018/08/18 22:05:43 schwarze Exp $ */
+/* $Id: roff.c,v 1.336 2018/08/19 17:46:14 schwarze Exp $ */
/*
* Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -2168,9 +2168,10 @@ out:
static int
roff_evalcond(struct roff *r, int ln, char *v, int *pos)
{
- char *cp, *name;
- size_t sz;
- int deftype, number, savepos, istrue, wanttrue;
+ const char *start, *end;
+ char *cp, *name;
+ size_t sz;
+ int deftype, len, number, savepos, istrue, wanttrue;
if ('!' == v[*pos]) {
wanttrue = 0;
@@ -2185,12 +2186,50 @@ roff_evalcond(struct roff *r, int ln, char *v, int *pos)
case 'o':
(*pos)++;
return wanttrue;
- case 'c':
case 'e':
case 't':
case 'v':
(*pos)++;
return !wanttrue;
+ case 'c':
+ do {
+ (*pos)++;
+ } while (v[*pos] == ' ');
+
+ /*
+ * Quirk for groff compatibility:
+ * The horizontal tab is neither available nor unavailable.
+ */
+
+ if (v[*pos] == '\t') {
+ (*pos)++;
+ return 0;
+ }
+
+ /* Printable ASCII characters are available. */
+
+ if (v[*pos] != '\\') {
+ (*pos)++;
+ return wanttrue;
+ }
+
+ end = v + ++*pos;
+ switch (mandoc_escape(&end, &start, &len)) {
+ case ESCAPE_SPECIAL:
+ istrue = mchars_spec2cp(start, len) != -1;
+ break;
+ case ESCAPE_UNICODE:
+ istrue = 1;
+ break;
+ case ESCAPE_NUMBERED:
+ istrue = mchars_num2char(start, len) != -1;
+ break;
+ default:
+ istrue = !wanttrue;
+ break;
+ }
+ *pos = end - v;
+ return istrue == wanttrue;
case 'd':
case 'r':
cp = v + *pos + 1;