Tentatively fixed #424: Phase3 special tags can now be used inside snippets.

This commit is contained in:
Dario Solera 2009-11-28 15:15:09 +00:00
parent 826877c72e
commit 800fd8fb79
2 changed files with 20 additions and 10 deletions

View file

@ -16,5 +16,5 @@ using System.Reflection;
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("3.0.1.438")]
[assembly: AssemblyFileVersion("3.0.1.438")]
[assembly: AssemblyVersion("3.0.1.439")]
[assembly: AssemblyFileVersion("3.0.1.439")]

View file

@ -805,10 +805,17 @@ namespace ScrewTurn.Wiki {
firstClosedAfterLastOpen = balanced.IndexOf("}", lastOpen + 1);
if(firstClosedAfterLastOpen <= lastOpen) break; // Give up
string internalSnippet = balanced.Substring(lastOpen, firstClosedAfterLastOpen - lastOpen + 1);
balanced = balanced.Remove(lastOpen, firstClosedAfterLastOpen - lastOpen + 1);
// This check allows to ignore special tags (especially Phase3)
if(!internalSnippet.ToLowerInvariant().StartsWith("{s:")) {
internalSnippet = internalSnippet.Replace("{", "$$$$$$$$OPEN$$$$$$$$").Replace("}", "$$$$$$$$CLOSE$$$$$$$$");
balanced = balanced.Insert(lastOpen, internalSnippet);
continue;
}
string formattedInternalSnippet = FormatSnippet(internalSnippet, tocString);
string[] temp;
formattedInternalSnippet = Format(formattedInternalSnippet, forIndexing, context, current, out temp, bareBones).Trim('\n');
@ -817,7 +824,7 @@ namespace ScrewTurn.Wiki {
balanced = balanced.Insert(lastOpen, formattedInternalSnippet);
} while(lastOpen != -1);
sb.Insert(match.Index, balanced);
sb.Insert(match.Index, balanced.Replace("$$$$$$$$OPEN$$$$$$$$", "{").Replace("$$$$$$$$CLOSE$$$$$$$$", "}"));
}
}
ComputeNoWiki(sb.ToString(), ref noWikiBegin, ref noWikiEnd);
@ -1316,13 +1323,16 @@ namespace ScrewTurn.Wiki {
string bigString = sb.ToString();
do {
int dummy = bigString.IndexOf("{", tempIndex + 1);
if(dummy != -1) openCount++;
tempIndex = bigString.IndexOf("}", tempIndex + 1);
if(tempIndex != -1) {
closeCount++;
if(closeCount == openCount) {
// Balanced
return bigString.Substring(index, tempIndex - index + 1);
}
if(tempIndex != -1) closeCount++;
tempIndex = Math.Max(dummy, tempIndex);
if(closeCount == openCount) {
// Balanced
return bigString.Substring(index, tempIndex - index + 1);
}
} while(tempIndex != -1 && tempIndex < bigString.Length - 1);