Fixed issue #439: headers are now correctly detected, even when using @@...@@ tags.
This commit is contained in:
parent
a777650e1f
commit
5fee035fbe
3 changed files with 15 additions and 2 deletions
|
@ -16,5 +16,5 @@ using System.Reflection;
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
[assembly: AssemblyVersion("3.0.1.467")]
|
[assembly: AssemblyVersion("3.0.1.468")]
|
||||||
[assembly: AssemblyFileVersion("3.0.1.467")]
|
[assembly: AssemblyFileVersion("3.0.1.468")]
|
||||||
|
|
|
@ -53,6 +53,7 @@ namespace ScrewTurn.Wiki {
|
||||||
private static readonly Regex IndentRegex = new Regex(@"(?<=(\n|^))\:+(\ )?.+?\n", RegexOptions.Compiled);
|
private static readonly Regex IndentRegex = new Regex(@"(?<=(\n|^))\:+(\ )?.+?\n", RegexOptions.Compiled);
|
||||||
private static readonly Regex EscRegex = new Regex(@"\<esc\>(.|\n|\r)*?\<\/esc\>", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Singleline);
|
private static readonly Regex EscRegex = new Regex(@"\<esc\>(.|\n|\r)*?\<\/esc\>", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Singleline);
|
||||||
private static readonly Regex SignRegex = new Regex(@"§§\(.+?\)§§", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
private static readonly Regex SignRegex = new Regex(@"§§\(.+?\)§§", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
|
// This regex is duplicated in Edit.aspx.cs
|
||||||
private static readonly Regex FullCodeRegex = new Regex(@"@@.+?@@", RegexOptions.Compiled | RegexOptions.Singleline);
|
private static readonly Regex FullCodeRegex = new Regex(@"@@.+?@@", RegexOptions.Compiled | RegexOptions.Singleline);
|
||||||
//private static readonly Regex UsernameRegex = new Regex(@"\{username\}", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
//private static readonly Regex UsernameRegex = new Regex(@"\{username\}", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
|
||||||
private static readonly Regex JavascriptRegex = new Regex(@"\<script.*?\>.*?\<\/script\>", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.CultureInvariant);
|
private static readonly Regex JavascriptRegex = new Regex(@"\<script.*?\>.*?\<\/script\>", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.CultureInvariant);
|
||||||
|
|
|
@ -386,6 +386,9 @@ namespace ScrewTurn.Wiki {
|
||||||
return buffer.ToString().Trim('-');
|
return buffer.ToString().Trim('-');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This regex is duplicated from Formatter.cs
|
||||||
|
private static readonly Regex FullCodeRegex = new Regex(@"@@.+?@@", RegexOptions.Compiled | RegexOptions.Singleline);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Finds the start and end positions of a section of the content.
|
/// Finds the start and end positions of a section of the content.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -395,6 +398,15 @@ namespace ScrewTurn.Wiki {
|
||||||
/// <param name="len">The length of the section.</param>
|
/// <param name="len">The length of the section.</param>
|
||||||
/// <param name="anchor">The anchor ID of the section.</param>
|
/// <param name="anchor">The anchor ID of the section.</param>
|
||||||
private static void ExtractSection(string content, int section, out int start, out int len, out string anchor) {
|
private static void ExtractSection(string content, int section, out int start, out int len, out string anchor) {
|
||||||
|
// HACK: @@...@@ escapes headers: must reproduce behavior here
|
||||||
|
Match m = FullCodeRegex.Match(content);
|
||||||
|
while(m.Success) {
|
||||||
|
string newContent = m.Value.Replace("=", "$"); // Do not alter positions
|
||||||
|
content = content.Remove(m.Index, m.Length);
|
||||||
|
content = content.Insert(m.Index, newContent);
|
||||||
|
m = FullCodeRegex.Match(content, m.Index + m.Length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
List<HPosition> hPos = Formatter.DetectHeaders(content);
|
List<HPosition> hPos = Formatter.DetectHeaders(content);
|
||||||
start = 0;
|
start = 0;
|
||||||
len = content.Length;
|
len = content.Length;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue