version 1.242, 2018/10/25 01:32:40 |
version 1.245, 2018/12/04 18:29:38 |
|
|
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]; |
struct tag *t; |
|
const char *seq; |
const char *seq; |
size_t sz; |
size_t sz; |
int c, len, breakline, nospace; |
int c, len, breakline, nospace; |
Line 383 print_encode(struct html *h, const char *p, const char |
|
Line 382 print_encode(struct html *h, const char *p, const char |
|
|
|
if (breakline && |
if (breakline && |
(p >= pend || *p == ' ' || *p == ASCII_NBRSP)) { |
(p >= pend || *p == ' ' || *p == ASCII_NBRSP)) { |
t = print_otag(h, TAG_DIV, ""); |
print_otag(h, TAG_BR, ""); |
print_text(h, "\\~"); |
|
print_tagq(h, t); |
|
breakline = 0; |
breakline = 0; |
while (p < pend && (*p == ' ' || *p == ASCII_NBRSP)) |
while (p < pend && (*p == ' ' || *p == ASCII_NBRSP)) |
p++; |
p++; |
Line 416 print_encode(struct html *h, const char *p, const char |
|
Line 413 print_encode(struct html *h, const char *p, const char |
|
case ESCAPE_FONTBI: |
case ESCAPE_FONTBI: |
case ESCAPE_FONTCW: |
case ESCAPE_FONTCW: |
case ESCAPE_FONTROMAN: |
case ESCAPE_FONTROMAN: |
if (0 == norecurse) |
if (0 == norecurse) { |
|
h->flags |= HTML_NOSPACE; |
print_metaf(h, esc); |
print_metaf(h, esc); |
|
h->flags &= ~HTML_NOSPACE; |
|
} |
continue; |
continue; |
case ESCAPE_SKIPCHAR: |
case ESCAPE_SKIPCHAR: |
h->flags |= HTML_SKIPCHAR; |
h->flags |= HTML_SKIPCHAR; |
Line 520 print_otag(struct html *h, enum htmltag tag, const cha |
|
Line 520 print_otag(struct html *h, enum htmltag tag, const cha |
|
struct tag *t; |
struct tag *t; |
const char *attr; |
const char *attr; |
char *arg1, *arg2; |
char *arg1, *arg2; |
int tflags; |
int style_written, tflags; |
|
|
tflags = htmltags[tag].flags; |
tflags = htmltags[tag].flags; |
|
|
Line 560 print_otag(struct html *h, enum htmltag tag, const cha |
|
Line 560 print_otag(struct html *h, enum htmltag tag, const cha |
|
|
|
va_start(ap, fmt); |
va_start(ap, fmt); |
|
|
while (*fmt != '\0') { |
while (*fmt != '\0' && *fmt != 's') { |
|
|
/* Parse attributes and arguments. */ |
/* Parse attributes and arguments. */ |
|
|
Line 576 print_otag(struct html *h, enum htmltag tag, const cha |
|
Line 576 print_otag(struct html *h, enum htmltag tag, const cha |
|
case 'i': |
case 'i': |
attr = "id"; |
attr = "id"; |
break; |
break; |
case 's': |
|
attr = "style"; |
|
arg2 = va_arg(ap, char *); |
|
break; |
|
case '?': |
case '?': |
attr = arg1; |
attr = arg1; |
arg1 = va_arg(ap, char *); |
arg1 = va_arg(ap, char *); |
Line 619 print_otag(struct html *h, enum htmltag tag, const cha |
|
Line 615 print_otag(struct html *h, enum htmltag tag, const cha |
|
fmt++; |
fmt++; |
break; |
break; |
default: |
default: |
if (arg2 == NULL) |
print_encode(h, arg1, NULL, 1); |
print_encode(h, arg1, NULL, 1); |
|
else { |
|
print_word(h, arg1); |
|
print_byte(h, ':'); |
|
print_byte(h, ' '); |
|
print_word(h, arg2); |
|
print_byte(h, ';'); |
|
} |
|
break; |
break; |
} |
} |
print_byte(h, '"'); |
print_byte(h, '"'); |
} |
} |
|
|
|
style_written = 0; |
|
while (*fmt++ == 's') { |
|
arg1 = va_arg(ap, char *); |
|
arg2 = va_arg(ap, char *); |
|
if (arg2 == NULL) |
|
continue; |
|
print_byte(h, ' '); |
|
if (style_written == 0) { |
|
print_word(h, "style=\""); |
|
style_written = 1; |
|
} |
|
print_word(h, arg1); |
|
print_byte(h, ':'); |
|
print_byte(h, ' '); |
|
print_word(h, arg2); |
|
print_byte(h, ';'); |
|
} |
|
if (style_written) |
|
print_byte(h, '"'); |
|
|
va_end(ap); |
va_end(ap); |
|
|
/* Accommodate for "well-formed" singleton escaping. */ |
/* Accommodate for "well-formed" singleton escaping. */ |