version 1.76, 2009/11/01 07:44:32 |
version 1.81, 2009/11/05 10:16:01 |
Line 270 print_escape(struct html *h, const char **p) |
|
Line 270 print_escape(struct html *h, const char **p) |
|
return; |
return; |
} |
} |
|
|
switch (*wp) { |
/* |
case ('B'): |
* These aren't supported, as they're symmetry-breaking |
/* TODO */ |
* constructs that don't play well with hierarchical |
break; |
* mark-up. Consider: |
case ('I'): |
* |
/* TODO */ |
* \fBHello. |
break; |
* .PP |
case ('P'): |
* World. |
/* FALLTHROUGH */ |
* |
case ('R'): |
* The style started before "Hello" wouldn't be able to |
/* TODO */ |
* propogate into the next `PP' because we'd exit the |
break; |
* current paragraph's scope. |
default: |
*/ |
break; |
|
} |
|
|
|
*p = wp; |
*p = wp; |
return; |
return; |
Line 316 print_escape(struct html *h, const char **p) |
|
Line 314 print_escape(struct html *h, const char **p) |
|
static void |
static void |
print_encode(struct html *h, const char *p) |
print_encode(struct html *h, const char *p) |
{ |
{ |
|
size_t sz; |
|
|
for (; *p; p++) { |
for (; *p; p++) { |
|
sz = strcspn(p, "\\<>&"); |
|
|
|
fwrite(p, 1, sz, stdout); |
|
p += /* LINTED */ |
|
sz; |
|
|
if ('\\' == *p) { |
if ('\\' == *p) { |
print_escape(h, &p); |
print_escape(h, &p); |
continue; |
continue; |
} |
} else if ('\0' == *p) |
switch (*p) { |
|
case ('<'): |
|
printf("<"); |
|
break; |
break; |
case ('>'): |
|
|
if ('<' == *p) |
|
printf("<"); |
|
else if ('>' == *p) |
printf(">"); |
printf(">"); |
break; |
else if ('&' == *p) |
case ('&'): |
|
printf("&"); |
printf("&"); |
break; |
|
default: |
|
putchar(*p); |
|
break; |
|
} |
|
} |
} |
} |
} |
|
|
Line 361 print_otag(struct html *h, enum htmltag tag, |
|
Line 360 print_otag(struct html *h, enum htmltag tag, |
|
|
|
if ( ! (HTML_NOSPACE & h->flags)) |
if ( ! (HTML_NOSPACE & h->flags)) |
if ( ! (HTML_CLRLINE & htmltags[tag].flags)) |
if ( ! (HTML_CLRLINE & htmltags[tag].flags)) |
printf(" "); |
putchar(' '); |
|
|
printf("<%s", htmltags[tag].name); |
printf("<%s", htmltags[tag].name); |
for (i = 0; i < sz; i++) { |
for (i = 0; i < sz; i++) { |
printf(" %s=\"", htmlattrs[p[i].key]); |
printf(" %s=\"", htmlattrs[p[i].key]); |
assert(p->val); |
assert(p->val); |
print_encode(h, p[i].val); |
print_encode(h, p[i].val); |
printf("\""); |
putchar('\"'); |
} |
} |
printf(">"); |
putchar('>'); |
|
|
h->flags |= HTML_NOSPACE; |
h->flags |= HTML_NOSPACE; |
if (HTML_CLRLINE & htmltags[tag].flags) |
if (HTML_CLRLINE & htmltags[tag].flags) |
Line 391 print_ctag(struct html *h, enum htmltag tag) |
|
Line 390 print_ctag(struct html *h, enum htmltag tag) |
|
if (HTML_CLRLINE & htmltags[tag].flags) { |
if (HTML_CLRLINE & htmltags[tag].flags) { |
h->flags |= HTML_NOSPACE; |
h->flags |= HTML_NOSPACE; |
h->flags |= HTML_NEWLINE; |
h->flags |= HTML_NEWLINE; |
printf("\n"); |
putchar('\n'); |
} else |
} else |
h->flags &= ~HTML_NEWLINE; |
h->flags &= ~HTML_NEWLINE; |
} |
} |
Line 437 print_text(struct html *h, const char *p) |
|
Line 436 print_text(struct html *h, const char *p) |
|
} |
} |
|
|
if ( ! (h->flags & HTML_NOSPACE)) |
if ( ! (h->flags & HTML_NOSPACE)) |
printf(" "); |
putchar(' '); |
|
|
h->flags &= ~HTML_NOSPACE; |
h->flags &= ~HTML_NOSPACE; |
h->flags &= ~HTML_NEWLINE; |
h->flags &= ~HTML_NEWLINE; |