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 '}': case '}':
return token; return token;
case 'v': // save link hidden info case 'v': // save link hidden info
if (Regex.IsMatch(token, @"^\\v0? ?$")) return token; // comment part of link if (token == "\\viewkind4 ") break;
// end comment may end in space or may end in '\' if another rtf command, if (Regex.IsMatch(token, @"^\\v0? ?$"))
// or may end at end of string. First check for space, keep it in string return token; // comment part of link
// if it is there. _MyLog.WarnFormat("<<<ERROR>>>\r\n==> Token including Comment not processed '{0}'", token);
//if (Regex.IsMatch(token, @"\\v0 "))
// return token;
//if (Regex.IsMatch(token, @"\\v0"))
// return token;
break; break;
case 'l': case 'l':
if (Regex.IsMatch(token, @"^\\line ?$")) return token; 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 // 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 = 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, @"[\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
@ -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 = 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, @"[\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