Fixed logic to properly handle curly braces next to links (Transitions or Referenced Objects)

This commit is contained in:
Rich 2014-03-27 14:07:15 +00:00
parent 8c9b73902c
commit 00b6045076

View File

@ -1003,14 +1003,10 @@ namespace Volian.Controls.Library
case '}':
return token;
case 'v': // save link hidden info
if (Regex.IsMatch(token, @"^\\v0? ?$")) return token; // comment part of link
// end comment may end in space or may end in '\' if another rtf command,
// or may end at end of string. First check for space, keep it in string
// if it is there.
//if (Regex.IsMatch(token, @"\\v0 "))
// return token;
//if (Regex.IsMatch(token, @"\\v0"))
// return token;
if (token == "\\viewkind4 ") break;
if (Regex.IsMatch(token, @"^\\v0? ?$"))
return token; // comment part of link
_MyLog.WarnFormat("<<<ERROR>>>\r\n==> Token including Comment not processed '{0}'", token);
break;
case 'l':
if (Regex.IsMatch(token, @"^\\line ?$")) return token;
@ -1044,6 +1040,7 @@ namespace Volian.Controls.Library
// 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 ");
retval = retval.Replace("\\v0\r\n", "\\v0 "); // Replace Carriage Return and Newline after comment
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
@ -1083,6 +1080,7 @@ namespace Volian.Controls.Library
retval = Regex.Replace(retval, @"\\par\r\n(?!\\)", "\\par ");
//retval = Regex.Replace(retval, @"\\par\r\n(?=\\)", "\\par");
retval = retval.Replace("\\v0\r\n", "\\v0 "); // Replace Carriage Return and Newline after comment
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