From 392265358af2ee867123ae0a2988131da785ea7a Mon Sep 17 00:00:00 2001 From: hns Date: Mon, 6 Sep 2004 14:43:00 +0000 Subject: [PATCH] Recognize tags in HTML formatter --- src/helma/util/HtmlEncoder.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/helma/util/HtmlEncoder.java b/src/helma/util/HtmlEncoder.java index e6d559d9..2358f4a7 100644 --- a/src/helma/util/HtmlEncoder.java +++ b/src/helma/util/HtmlEncoder.java @@ -467,11 +467,14 @@ public final class HtmlEncoder { insideMacroTag = insideTag = true; macroQuoteChar = '\u0000'; } - } else if (('!' == str.charAt(i + 1)) && ('-' == str.charAt(i + 2))) { - // the beginning of an HTML comment? + } else if ('!' == str.charAt(i + 1)) { + // the beginning of an HTML comment or !doctype? if (!insideCodeTag) { - insideComment = insideTag = ((i < (l - 3)) && - ('-' == str.charAt(i + 3))); + if (str.regionMatches(i + 2, "--", 0, 2)) { + insideComment = insideTag = true; + } else if (str.regionMatches(true, i+2, "doctype", 0, 7)) { + insideHtmlTag = insideTag = true; + } } } else if (!insideTag) { // check if this is a HTML tag.