diff -ur C:\FGCVS\tidy\src\istack.c tidycvs04\src\istack.c
--- C:\FGCVS\tidy\src\istack.c Fri Dec 29 17:31:08 2006
+++ tidycvs04\src\istack.c Wed Apr 16 15:21:30 2008
@@ -288,13 +288,13 @@
return node;
}
-
/*
We have two CM_INLINE elements pushed ... the first is closing,
but, like the browser, the second should be retained ...
Like bold bold and italics italics only
This function switches the tag positions on the stack,
- returning 'yes' if both were found in the expected order.
+ returning 'yes' if both were found,
+ and swaps them if in the expected order.
*/
Bool TY_(SwitchInline)( TidyDocImpl* doc, Node* element, Node* node )
{
@@ -306,7 +306,7 @@
&& TY_(IsPushed)( doc, node )
&& ((lexer->istacksize - lexer->istackbase) >= 2) )
{
- /* we have a chance of succeeding ... */
+ /* we have every chance of succeeding ... */
int i;
for (i = (lexer->istacksize - lexer->istackbase - 1); i >= 0; --i)
{
@@ -326,12 +326,12 @@
}
if ( istack2 )
{
- /* perform the swap */
+ /* perform the swap if in expected order */
IStack tmp_istack = *istack2;
*istack2 = *istack1;
*istack1 = tmp_istack;
- return yes;
}
+ return yes; /* and return success in any case */
}
}
}
diff -ur C:\FGCVS\tidy\src\localize.c tidycvs04\src\localize.c
--- C:\FGCVS\tidy\src\localize.c Wed Nov 14 21:15:06 2007
+++ tidycvs04\src\localize.c Wed Apr 16 15:34:07 2008
@@ -119,6 +119,7 @@
{ MISSING_ENDTAG_BEFORE, "missing %s> before %s" }, /* Error */
{ DISCARDING_UNEXPECTED, "discarding unexpected %s" }, /* Error */
{ NON_MATCHING_ENDTAG, "replacing unexpected %s by %s>" }, /* Error */
+ { REPLACE_UNEXPECTED, "replacing unexpected %s> by %s>" }, /* Error */
{ TAG_NOT_ALLOWED_IN, "%s isn't allowed in <%s> elements" }, /* Error */
{ MISSING_STARTTAG, "missing <%s>" }, /* Error */
{ UNEXPECTED_ENDTAG, "unexpected %s>" }, /* Error */
@@ -1478,6 +1479,10 @@
case COERCE_TO_ENDTAG:
case NON_MATCHING_ENDTAG:
messageNode(doc, TidyWarning, rpt, fmt, node->element, node->element);
+ break;
+
+ case REPLACE_UNEXPECTED:
+ messageNode(doc, TidyWarning, rpt, fmt, node->element, rpt->element);
break;
case UNEXPECTED_ENDTAG_IN:
diff -ur C:\FGCVS\tidy\src\message.h tidycvs04\src\message.h
--- C:\FGCVS\tidy\src\message.h Wed May 30 18:47:31 2007
+++ tidycvs04\src\message.h Wed Apr 16 15:34:07 2008
@@ -121,6 +121,7 @@
#define REPLACING_ELEMENT 83
#define REPLACING_UNEX_ELEMENT 84
#define COERCE_TO_ENDTAG_WARN 85
+#define REPLACE_UNEXPECTED 88
/* error codes used for attribute messages */
@@ -160,7 +161,7 @@
#define MISSING_ATTRIBUTE 86
#define WHITE_IN_URI 87
-#define PREVIOUS_LOCATION 88 /* last */
+#define PREVIOUS_LOCATION 89 /* last */
/* character encoding errors */
diff -ur C:\FGCVS\tidy\src\parser.c tidycvs04\src\parser.c
--- C:\FGCVS\tidy\src\parser.c Sat Mar 29 13:59:11 2008
+++ tidycvs04\src\parser.c Wed Apr 16 15:34:07 2008
@@ -1530,7 +1530,7 @@
bold bold and italic italics */
if ( TY_(SwitchInline)( doc, element, node ) )
{
- TY_(ReportError)(doc, element, node, NON_MATCHING_ENDTAG);
+ TY_(ReportError)(doc, element, node, REPLACE_UNEXPECTED);
TY_(UngetToken)( doc ); /* put this back */
TY_(InlineDup1)( doc, NULL, element ); /* dupe the , after */
if (!(mode & Preformatted))