version 1.211, 2017/05/12 17:58:21 |
version 1.214, 2017/06/14 01:31:26 |
|
|
print_encode(struct html *h, const char *p, const char *pend, int norecurse) |
print_encode(struct html *h, const char *p, const char *pend, int norecurse) |
{ |
{ |
char numbuf[16]; |
char numbuf[16]; |
size_t sz; |
struct tag *t; |
int c, len, nospace; |
|
const char *seq; |
const char *seq; |
|
size_t sz; |
|
int c, len, breakline, nospace; |
enum mandoc_esc esc; |
enum mandoc_esc esc; |
static const char rejs[9] = { '\\', '<', '>', '&', '"', |
static const char rejs[10] = { ' ', '\\', '<', '>', '&', '"', |
ASCII_NBRSP, ASCII_HYPH, ASCII_BREAK, '\0' }; |
ASCII_NBRSP, ASCII_HYPH, ASCII_BREAK, '\0' }; |
|
|
if (pend == NULL) |
if (pend == NULL) |
pend = strchr(p, '\0'); |
pend = strchr(p, '\0'); |
|
|
|
breakline = 0; |
nospace = 0; |
nospace = 0; |
|
|
while (p < pend) { |
while (p < pend) { |
Line 365 print_encode(struct html *h, const char *p, const char |
|
Line 367 print_encode(struct html *h, const char *p, const char |
|
} |
} |
|
|
for (sz = strcspn(p, rejs); sz-- && p < pend; p++) |
for (sz = strcspn(p, rejs); sz-- && p < pend; p++) |
if (*p == ' ') |
print_byte(h, *p); |
print_endword(h); |
|
else |
|
print_byte(h, *p); |
|
|
|
|
if (breakline && |
|
(p >= pend || *p == ' ' || *p == ASCII_NBRSP)) { |
|
t = print_otag(h, TAG_DIV, ""); |
|
print_text(h, "\\~"); |
|
print_tagq(h, t); |
|
breakline = 0; |
|
while (p < pend && (*p == ' ' || *p == ASCII_NBRSP)) |
|
p++; |
|
continue; |
|
} |
|
|
if (p >= pend) |
if (p >= pend) |
break; |
break; |
|
|
|
if (*p == ' ') { |
|
print_endword(h); |
|
p++; |
|
continue; |
|
} |
|
|
if (print_escape(h, *p++)) |
if (print_escape(h, *p++)) |
continue; |
continue; |
|
|
Line 417 print_encode(struct html *h, const char *p, const char |
|
Line 433 print_encode(struct html *h, const char *p, const char |
|
if (c <= 0) |
if (c <= 0) |
continue; |
continue; |
break; |
break; |
|
case ESCAPE_BREAK: |
|
breakline = 1; |
|
continue; |
case ESCAPE_NOSPACE: |
case ESCAPE_NOSPACE: |
if ('\0' == *p) |
if ('\0' == *p) |
nospace = 1; |
nospace = 1; |
Line 615 print_otag(struct html *h, enum htmltag tag, const cha |
|
Line 634 print_otag(struct html *h, enum htmltag tag, const cha |
|
a2width(arg2, su); |
a2width(arg2, su); |
if (*fmt == '+') { |
if (*fmt == '+') { |
/* Increase to make even bold text fit. */ |
/* Increase to make even bold text fit. */ |
su->scale *= 1.15; |
su->scale *= 1.2; |
/* Add padding. */ |
/* Add padding. */ |
su->scale += 3.0; |
su->scale += 3.0; |
fmt++; |
fmt++; |
Line 950 print_word(struct html *h, const char *cp) |
|
Line 969 print_word(struct html *h, const char *cp) |
|
static void |
static void |
a2width(const char *p, struct roffsu *su) |
a2width(const char *p, struct roffsu *su) |
{ |
{ |
if (a2roffsu(p, su, SCALE_MAX) < 2) { |
const char *end; |
|
|
|
end = a2roffsu(p, su, SCALE_MAX); |
|
if (end == NULL || *end != '\0') { |
su->unit = SCALE_EN; |
su->unit = SCALE_EN; |
su->scale = html_strlen(p); |
su->scale = html_strlen(p); |
} else if (su->scale < 0.0) |
} else if (su->scale < 0.0) |