This commit is contained in:
parent
ec19a07277
commit
fe8b388b1b
@ -471,7 +471,8 @@ namespace Volian.Controls.Library
|
|||||||
Console.WriteLine("Save Failed because text changed outside of this edit session.");
|
Console.WriteLine("Save Failed because text changed outside of this edit session.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
string modtext = RtfToDbText(rtb.Rtf);
|
string modtext = RtfToDbText(rtb.Rtf).Replace("<BackSlash>", "\\\\");
|
||||||
|
|
||||||
// if there are links, we'll need to do extra processing to see if
|
// if there are links, we'll need to do extra processing to see if
|
||||||
// there were additions, deletions or modifications.
|
// there were additions, deletions or modifications.
|
||||||
bool haslinks = ((modtext.IndexOf(@"<START]") > -1) || (OriginalText != null && OriginalText != "" && OriginalText.IndexOf(@"<START]") > -1));
|
bool haslinks = ((modtext.IndexOf(@"<START]") > -1) || (OriginalText != null && OriginalText != "" && OriginalText.IndexOf(@"<START]") > -1));
|
||||||
@ -814,6 +815,8 @@ namespace Volian.Controls.Library
|
|||||||
string token = m.Groups[1].Value;
|
string token = m.Groups[1].Value;
|
||||||
switch (token[1])
|
switch (token[1])
|
||||||
{
|
{
|
||||||
|
case '\\':
|
||||||
|
return token;
|
||||||
case 'u':
|
case 'u':
|
||||||
if (Regex.IsMatch(token, @"^\\u[0-9]+$"))
|
if (Regex.IsMatch(token, @"^\\u[0-9]+$"))
|
||||||
return token; // Special Charcaters
|
return token; // Special Charcaters
|
||||||
@ -877,39 +880,9 @@ namespace Volian.Controls.Library
|
|||||||
string retval = rtf.Replace(@"\{", @"(![");
|
string retval = rtf.Replace(@"\{", @"(![");
|
||||||
retval = retval.Replace(@"\}", @"(!]");
|
retval = retval.Replace(@"\}", @"(!]");
|
||||||
|
|
||||||
//// remove carriage return/newlines after \par commands (these are introduced by rtb
|
|
||||||
//// for hard returns, goes into rtb as \par and comes out as \par\r\n):
|
|
||||||
//retval = Regex.Replace(retval, @"\\par\r\n([^\\.*?])", "\\par $1");
|
|
||||||
//retval = Regex.Replace(retval, @"\\par\r\n([\\.*?])", "\\par$1");
|
|
||||||
|
|
||||||
// remove carriage return/newlines after \par commands (these are introduced by rtb
|
// remove carriage return/newlines after \par commands (these are introduced by rtb
|
||||||
// for hard returns, goes into rtb as \par and comes out as \par\r\n):
|
// for hard returns, goes into rtb as \par and comes out as \par\r\n):
|
||||||
retval = Regex.Replace(retval, @"\\par\r\n(?!\\)", "\\par ");
|
retval = Regex.Replace(retval, @"\\par\r\n(?!\\)", "\\par ");
|
||||||
|
|
||||||
//retval = Regex.Replace(retval, @"[\r\n]", "", RegexOptions.Singleline); // Strip Carriage Returns and Newlines
|
|
||||||
//retval = Regex.Replace(retval, @"^\{(.*)\}$", "$1", RegexOptions.Singleline); // Strip Opening and Closing Braces
|
|
||||||
//retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
|
||||||
//retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
|
||||||
//retval = Regex.Replace(retval, @"(\\[^ \\?\r\n\t]+)\\f[0-9] ", "$1 "); // remove font command - if next to another command, keep other command and space
|
|
||||||
//// OLD: The following two lines are replaced by the more generic replace above.
|
|
||||||
////retval = Regex.Replace(retval, @"\\v\\f[0-9] ", "\\v "); // remove font command - if next to Comment keep space
|
|
||||||
////retval = Regex.Replace(retval, @"\\line\\f[0-9] ", "\\line "); // remove font command - if next to Line keep space
|
|
||||||
//retval = Regex.Replace(retval, @"\\f[0-9] ", ""); // remove font command with ending space
|
|
||||||
//retval = Regex.Replace(retval, @"\\f[0-9]", ""); // remove font command without ending space
|
|
||||||
//retval = Regex.Replace(retval, @"\\par ", "\r\n");
|
|
||||||
//retval = Regex.Replace(retval, @"\\[^ \\?\r\n\t]+", new MatchEvaluator(ReplaceRTFClause)); // take backslash xyz and evaluates them
|
|
||||||
//// remove a space if there is one as the first character or the last character
|
|
||||||
//if (retval[0] == ' ') retval = retval.Remove(0, 1);
|
|
||||||
//retval = retval.TrimEnd(' ');
|
|
||||||
//// remove \r\n at end of string if the string has 2 or more characters
|
|
||||||
//if (retval.Length > 1 && retval.Substring(retval.Length - 2, 2) == "\r\n") retval = retval.Remove(retval.Length - 2, 2);
|
|
||||||
//// remove \par at end of string if the string has 4 or more characters
|
|
||||||
//if (retval.Length > 3 && retval.Substring(retval.Length - 4, 4) == @"\par") retval = retval.Remove(retval.Length - 4, 4);
|
|
||||||
//// remove a space following \r\n
|
|
||||||
//retval = Regex.Replace(retval, "\r\n ", "\r\n");
|
|
||||||
////if there are still spaces following \r\n, then probable in a table - we need to put the space back
|
|
||||||
//retval = Regex.Replace(retval, "\r\n ", "\r\n ");
|
|
||||||
|
|
||||||
retval = Regex.Replace(retval, @"[\r\n]", "", RegexOptions.Singleline); // Strip Carriage Returns and Newlines
|
retval = Regex.Replace(retval, @"[\r\n]", "", RegexOptions.Singleline); // Strip Carriage Returns and Newlines
|
||||||
retval = Regex.Replace(retval, @"^\{(.*)\}$", "$1", RegexOptions.Singleline); // Strip Opening and Closing Braces
|
retval = Regex.Replace(retval, @"^\{(.*)\}$", "$1", RegexOptions.Singleline); // Strip Opening and Closing Braces
|
||||||
retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces
|
||||||
|
Loading…
x
Reference in New Issue
Block a user