Update of /cvsroot/mahogany/M/src/modules/viewflt
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13295/src/modules/viewflt
Modified Files:
QuoteURL.cpp
Log Message:
more tweaks to quoted lines detection: don't detect as quoted lines immediately
following the end of a quoted paragraph; do detect as quoted wrapped tails of lines in
between 2 quoted lines
Index: QuoteURL.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/viewflt/QuoteURL.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -b -u -2 -r1.17 -r1.18
--- QuoteURL.cpp 2 Aug 2004 09:53:16 -0000 1.17
+++ QuoteURL.cpp 8 Sep 2004 20:44:34 -0000 1.18
@@ -285,7 +285,5 @@
// quoted if it starts with a special quoting character and if the
// next lines starts with the same prefix as well or is blank and if the
- // previous line isn't similar to but not the same as this one (this is
- // necessary to catch last line in a numbered list which would otherwise
- // be considered quoted)
+ // previous line is similar to but not the same as this one
// first check if we have a quote character at all
@@ -295,5 +293,27 @@
break;
- // next check if the next line has the same prefix
+ // check the previous line: if it was the same so far but differs now, we
+ // suppose that we have a numbered list which would be recognized as
+ // quotation by the code below, so deal with it first
+ if ( sameAsPrev == Line_Same && *prev != *c )
+ {
+ break;
+ }
+ //else: it's either identical or completely different, both are fine
+
+ // if this line has the same prefix as the previous one, it surely must
+ // be a continuation of a quoted paragraph
+ // checks in case this is not true
+ bool isQuoted = (sameAsPrev == Line_Unknown || sameAsPrev == Line_Same)
+ && *prev == *c;
+
+ // next check the next line
+ if ( !isQuoted && sameAsNext == Line_Blank )
+ {
+ // previous line not quoted and next one neither -- so suppose this
+ // one is a misdetection
+ break;
+ }
+
if ( sameAsNext != Line_Different )
{
@@ -319,7 +339,18 @@
// as this has a lot of potential for false positives, only do it for
// the most common quoting character
- if ( !nextStart || *c != '>' )
+ if ( !isQuoted && (!nextStart || *c != '>') )
break;
+ // empty or very short lines shouldn't be wrapped: this catches a
+ // not uncommon case of
+ //
+ // > 111
+ // >
+ // 333
+ //
+ // where "333" would otherwise have been recognized as wrapped
+ // quotation
+ if ( next - string > 10 )
+ {
const char *nextnext = strchr(nextStart + 1 /* skip '\n' */, '\n');
if ( !nextnext ||
@@ -330,18 +361,20 @@
// this one so it's improbable that the next line was garbled
// because of quoting -- chances are this line is simply not
- // quoted at all
+ // quoted at all unless we had already recognized it such
+ if ( !isQuoted )
break;
}
-
+ else
+ {
// it does look like the next line is wrapped tail of this one
*nextWrapped = true;
+
+ isQuoted = true;
+ }
}
- // finally check the previous line
- if ( sameAsPrev == Line_Same && *prev != *c )
- {
+ if ( !isQuoted )
break;
}
- //else: it's either identical or completely different, both are fine
levels++;
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates