1 /* $Id: tbl_html.c,v 1.9 2011/09/18 14:14:15 schwarze Exp $ */
2 /*
3 * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20
21 #include <assert.h>
102 assert(h->tblt);
103
104 h->flags |= HTML_NONOSPACE;
105 h->flags |= HTML_NOSPACE;
106
107 tt = print_otag(h, TAG_TR, 0, NULL);
108
109 switch (sp->pos) {
110 case (TBL_SPAN_HORIZ):
111 /* FALLTHROUGH */
112 case (TBL_SPAN_DHORIZ):
113 PAIR_INIT(&tag, ATTR_COLSPAN, "0");
114 print_otag(h, TAG_TD, 1, &tag);
115 break;
116 default:
117 dp = sp->first;
118 for (hp = sp->head; hp; hp = hp->next) {
119 print_stagq(h, tt);
120 print_otag(h, TAG_TD, 0, NULL);
121
122 switch (hp->pos) {
123 case (TBL_HEAD_VERT):
124 /* FALLTHROUGH */
125 case (TBL_HEAD_DVERT):
126 continue;
127 case (TBL_HEAD_DATA):
128 if (NULL == dp)
129 break;
130 if (TBL_CELL_DOWN != dp->layout->pos)
131 if (dp->string)
132 print_text(h, dp->string);
133 dp = dp->next;
134 break;
135 }
136 }
137 break;
138 }
139
140 print_tagq(h, tt);
141
142 h->flags &= ~HTML_NONOSPACE;
143
144 if (TBL_SPAN_LAST & sp->flags) {
145 assert(h->tbl.cols);
146 free(h->tbl.cols);
147 h->tbl.cols = NULL;
148 print_tblclose(h);
149 }
150
151 }
|
1 /* $Id: tbl_html.c,v 1.10 2012/05/27 17:54:54 schwarze Exp $ */
2 /*
3 * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20
21 #include <assert.h>
102 assert(h->tblt);
103
104 h->flags |= HTML_NONOSPACE;
105 h->flags |= HTML_NOSPACE;
106
107 tt = print_otag(h, TAG_TR, 0, NULL);
108
109 switch (sp->pos) {
110 case (TBL_SPAN_HORIZ):
111 /* FALLTHROUGH */
112 case (TBL_SPAN_DHORIZ):
113 PAIR_INIT(&tag, ATTR_COLSPAN, "0");
114 print_otag(h, TAG_TD, 1, &tag);
115 break;
116 default:
117 dp = sp->first;
118 for (hp = sp->head; hp; hp = hp->next) {
119 print_stagq(h, tt);
120 print_otag(h, TAG_TD, 0, NULL);
121
122 if (NULL == dp)
123 break;
124 if (TBL_CELL_DOWN != dp->layout->pos)
125 if (dp->string)
126 print_text(h, dp->string);
127 dp = dp->next;
128 }
129 break;
130 }
131
132 print_tagq(h, tt);
133
134 h->flags &= ~HTML_NONOSPACE;
135
136 if (TBL_SPAN_LAST & sp->flags) {
137 assert(h->tbl.cols);
138 free(h->tbl.cols);
139 h->tbl.cols = NULL;
140 print_tblclose(h);
141 }
142
143 }
|