Лёгкий рефактор
This commit is contained in:
+3
-3
@@ -21,7 +21,7 @@ internal partial class StringHelper
|
|||||||
{
|
{
|
||||||
MarkdownLinkSplit result = new();
|
MarkdownLinkSplit result = new();
|
||||||
|
|
||||||
Match match = MarkdownRegex().Match(input);
|
Match match = LinkRegex().Match(input);
|
||||||
if (match.Captures.Count > 0)
|
if (match.Captures.Count > 0)
|
||||||
{
|
{
|
||||||
result.Links.Add(
|
result.Links.Add(
|
||||||
@@ -34,7 +34,7 @@ internal partial class StringHelper
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Suffix = MarkdownRegex().Replace(input, "");
|
result.Suffix = LinkRegex().Replace(input, "");
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ internal partial class StringHelper
|
|||||||
public static partial Regex SourceSuffixRegex();
|
public static partial Regex SourceSuffixRegex();
|
||||||
|
|
||||||
[GeneratedRegex(@"(.*?)\[(.*?)\]\((.*?)\)")]
|
[GeneratedRegex(@"(.*?)\[(.*?)\]\((.*?)\)")]
|
||||||
public static partial Regex MarkdownRegex();
|
public static partial Regex LinkRegex();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class MarkdownLinkSplit
|
internal class MarkdownLinkSplit
|
||||||
|
|||||||
+2
-11
@@ -9,22 +9,13 @@ internal class ActionProcessor(AonprdProcessorInput input) : AbstractEntityProce
|
|||||||
|
|
||||||
public override Pf2eModel.Model.Structure.Action Object { get; } = new();
|
public override Pf2eModel.Model.Structure.Action Object { get; } = new();
|
||||||
|
|
||||||
private bool _skipping = false;
|
public override void Add() => Context.Actions.Add(Object);
|
||||||
|
|
||||||
public override void Add()
|
|
||||||
{
|
|
||||||
if (!_skipping)
|
|
||||||
{
|
|
||||||
Context.Actions.Add(Object);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Process()
|
public override void Process()
|
||||||
{
|
{
|
||||||
if (Input.GetRequired<string>("markdown").StartsWith("**Activate**"))
|
if (Input.GetRequired<string>("markdown").StartsWith("**Activate**"))
|
||||||
{
|
{
|
||||||
_skipping = true;
|
throw new SkipItemException(Input.GetRequired<string>("name"), "activating action");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
base.Process();
|
base.Process();
|
||||||
|
|||||||
+1
-1
@@ -257,7 +257,7 @@ internal partial class RitualProcessor(AonprdProcessorInput input) : AbstractEnt
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Замена символа ссылок
|
// Замена символа ссылок
|
||||||
input = StringHelper.MarkdownRegex().Replace(input, "$1[$2]{$3}");
|
input = StringHelper.LinkRegex().Replace(input, "$1[$2]{$3}");
|
||||||
input = input.Replace("(", "<").Replace(")", ">").Replace("{", "(").Replace("}", ")");
|
input = input.Replace("(", "<").Replace(")", ">").Replace("{", "(").Replace("}", ")");
|
||||||
|
|
||||||
if (input.EndsWith(';') || input.EndsWith(','))
|
if (input.EndsWith(';') || input.EndsWith(','))
|
||||||
|
|||||||
Reference in New Issue
Block a user