Updated code of FixTransitionText and FixContentText of the Content and ContentInfo classes to fix problem with Prerequisite Steps.

This commit is contained in:
Rich
2014-05-22 00:40:15 +00:00
parent f7806951c9
commit da6cc6ac3e
2 changed files with 22 additions and 12 deletions

View File

@@ -408,7 +408,7 @@ namespace Volian.Controls.Library
// (\\[^v' \\]+)* --> look for rtf commands but exclude \' before the \v
// \\v(\\[^v \\]+)* --> look for rtf commands after the \v
// if it turns out that if ro's have any embedded unicode characters this needs expanded, such as /u8209? (hard hyphen)
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>");
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>");
MatchCollection matches = Regex.Matches(text, lookFor);
string prevValue = null;
for (int i = matches.Count - 1; i >= 0; i--)
@@ -1730,8 +1730,10 @@ namespace Volian.Controls.Library
{
if (_TextAndLink != null)
{
Match m = Regex.Match(_TextAndLink, @"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:(.*?)\[END>");
return m.Groups[3].ToString();
Match m = Regex.Match(_TextAndLink, @"<START\](\\[^v \\]+)*\\v0(\\[^v'?{}~ \\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{}~ \\]+)*\\v(\\[^v \\]+)* #Link:(.*?)\[END>");
if(m.Groups[3].Value == " ")
return m.Groups[4].Value;
return m.Groups[3].Value + m.Groups[4].Value;
}
return _Text;
}
@@ -1739,9 +1741,17 @@ namespace Volian.Controls.Library
{
if (_TextAndLink != null)
{
Match m = Regex.Match(_TextAndLink, @"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:(.*?)\[END>");
System.Text.RegularExpressions.Group g = m.Groups[3];
_TextAndLink = _TextAndLink.Substring(0, g.Index) + value + _TextAndLink.Substring(g.Index + g.Length);
Match m = Regex.Match(_TextAndLink, @"<START\](\\[^v \\]+)*\\v0(\\[^v'?{}~ \\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{}~ \\]+)*\\v(\\[^v \\]+)* #Link:(.*?)\[END>");
int myIndex = m.Groups[4].Index;
int myLength = m.Groups[4].Length;
if (m.Groups[3].Value != " ")
{
myIndex = m.Groups[3].Index;
myLength += m.Groups[3].Length;
}
string gg = _TextAndLink.Substring(myIndex, myLength);
string newvalue = value.Replace("{", @"\{").Replace("}", @"\}");
_TextAndLink = _TextAndLink.Substring(0, myIndex) + newvalue + _TextAndLink.Substring(myIndex + myLength);
}
_Text = value;
}