From eca60d07f207f61da750af1a6ada4d61de97fd92 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Wed, 13 Jun 2001 07:45:41 +0000 Subject: [PATCH] - HTMLtree.h: cleanup and started evaluating the work needed on revamping the HTML output code Daniel --- ChangeLog | 5 ++++ HTMLtree.c | 71 ++++++++++++++++++------------------------------------ 2 files changed, 28 insertions(+), 48 deletions(-) diff --git a/ChangeLog b/ChangeLog index f03af1cd..9e9e32b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jun 13 09:44:15 CEST 2001 Daniel Veillard + + * HTMLtree.h: cleanup and started evaluating the work needed on + revamping the HTML output code + Mon Jun 11 19:29:40 CEST 2001 Daniel Veillard * DOCBparser.c: handling of PIs and /* for memset() only ! */ - #ifdef HAVE_CTYPE_H #include #endif @@ -182,26 +180,6 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) { */ while (cur != NULL) { if (cur->name != NULL) { -/* - if (xmlStrEqual(cur->name, BAD_CAST"html")) - break; - if (xmlStrEqual(cur->name, BAD_CAST"body")) { - if (encoding == NULL) - return(0); - meta = xmlNewDocNode(doc, NULL, BAD_CAST"head", NULL); - xmlAddPrevSibling(cur, meta); - cur = meta; - meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL); - xmlAddChild(cur, meta); - xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type"); - xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent); - return(0); - } - if (xmlStrEqual(cur->name, BAD_CAST"head")) - goto found_head; - if (xmlStrEqual(cur->name, BAD_CAST"meta")) - goto found_meta; -*/ if (xmlStrcasecmp(cur->name, BAD_CAST"html") == 0) break; if (xmlStrcasecmp(cur->name, BAD_CAST"head") == 0) @@ -220,24 +198,6 @@ htmlSetMetaEncoding(htmlDocPtr doc, const xmlChar *encoding) { */ while (cur != NULL) { if (cur->name != NULL) { -/* - if (xmlStrEqual(cur->name, BAD_CAST"head")) - break; - if (xmlStrEqual(cur->name, BAD_CAST"body")) { - if (encoding == NULL) - return(0); - meta = xmlNewDocNode(doc, NULL, BAD_CAST"head", NULL); - xmlAddPrevSibling(cur, meta); - cur = meta; - meta = xmlNewDocNode(doc, NULL, BAD_CAST"meta", NULL); - xmlAddChild(cur, meta); - xmlNewProp(meta, BAD_CAST"http-equiv", BAD_CAST"Content-Type"); - xmlNewProp(meta, BAD_CAST"content", BAD_CAST newcontent); - return(0); - } - if (xmlStrEqual(cur->name, BAD_CAST"meta")) - goto found_meta; -*/ if (xmlStrcasecmp(cur->name, BAD_CAST"head") == 0) break; if (xmlStrcasecmp(cur->name, BAD_CAST"meta") == 0) @@ -381,6 +341,12 @@ static void htmlAttrDump(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr cur) { xmlChar *value; + /* + * TODO: The html output method should not escape a & character + * occurring in an attribute value immediately followed by + * a { character (see Section B.7.1 of the HTML 4.0 Recommendation). + */ + if (cur == NULL) { xmlGenericError(xmlGenericErrorContext, "htmlAttrDump : property == NULL\n"); @@ -561,7 +527,8 @@ htmlNodeDump(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur) { } if ((cur->content == NULL) && (cur->children == NULL)) { if ((info != NULL) && (info->saveEndTag != 0) && - (strcmp(info->name, "html")) && (strcmp(info->name, "body"))) { + (xmlStrcmp(BAD_CAST info->name, BAD_CAST "html")) && + (xmlStrcmp(BAD_CAST info->name, BAD_CAST "body"))) { xmlBufferWriteChar(buf, ">"); } else { xmlBufferWriteChar(buf, ">content == NULL) && (cur->children == NULL)) { if ((info != NULL) && (info->saveEndTag != 0) && - (strcmp(info->name, "html")) && (strcmp(info->name, "body"))) { + (xmlStrcmp(BAD_CAST info->name, BAD_CAST "html")) && + (xmlStrcmp(BAD_CAST info->name, BAD_CAST "body"))) { xmlOutputBufferWriteString(buf, ">"); } else { xmlOutputBufferWriteString(buf, ">