Print this page
9718 update mandoc to 1.14.4
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/mandoc/man_html.c
+++ new/usr/src/cmd/mandoc/man_html.c
1 -/* $Id: man_html.c,v 1.145 2017/06/25 11:42:02 schwarze Exp $ */
1 +/* $Id: man_html.c,v 1.153 2018/07/27 17:49:31 schwarze Exp $ */
2 2 /*
3 3 * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
4 - * Copyright (c) 2013, 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
4 + * Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
5 5 *
6 6 * Permission to use, copy, modify, and distribute this software for any
7 7 * purpose with or without fee is hereby granted, provided that the above
8 8 * copyright notice and this permission notice appear in all copies.
9 9 *
10 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
11 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
13 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 17 */
18 18 #include "config.h"
19 19
20 20 #include <sys/types.h>
21 21
22 22 #include <assert.h>
23 23 #include <ctype.h>
24 24 #include <stdio.h>
25 25 #include <stdlib.h>
26 26 #include <string.h>
27 27
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
28 28 #include "mandoc_aux.h"
29 29 #include "mandoc.h"
30 30 #include "roff.h"
31 31 #include "man.h"
32 32 #include "out.h"
33 33 #include "html.h"
34 34 #include "main.h"
35 35
36 36 /* FIXME: have PD set the default vspace width. */
37 37
38 -#define INDENT 5
39 -
40 38 #define MAN_ARGS const struct roff_meta *man, \
41 39 const struct roff_node *n, \
42 40 struct html *h
43 41
44 42 struct htmlman {
45 43 int (*pre)(MAN_ARGS);
46 44 int (*post)(MAN_ARGS);
47 45 };
48 46
49 47 static void print_bvspace(struct html *,
50 48 const struct roff_node *);
51 -static void print_man_head(MAN_ARGS);
49 +static void print_man_head(const struct roff_meta *,
50 + struct html *);
52 51 static void print_man_nodelist(MAN_ARGS);
53 52 static void print_man_node(MAN_ARGS);
54 53 static int fillmode(struct html *, int);
55 -static int a2width(const struct roff_node *,
56 - struct roffsu *);
57 54 static int man_B_pre(MAN_ARGS);
58 55 static int man_HP_pre(MAN_ARGS);
59 56 static int man_IP_pre(MAN_ARGS);
60 57 static int man_I_pre(MAN_ARGS);
61 58 static int man_OP_pre(MAN_ARGS);
62 59 static int man_PP_pre(MAN_ARGS);
63 60 static int man_RS_pre(MAN_ARGS);
64 61 static int man_SH_pre(MAN_ARGS);
65 62 static int man_SM_pre(MAN_ARGS);
66 63 static int man_SS_pre(MAN_ARGS);
67 64 static int man_UR_pre(MAN_ARGS);
68 65 static int man_alt_pre(MAN_ARGS);
69 66 static int man_ign_pre(MAN_ARGS);
70 67 static int man_in_pre(MAN_ARGS);
71 -static void man_root_post(MAN_ARGS);
72 -static void man_root_pre(MAN_ARGS);
68 +static void man_root_post(const struct roff_meta *,
69 + struct html *);
70 +static void man_root_pre(const struct roff_meta *,
71 + struct html *);
73 72
74 73 static const struct htmlman __mans[MAN_MAX - MAN_TH] = {
75 74 { NULL, NULL }, /* TH */
76 75 { man_SH_pre, NULL }, /* SH */
77 76 { man_SS_pre, NULL }, /* SS */
78 77 { man_IP_pre, NULL }, /* TP */
79 78 { man_PP_pre, NULL }, /* LP */
80 79 { man_PP_pre, NULL }, /* PP */
81 80 { man_PP_pre, NULL }, /* P */
82 81 { man_IP_pre, NULL }, /* IP */
83 82 { man_HP_pre, NULL }, /* HP */
84 83 { man_SM_pre, NULL }, /* SM */
85 84 { man_SM_pre, NULL }, /* SB */
86 85 { man_alt_pre, NULL }, /* BI */
87 86 { man_alt_pre, NULL }, /* IB */
88 87 { man_alt_pre, NULL }, /* BR */
89 88 { man_alt_pre, NULL }, /* RB */
90 89 { NULL, NULL }, /* R */
91 90 { man_B_pre, NULL }, /* B */
92 91 { man_I_pre, NULL }, /* I */
93 92 { man_alt_pre, NULL }, /* IR */
94 93 { man_alt_pre, NULL }, /* RI */
95 94 { NULL, NULL }, /* nf */
96 95 { NULL, NULL }, /* fi */
97 96 { NULL, NULL }, /* RE */
98 97 { man_RS_pre, NULL }, /* RS */
99 98 { man_ign_pre, NULL }, /* DT */
100 99 { man_ign_pre, NULL }, /* UC */
101 100 { man_ign_pre, NULL }, /* PD */
102 101 { man_ign_pre, NULL }, /* AT */
103 102 { man_in_pre, NULL }, /* in */
104 103 { man_OP_pre, NULL }, /* OP */
105 104 { NULL, NULL }, /* EX */
106 105 { NULL, NULL }, /* EE */
107 106 { man_UR_pre, NULL }, /* UR */
108 107 { NULL, NULL }, /* UE */
109 108 { man_UR_pre, NULL }, /* MT */
110 109 { NULL, NULL }, /* ME */
111 110 };
112 111 static const struct htmlman *const mans = __mans - MAN_TH;
113 112
114 113
115 114 /*
116 115 * Printing leading vertical space before a block.
117 116 * This is used for the paragraph macros.
118 117 * The rules are pretty simple, since there's very little nesting going
119 118 * on here. Basically, if we're the first within another block (SS/SH),
120 119 * then don't emit vertical space. If we are (RS), then do. If not the
121 120 * first, print it.
122 121 */
123 122 static void
124 123 print_bvspace(struct html *h, const struct roff_node *n)
125 124 {
126 125
127 126 if (n->body && n->body->child)
128 127 if (n->body->child->type == ROFFT_TBL)
129 128 return;
130 129
↓ open down ↓ |
48 lines elided |
↑ open up ↑ |
131 130 if (n->parent->type == ROFFT_ROOT || n->parent->tok != MAN_RS)
132 131 if (NULL == n->prev)
133 132 return;
134 133
135 134 print_paragraph(h);
136 135 }
137 136
138 137 void
139 138 html_man(void *arg, const struct roff_man *man)
140 139 {
141 - struct html *h;
142 - struct tag *t;
140 + struct html *h;
141 + struct roff_node *n;
142 + struct tag *t;
143 143
144 144 h = (struct html *)arg;
145 + n = man->first->child;
145 146
146 147 if ((h->oflags & HTML_FRAGMENT) == 0) {
147 148 print_gen_decls(h);
148 149 print_otag(h, TAG_HTML, "");
150 + if (n->type == ROFFT_COMMENT)
151 + print_gen_comment(h, n);
149 152 t = print_otag(h, TAG_HEAD, "");
150 - print_man_head(&man->meta, man->first, h);
153 + print_man_head(&man->meta, h);
151 154 print_tagq(h, t);
152 155 print_otag(h, TAG_BODY, "");
153 156 }
154 157
155 - man_root_pre(&man->meta, man->first, h);
158 + man_root_pre(&man->meta, h);
156 159 t = print_otag(h, TAG_DIV, "c", "manual-text");
157 - print_man_nodelist(&man->meta, man->first->child, h);
160 + print_man_nodelist(&man->meta, n, h);
158 161 print_tagq(h, t);
159 - man_root_post(&man->meta, man->first, h);
162 + man_root_post(&man->meta, h);
160 163 print_tagq(h, NULL);
161 164 }
162 165
163 166 static void
164 -print_man_head(MAN_ARGS)
167 +print_man_head(const struct roff_meta *man, struct html *h)
165 168 {
166 169 char *cp;
167 170
168 171 print_gen_head(h);
169 172 mandoc_asprintf(&cp, "%s(%s)", man->title, man->msec);
170 173 print_otag(h, TAG_TITLE, "");
171 174 print_text(h, cp);
172 175 free(cp);
173 176 }
174 177
175 178 static void
176 179 print_man_nodelist(MAN_ARGS)
177 180 {
178 181
179 182 while (n != NULL) {
180 183 print_man_node(man, n, h);
181 184 n = n->next;
182 185 }
183 186 }
184 187
185 188 static void
186 189 print_man_node(MAN_ARGS)
187 190 {
188 191 static int want_fillmode = MAN_fi;
189 192 static int save_fillmode;
190 193
191 194 struct tag *t;
192 195 int child;
193 196
194 197 /*
195 198 * Handle fill mode switch requests up front,
196 199 * they would just cause trouble in the subsequent code.
197 200 */
198 201
199 202 switch (n->tok) {
200 203 case MAN_nf:
201 204 case MAN_EX:
202 205 want_fillmode = MAN_nf;
203 206 return;
204 207 case MAN_fi:
205 208 case MAN_EE:
206 209 want_fillmode = MAN_fi;
207 210 if (fillmode(h, 0) == MAN_fi)
208 211 print_otag(h, TAG_BR, "");
209 212 return;
210 213 default:
211 214 break;
212 215 }
213 216
214 217 /* Set up fill mode for the upcoming node. */
215 218
216 219 switch (n->type) {
217 220 case ROFFT_BLOCK:
218 221 save_fillmode = 0;
219 222 /* Some block macros suspend or cancel .nf. */
220 223 switch (n->tok) {
221 224 case MAN_TP: /* Tagged paragraphs */
222 225 case MAN_IP: /* temporarily disable .nf */
223 226 case MAN_HP: /* for the head. */
224 227 save_fillmode = want_fillmode;
225 228 /* FALLTHROUGH */
226 229 case MAN_SH: /* Section headers */
227 230 case MAN_SS: /* permanently cancel .nf. */
228 231 want_fillmode = MAN_fi;
229 232 /* FALLTHROUGH */
230 233 case MAN_PP: /* These have no head. */
231 234 case MAN_LP: /* They will simply */
232 235 case MAN_P: /* reopen .nf in the body. */
233 236 case MAN_RS:
234 237 case MAN_UR:
235 238 case MAN_MT:
236 239 fillmode(h, MAN_fi);
237 240 break;
238 241 default:
239 242 break;
240 243 }
241 244 break;
242 245 case ROFFT_TBL:
243 246 fillmode(h, MAN_fi);
244 247 break;
245 248 case ROFFT_ELEM:
246 249 /*
247 250 * Some in-line macros produce tags and/or text
248 251 * in the handler, so they require fill mode to be
249 252 * configured up front just like for text nodes.
250 253 * For the others, keep the traditional approach
251 254 * of doing the same, for now.
252 255 */
253 256 fillmode(h, want_fillmode);
254 257 break;
↓ open down ↓ |
80 lines elided |
↑ open up ↑ |
255 258 case ROFFT_TEXT:
256 259 if (fillmode(h, want_fillmode) == MAN_fi &&
257 260 want_fillmode == MAN_fi &&
258 261 n->flags & NODE_LINE && *n->string == ' ' &&
259 262 (h->flags & HTML_NONEWLINE) == 0)
260 263 print_otag(h, TAG_BR, "");
261 264 if (*n->string != '\0')
262 265 break;
263 266 print_paragraph(h);
264 267 return;
268 + case ROFFT_COMMENT:
269 + return;
265 270 default:
266 271 break;
267 272 }
268 273
269 274 /* Produce output for this node. */
270 275
271 276 child = 1;
272 277 switch (n->type) {
273 278 case ROFFT_TEXT:
274 279 t = h->tag;
275 280 print_text(h, n->string);
276 281 break;
277 282 case ROFFT_EQN:
278 283 t = h->tag;
279 284 print_eqn(h, n->eqn);
280 285 break;
281 286 case ROFFT_TBL:
282 287 /*
283 288 * This will take care of initialising all of the table
284 289 * state data for the first table, then tearing it down
285 290 * for the last one.
286 291 */
287 292 print_tbl(h, n->span);
288 293 return;
289 294 default:
290 295 /*
291 296 * Close out scope of font prior to opening a macro
292 297 * scope.
293 298 */
294 299 if (HTMLFONT_NONE != h->metac) {
295 300 h->metal = h->metac;
296 301 h->metac = HTMLFONT_NONE;
297 302 }
298 303
299 304 /*
300 305 * Close out the current table, if it's open, and unset
301 306 * the "meta" table state. This will be reopened on the
302 307 * next table element.
303 308 */
304 309 if (h->tblt)
305 310 print_tblclose(h);
306 311
307 312 t = h->tag;
308 313 if (n->tok < ROFF_MAX) {
309 314 roff_html_pre(h, n);
310 315 child = 0;
311 316 break;
312 317 }
313 318
314 319 assert(n->tok >= MAN_TH && n->tok < MAN_MAX);
315 320 if (mans[n->tok].pre)
316 321 child = (*mans[n->tok].pre)(man, n, h);
317 322
318 323 /* Some block macros resume .nf in the body. */
319 324 if (save_fillmode && n->type == ROFFT_BODY)
320 325 want_fillmode = save_fillmode;
321 326
322 327 break;
323 328 }
324 329
325 330 if (child && n->child)
326 331 print_man_nodelist(man, n->child, h);
327 332
328 333 /* This will automatically close out any font scope. */
329 334 print_stagq(h, t);
330 335
331 336 if (fillmode(h, 0) == MAN_nf &&
332 337 n->next != NULL && n->next->flags & NODE_LINE)
333 338 print_endline(h);
334 339 }
335 340
336 341 /*
337 342 * MAN_nf switches to no-fill mode, MAN_fi to fill mode.
338 343 * Other arguments do not switch.
339 344 * The old mode is returned.
340 345 */
341 346 static int
342 347 fillmode(struct html *h, int want)
343 348 {
344 349 struct tag *pre;
345 350 int had;
346 351
347 352 for (pre = h->tag; pre != NULL; pre = pre->next)
348 353 if (pre->tag == TAG_PRE)
349 354 break;
350 355
351 356 had = pre == NULL ? MAN_fi : MAN_nf;
↓ open down ↓ |
77 lines elided |
↑ open up ↑ |
352 357
353 358 if (want && want != had) {
354 359 if (want == MAN_nf)
355 360 print_otag(h, TAG_PRE, "");
356 361 else
357 362 print_tagq(h, pre);
358 363 }
359 364 return had;
360 365 }
361 366
362 -static int
363 -a2width(const struct roff_node *n, struct roffsu *su)
364 -{
365 - if (n->type != ROFFT_TEXT)
366 - return 0;
367 - return a2roffsu(n->string, su, SCALE_EN) != NULL;
368 -}
369 -
370 367 static void
371 -man_root_pre(MAN_ARGS)
368 +man_root_pre(const struct roff_meta *man, struct html *h)
372 369 {
373 370 struct tag *t, *tt;
374 371 char *title;
375 372
376 373 assert(man->title);
377 374 assert(man->msec);
378 375 mandoc_asprintf(&title, "%s(%s)", man->title, man->msec);
379 376
380 377 t = print_otag(h, TAG_TABLE, "c", "head");
381 378 tt = print_otag(h, TAG_TR, "");
382 379
383 380 print_otag(h, TAG_TD, "c", "head-ltitle");
384 381 print_text(h, title);
385 382 print_stagq(h, tt);
386 383
387 384 print_otag(h, TAG_TD, "c", "head-vol");
388 385 if (NULL != man->vol)
↓ open down ↓ |
7 lines elided |
↑ open up ↑ |
389 386 print_text(h, man->vol);
390 387 print_stagq(h, tt);
391 388
392 389 print_otag(h, TAG_TD, "c", "head-rtitle");
393 390 print_text(h, title);
394 391 print_tagq(h, t);
395 392 free(title);
396 393 }
397 394
398 395 static void
399 -man_root_post(MAN_ARGS)
396 +man_root_post(const struct roff_meta *man, struct html *h)
400 397 {
401 398 struct tag *t, *tt;
402 399
403 400 t = print_otag(h, TAG_TABLE, "c", "foot");
404 401 tt = print_otag(h, TAG_TR, "");
405 402
406 403 print_otag(h, TAG_TD, "c", "foot-date");
407 404 print_text(h, man->date);
408 405 print_stagq(h, tt);
409 406
410 407 print_otag(h, TAG_TD, "c", "foot-os");
411 408 if (man->os)
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
412 409 print_text(h, man->os);
413 410 print_tagq(h, t);
414 411 }
415 412
416 413 static int
417 414 man_SH_pre(MAN_ARGS)
418 415 {
419 416 char *id;
420 417
421 418 if (n->type == ROFFT_HEAD) {
422 - id = html_make_id(n);
419 + id = html_make_id(n, 1);
423 420 print_otag(h, TAG_H1, "cTi", "Sh", id);
424 421 if (id != NULL)
425 - print_otag(h, TAG_A, "chR", "selflink", id);
426 - free(id);
422 + print_otag(h, TAG_A, "chR", "permalink", id);
427 423 }
428 424 return 1;
429 425 }
430 426
431 427 static int
432 428 man_alt_pre(MAN_ARGS)
433 429 {
434 430 const struct roff_node *nn;
435 431 int i;
436 432 enum htmltag fp;
437 433 struct tag *t;
438 434
439 435 for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
440 436 switch (n->tok) {
441 437 case MAN_BI:
442 438 fp = i % 2 ? TAG_I : TAG_B;
443 439 break;
444 440 case MAN_IB:
445 441 fp = i % 2 ? TAG_B : TAG_I;
446 442 break;
447 443 case MAN_RI:
448 444 fp = i % 2 ? TAG_I : TAG_MAX;
449 445 break;
450 446 case MAN_IR:
451 447 fp = i % 2 ? TAG_MAX : TAG_I;
452 448 break;
453 449 case MAN_BR:
454 450 fp = i % 2 ? TAG_MAX : TAG_B;
455 451 break;
456 452 case MAN_RB:
457 453 fp = i % 2 ? TAG_B : TAG_MAX;
458 454 break;
459 455 default:
460 456 abort();
461 457 }
462 458
463 459 if (i)
464 460 h->flags |= HTML_NOSPACE;
465 461
466 462 if (fp != TAG_MAX)
467 463 t = print_otag(h, fp, "");
468 464
469 465 print_text(h, nn->string);
470 466
471 467 if (fp != TAG_MAX)
472 468 print_tagq(h, t);
473 469 }
474 470 return 0;
475 471 }
476 472
477 473 static int
478 474 man_SM_pre(MAN_ARGS)
479 475 {
480 476 print_otag(h, TAG_SMALL, "");
481 477 if (MAN_SB == n->tok)
↓ open down ↓ |
45 lines elided |
↑ open up ↑ |
482 478 print_otag(h, TAG_B, "");
483 479 return 1;
484 480 }
485 481
486 482 static int
487 483 man_SS_pre(MAN_ARGS)
488 484 {
489 485 char *id;
490 486
491 487 if (n->type == ROFFT_HEAD) {
492 - id = html_make_id(n);
488 + id = html_make_id(n, 1);
493 489 print_otag(h, TAG_H2, "cTi", "Ss", id);
494 490 if (id != NULL)
495 - print_otag(h, TAG_A, "chR", "selflink", id);
496 - free(id);
491 + print_otag(h, TAG_A, "chR", "permalink", id);
497 492 }
498 493 return 1;
499 494 }
500 495
501 496 static int
502 497 man_PP_pre(MAN_ARGS)
503 498 {
504 499
505 500 if (n->type == ROFFT_HEAD)
506 501 return 0;
507 502 else if (n->type == ROFFT_BLOCK)
508 503 print_bvspace(h, n);
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
509 504
510 505 return 1;
511 506 }
512 507
513 508 static int
514 509 man_IP_pre(MAN_ARGS)
515 510 {
516 511 const struct roff_node *nn;
517 512
518 513 if (n->type == ROFFT_BODY) {
519 - print_otag(h, TAG_DD, "c", "It-tag");
514 + print_otag(h, TAG_DD, "");
520 515 return 1;
521 516 } else if (n->type != ROFFT_HEAD) {
522 517 print_otag(h, TAG_DL, "c", "Bl-tag");
523 518 return 1;
524 519 }
525 520
526 521 /* FIXME: width specification. */
527 522
528 - print_otag(h, TAG_DT, "c", "It-tag");
523 + print_otag(h, TAG_DT, "");
529 524
530 525 /* For IP, only print the first header element. */
531 526
532 527 if (MAN_IP == n->tok && n->child)
533 528 print_man_node(man, n->child, h);
534 529
535 530 /* For TP, only print next-line header elements. */
536 531
537 532 if (MAN_TP == n->tok) {
538 533 nn = n->child;
539 534 while (NULL != nn && 0 == (NODE_LINE & nn->flags))
540 535 nn = nn->next;
541 536 while (NULL != nn) {
542 537 print_man_node(man, nn, h);
↓ open down ↓ |
4 lines elided |
↑ open up ↑ |
543 538 nn = nn->next;
544 539 }
545 540 }
546 541
547 542 return 0;
548 543 }
549 544
550 545 static int
551 546 man_HP_pre(MAN_ARGS)
552 547 {
553 - struct roffsu sum, sui;
554 - const struct roff_node *np;
555 -
556 548 if (n->type == ROFFT_HEAD)
557 549 return 0;
558 - else if (n->type != ROFFT_BLOCK)
559 - return 1;
560 550
561 - np = n->head->child;
562 -
563 - if (np == NULL || !a2width(np, &sum))
564 - SCALE_HS_INIT(&sum, INDENT);
565 -
566 - sui.unit = sum.unit;
567 - sui.scale = -sum.scale;
568 -
569 - print_bvspace(h, n);
570 - print_otag(h, TAG_DIV, "csului", "Pp", &sum, &sui);
551 + if (n->type == ROFFT_BLOCK) {
552 + print_bvspace(h, n);
553 + print_otag(h, TAG_DIV, "c", "HP");
554 + }
571 555 return 1;
572 556 }
573 557
574 558 static int
575 559 man_OP_pre(MAN_ARGS)
576 560 {
577 561 struct tag *tt;
578 562
579 563 print_text(h, "[");
580 564 h->flags |= HTML_NOSPACE;
581 565 tt = print_otag(h, TAG_SPAN, "c", "Op");
582 566
583 567 if (NULL != (n = n->child)) {
584 568 print_otag(h, TAG_B, "");
585 569 print_text(h, n->string);
586 570 }
587 571
588 572 print_stagq(h, tt);
589 573
590 574 if (NULL != n && NULL != n->next) {
591 575 print_otag(h, TAG_I, "");
592 576 print_text(h, n->next->string);
593 577 }
594 578
595 579 print_stagq(h, tt);
596 580 h->flags |= HTML_NOSPACE;
597 581 print_text(h, "]");
598 582 return 0;
599 583 }
600 584
601 585 static int
602 586 man_B_pre(MAN_ARGS)
603 587 {
604 588 print_otag(h, TAG_B, "");
605 589 return 1;
606 590 }
607 591
608 592 static int
609 593 man_I_pre(MAN_ARGS)
610 594 {
611 595 print_otag(h, TAG_I, "");
612 596 return 1;
613 597 }
614 598
615 599 static int
616 600 man_in_pre(MAN_ARGS)
617 601 {
618 602 print_otag(h, TAG_BR, "");
619 603 return 0;
620 604 }
621 605
↓ open down ↓ |
41 lines elided |
↑ open up ↑ |
622 606 static int
623 607 man_ign_pre(MAN_ARGS)
624 608 {
625 609
626 610 return 0;
627 611 }
628 612
629 613 static int
630 614 man_RS_pre(MAN_ARGS)
631 615 {
632 - struct roffsu su;
633 -
634 616 if (n->type == ROFFT_HEAD)
635 617 return 0;
636 - else if (n->type == ROFFT_BODY)
637 - return 1;
638 -
639 - SCALE_HS_INIT(&su, INDENT);
640 - if (n->head->child)
641 - a2width(n->head->child, &su);
642 -
643 - print_otag(h, TAG_DIV, "sul", &su);
618 + if (n->type == ROFFT_BLOCK)
619 + print_otag(h, TAG_DIV, "c", "Bd-indent");
644 620 return 1;
645 621 }
646 622
647 623 static int
648 624 man_UR_pre(MAN_ARGS)
649 625 {
650 626 char *cp;
651 627 n = n->child;
652 628 assert(n->type == ROFFT_HEAD);
653 629 if (n->child != NULL) {
654 630 assert(n->child->type == ROFFT_TEXT);
655 631 if (n->tok == MAN_MT) {
656 632 mandoc_asprintf(&cp, "mailto:%s", n->child->string);
657 633 print_otag(h, TAG_A, "cTh", "Mt", cp);
658 634 free(cp);
659 635 } else
660 636 print_otag(h, TAG_A, "cTh", "Lk", n->child->string);
661 637 }
662 638
663 639 assert(n->next->type == ROFFT_BODY);
664 640 if (n->next->child != NULL)
665 641 n = n->next;
666 642
667 643 print_man_nodelist(man, n->child, h);
668 644
669 645 return 0;
670 646 }
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX