$Log$
+ Revision 621.6 2004/06/03 02:49:14 ajc
+ * html.c: allow parsing of tags even when they're qualified (i.e. <TAG foo=bar>
+ instead of just <TAG> )
+ * html.c: handle escaped decimal characters (such as ' for an apostrophe)
+
Revision 621.5 2004/06/03 02:28:16 ajc
* citadel_ipc.c: SETR command was missing defaultview and flags2. Added.
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
char *outptr;
size_t outptr_buffer_size;
size_t output_len = 0;
- int i, j, ch, did_out, rb;
+ int i, j, ch, did_out, rb, scanch;
int nest = 0; /* Bracket nesting level */
inptr = inputmsg;
strcpy(tag, "");
}
- else if (ch == '>') {
+ else if (ch == '>') { /* We have a tag. */
if (nest > 0) --nest;
+
+ /* Unqualify the tag (truncate at first space) */
+ if (strchr(tag, ' ') != NULL) {
+ strcpy(strchr(tag, ' '), "");
+ }
if (!strcasecmp(tag, "P")) {
strcat(outbuf, "\n\n");
strcpy(&outbuf[i+3], &outbuf[i+5]);
}
+ /* two-digit decimal equivalents */
+ else if ((!strncmp(&outbuf[i], "&#", 2))
+ && (outbuf[i+4] == ';') ) {
+ scanch = 0;
+ sscanf(&outbuf[i+2], "%02d", &scanch);
+ outbuf[i] = scanch;
+ strcpy(&outbuf[i+1], &outbuf[i+5]);
+ }
+
+ /* three-digit decimal equivalents */
+ else if ((!strncmp(&outbuf[i], "&#", 2))
+ && (outbuf[i+5] == ';') ) {
+ scanch = 0;
+ sscanf(&outbuf[i+2], "%03d", &scanch);
+ outbuf[i] = scanch;
+ strcpy(&outbuf[i+1], &outbuf[i+6]);
+ }
+
}
/* Make sure the output buffer is big enough */