mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Refactor] Invert if to reduce nesting.
This commit is contained in:
@@ -488,17 +488,14 @@ public partial class SpectreTextBlock : TextBlock
|
||||
{
|
||||
i++;
|
||||
|
||||
if(i < text.Length && text[i] == ']')
|
||||
{
|
||||
// Found [/], close the most recent tag
|
||||
if(tagStack.Count > 0)
|
||||
{
|
||||
(int openStart, int openTagEnd, string tag) = tagStack.Pop();
|
||||
int closeTagEnd = i + 1; // After the ']' of [/]
|
||||
result.Add(new MarkupTag(openStart, closeTagEnd, tag, openTagEnd, tagStart));
|
||||
}
|
||||
if(i >= text.Length || text[i] != ']') continue;
|
||||
|
||||
i++;
|
||||
// Found [/], close the most recent tag
|
||||
if(tagStack.Count > 0)
|
||||
{
|
||||
(int openStart, int openTagEnd, string tag) = tagStack.Pop();
|
||||
int closeTagEnd = i + 1; // After the ']' of [/]
|
||||
result.Add(new MarkupTag(openStart, closeTagEnd, tag, openTagEnd, tagStart));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -516,12 +513,10 @@ public partial class SpectreTextBlock : TextBlock
|
||||
int openTagEnd = i + 1; // After the ']'
|
||||
tagStack.Push((tagStart, openTagEnd, tagName));
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
i++;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user