version 1.151, 2012/05/31 22:29:13 |
version 1.155, 2014/03/23 11:25:26 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2011, 2012 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
|
|
#include <unistd.h> |
#include <unistd.h> |
|
|
#include "mandoc.h" |
#include "mandoc.h" |
|
#include "mandoc_aux.h" |
#include "libmandoc.h" |
#include "libmandoc.h" |
#include "out.h" |
#include "out.h" |
#include "html.h" |
#include "html.h" |
Line 235 print_metaf(struct html *h, enum mandoc_esc deco) |
|
Line 236 print_metaf(struct html *h, enum mandoc_esc deco) |
|
case (ESCAPE_FONTBOLD): |
case (ESCAPE_FONTBOLD): |
font = HTMLFONT_BOLD; |
font = HTMLFONT_BOLD; |
break; |
break; |
|
case (ESCAPE_FONTBI): |
|
font = HTMLFONT_BI; |
|
break; |
case (ESCAPE_FONT): |
case (ESCAPE_FONT): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case (ESCAPE_FONTROMAN): |
case (ESCAPE_FONTROMAN): |
Line 253 print_metaf(struct html *h, enum mandoc_esc deco) |
|
Line 257 print_metaf(struct html *h, enum mandoc_esc deco) |
|
h->metal = h->metac; |
h->metal = h->metac; |
h->metac = font; |
h->metac = font; |
|
|
if (HTMLFONT_NONE != font) |
switch (font) { |
h->metaf = HTMLFONT_BOLD == font ? |
case (HTMLFONT_ITALIC): |
print_otag(h, TAG_B, 0, NULL) : |
h->metaf = print_otag(h, TAG_I, 0, NULL); |
print_otag(h, TAG_I, 0, NULL); |
break; |
|
case (HTMLFONT_BOLD): |
|
h->metaf = print_otag(h, TAG_B, 0, NULL); |
|
break; |
|
case (HTMLFONT_BI): |
|
h->metaf = print_otag(h, TAG_B, 0, NULL); |
|
print_otag(h, TAG_I, 0, NULL); |
|
break; |
|
default: |
|
break; |
|
} |
} |
} |
|
|
int |
int |
Line 318 print_encode(struct html *h, const char *p, int norecu |
|
Line 332 print_encode(struct html *h, const char *p, int norecu |
|
int c, len, nospace; |
int c, len, nospace; |
const char *seq; |
const char *seq; |
enum mandoc_esc esc; |
enum mandoc_esc esc; |
static const char rejs[6] = { '\\', '<', '>', '&', ASCII_HYPH, '\0' }; |
static const char rejs[8] = { '\\', '<', '>', '&', |
|
ASCII_NBRSP, ASCII_HYPH, ASCII_BREAK, '\0' }; |
|
|
nospace = 0; |
nospace = 0; |
|
|
Line 347 print_encode(struct html *h, const char *p, int norecu |
|
Line 362 print_encode(struct html *h, const char *p, int norecu |
|
case ('&'): |
case ('&'): |
printf("&"); |
printf("&"); |
continue; |
continue; |
|
case (ASCII_NBRSP): |
|
putchar('-'); |
|
continue; |
case (ASCII_HYPH): |
case (ASCII_HYPH): |
putchar('-'); |
putchar('-'); |
|
/* FALLTHROUGH */ |
|
case (ASCII_BREAK): |
continue; |
continue; |
default: |
default: |
break; |
break; |
Line 367 print_encode(struct html *h, const char *p, int norecu |
|
Line 387 print_encode(struct html *h, const char *p, int norecu |
|
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
case (ESCAPE_FONTITALIC): |
case (ESCAPE_FONTITALIC): |
/* FALLTHROUGH */ |
/* FALLTHROUGH */ |
|
case (ESCAPE_FONTBI): |
|
/* FALLTHROUGH */ |
case (ESCAPE_FONTROMAN): |
case (ESCAPE_FONTROMAN): |
if (0 == norecurse) |
if (0 == norecurse) |
print_metaf(h, esc); |
print_metaf(h, esc); |
Line 544 print_text(struct html *h, const char *word) |
|
Line 566 print_text(struct html *h, const char *word) |
|
} |
} |
|
|
assert(NULL == h->metaf); |
assert(NULL == h->metaf); |
if (HTMLFONT_NONE != h->metac) |
switch (h->metac) { |
h->metaf = HTMLFONT_BOLD == h->metac ? |
case (HTMLFONT_ITALIC): |
print_otag(h, TAG_B, 0, NULL) : |
h->metaf = print_otag(h, TAG_I, 0, NULL); |
print_otag(h, TAG_I, 0, NULL); |
break; |
|
case (HTMLFONT_BOLD): |
|
h->metaf = print_otag(h, TAG_B, 0, NULL); |
|
break; |
|
case (HTMLFONT_BI): |
|
h->metaf = print_otag(h, TAG_B, 0, NULL); |
|
print_otag(h, TAG_I, 0, NULL); |
|
break; |
|
default: |
|
break; |
|
} |
|
|
assert(word); |
assert(word); |
if ( ! print_encode(h, word, 0)) { |
if ( ! print_encode(h, word, 0)) { |
Line 697 buffmt_man(struct html *h, |
|
Line 729 buffmt_man(struct html *h, |
|
bufcat(h, sec ? sec : "1"); |
bufcat(h, sec ? sec : "1"); |
break; |
break; |
case('N'): |
case('N'): |
bufcat_fmt(h, name); |
bufcat_fmt(h, "%s", name); |
break; |
break; |
default: |
default: |
bufncat(h, p, 2); |
bufncat(h, p, 2); |