From: Ingo Schwarze <schwarze@usta.de>
To: Pali Rohar <pali.rohar@gmail.com>
Cc: discuss@mandoc.bsd.lv
Subject: Re: Broken tables in HTML output
Date: Sun, 25 Nov 2018 22:25:16 +0100 [thread overview]
Message-ID: <20181125212516.GD45828@athene.usta.de> (raw)
In-Reply-To: <20181125193434.GC45828@athene.usta.de>
Hi Pali,
Ingo Schwarze wrote on Sun, Nov 25, 2018 at 08:34:34PM +0100:
> Ingo Schwarze wrote on Mon, Jul 16, 2018 at 05:29:19PM +0200:
>> Pali Rohar wrote on Mon, Jul 16, 2018 at 01:03:35PM +0200:
>>> cell spanning is broken,
>> More precisely, it is not implemented. I added an entry to the TODO
>> file, priority is moderate:
>>
>> - implement cell spanning in HTML output
>> pali dot rohar at gmail dot com 16 Jul 2018 13:03:35 +0200
>> loc * exist * algo ** size ** imp **
> Implemented in the commit below.
[...]
> Log Message:
> -----------
> In tbl(7) -T html output,
> span cells horizontally and vertically as requested by the layout.
> Does not handle spans requested in the data section yet.
This feature - \^ in data cells - is now also implemented,
see the following commit.
Yours,
Ingo
Log Message:
-----------
Let cells containing nothing but \^ extend the cell above.
Missing feature reported by Pali dot Rohar at gmail dot com.
Modified Files:
--------------
mandoc:
TODO
tbl.7
tbl_data.c
tbl_html.c
Revision Data
-------------
Index: tbl.7
===================================================================
RCS file: /home/cvs/mandoc/mandoc/tbl.7,v
retrieving revision 1.29
retrieving revision 1.30
diff -Ltbl.7 -Ltbl.7 -u -p -r1.29 -r1.30
--- tbl.7
+++ tbl.7
@@ -1,7 +1,7 @@
.\" $Id$
.\"
.\" Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
-.\" Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
+.\" Copyright (c) 2014, 2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
@@ -147,9 +147,9 @@ The combined cell as a whole consumes on
of the corresponding data line.
.It Cm a
Left-justify a string and pad with one space.
-.It Cm ^
+.It Cm \(ha
Vertically span rows from the last
-.Pf non- Cm ^
+.Pf non- Cm \(ha
layout cell.
It is an error to invoke a vertical span on the first layout line.
Unlike a horizontal span, a vertical span consumes a data cell
@@ -231,7 +231,13 @@ Each data line consists of one or more d
.Cm tab
characters.
.Pp
-If a data cells contains only the single character
+If a data cell contains only the two bytes
+.Ql \e\(ha ,
+the cell above spans to this row, as if the layout specification
+of this cell were
+.Cm \(ha .
+.Pp
+If a data cell contains only the single character
.Ql _
or
.Ql = ,
@@ -332,8 +338,8 @@ Spans and skipping width calculations:
\&.TS
box tab(:);
lz s | rt
-lt| cb| ^
-^ | rz s.
+lt| cb| \(ha
+\(ha | rz s.
left:r
l:center:
:right
Index: tbl_data.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/tbl_data.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -Ltbl_data.c -Ltbl_data.c -u -p -r1.46 -r1.47
--- tbl_data.c
+++ tbl_data.c
@@ -45,6 +45,15 @@ getdata(struct tbl_node *tbl, struct tbl
struct tbl_span *pdp;
int sv;
+ /*
+ * Determine the length of the string in the cell
+ * and advance the parse point to the end of the cell.
+ */
+
+ sv = *pos;
+ while (p[*pos] != '\0' && p[*pos] != tbl->opts.tab)
+ (*pos)++;
+
/* Advance to the next layout cell, skipping spanners. */
cp = dp->last == NULL ? dp->layout->first : dp->last->layout->next;
@@ -67,8 +76,8 @@ getdata(struct tbl_node *tbl, struct tbl
dp->layout->last = cp;
} else {
mandoc_msg(MANDOCERR_TBLDATA_EXTRA, tbl->parse,
- ln, *pos, p + *pos);
- while (p[*pos])
+ ln, sv, p + sv);
+ while (p[*pos] != '\0')
(*pos)++;
return;
}
@@ -91,7 +100,8 @@ getdata(struct tbl_node *tbl, struct tbl
* can be reused for more than one data row.
*/
- if (cp->pos == TBL_CELL_DOWN) {
+ if (cp->pos == TBL_CELL_DOWN ||
+ (*pos - sv == 2 && p[sv] == '\\' && p[sv + 1] == '^')) {
pdp = dp;
while ((pdp = pdp->prev) != NULL) {
pdat = pdp->first;
@@ -100,7 +110,8 @@ getdata(struct tbl_node *tbl, struct tbl
pdat = pdat->next;
if (pdat == NULL)
break;
- if (pdat->layout->pos != TBL_CELL_DOWN) {
+ if (pdat->layout->pos != TBL_CELL_DOWN &&
+ strcmp(pdat->string, "\\^") != 0) {
pdat->vspans++;
break;
}
@@ -126,10 +137,6 @@ getdata(struct tbl_node *tbl, struct tbl
dp->last->next = dat;
dp->last = dat;
- sv = *pos;
- while (p[*pos] && p[*pos] != tbl->opts.tab)
- (*pos)++;
-
/*
* Check for a continued-data scope opening. This consists of a
* trailing `T{' at the end of the line. Subsequent lines,
@@ -143,7 +150,7 @@ getdata(struct tbl_node *tbl, struct tbl
dat->string = mandoc_strndup(p + sv, *pos - sv);
- if (p[*pos])
+ if (p[*pos] != '\0')
(*pos)++;
if ( ! strcmp(dat->string, "_"))
Index: tbl_html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/tbl_html.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -Ltbl_html.c -Ltbl_html.c -u -p -r1.26 -r1.27
--- tbl_html.c
+++ tbl_html.c
@@ -126,13 +126,18 @@ print_tbl(struct html *h, const struct t
default:
for (dp = sp->first; dp != NULL; dp = dp->next) {
print_stagq(h, tt);
- switch (dp->layout->pos) {
- case TBL_CELL_SPAN:
- case TBL_CELL_DOWN:
+
+ /*
+ * Do not generate <td> elements for continuations
+ * of spanned cells. Larger <td> elements covering
+ * this space were already generated earlier.
+ */
+
+ if (dp->layout->pos == TBL_CELL_SPAN ||
+ dp->layout->pos == TBL_CELL_DOWN ||
+ (dp->string != NULL &&
+ strcmp(dp->string, "\\^") == 0))
continue;
- default:
- break;
- }
/* Determine the attribute values. */
Index: TODO
===================================================================
RCS file: /home/cvs/mandoc/mandoc/TODO,v
retrieving revision 1.277
retrieving revision 1.278
diff -LTODO -LTODO -u -p -r1.277 -r1.278
--- TODO
+++ TODO
@@ -168,10 +168,6 @@ are mere guesses, and some may be wrong.
--- missing tbl features -----------------------------------------------
-- vertically spanning cells by \^ in the data section
- pali dot rohar at gmail dot com 16 Jul 2018 13:03:35 +0200
- loc * exist * algo * size * imp ***
-
- the "s" layout column specifier is used for placement of data
into columns, but ignored during column width calculations
synaptics(4) found by tedu@ Mon, 17 Aug 2015 21:17:42 -0400
--
To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv
next prev parent reply other threads:[~2018-11-25 21:25 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-16 11:03 Pali Rohár
2018-07-16 15:29 ` Ingo Schwarze
2018-07-16 16:36 ` Pali Rohár
2018-07-16 17:44 ` Ingo Schwarze
2018-11-24 23:15 ` Ingo Schwarze
2018-11-25 19:34 ` Ingo Schwarze
2018-11-25 21:25 ` Ingo Schwarze [this message]
2018-11-26 8:53 ` Pali Rohár
2018-11-26 21:27 ` Ingo Schwarze
2018-11-26 21:58 ` Pali Rohár
2018-11-26 22:01 ` Pali Rohár
2018-11-26 22:05 ` Pali Rohár
2018-12-01 17:20 ` Ingo Schwarze
2018-12-01 19:35 ` Pali Rohár
2018-12-03 20:46 ` Pali Rohár
2018-12-04 5:33 ` Ingo Schwarze
2018-12-03 22:01 ` Pali Rohár
2018-12-03 22:14 ` Ingo Schwarze
2018-12-03 22:20 ` Pali Rohár
2018-12-03 22:37 ` Ingo Schwarze
2018-12-04 16:44 ` Pali Rohár
2018-12-04 18:04 ` Ingo Schwarze
2019-01-21 9:39 ` Pali Rohár
2019-01-21 13:16 ` Ingo Schwarze
2018-11-29 2:15 ` Ingo Schwarze
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181125212516.GD45828@athene.usta.de \
--to=schwarze@usta.de \
--cc=discuss@mandoc.bsd.lv \
--cc=pali.rohar@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).