2025-03-25 21:27:54 +03:00
|
|
|
using System;
|
|
|
|
|
|
2025-03-29 19:31:10 +03:00
|
|
|
namespace mROA.Codegen.Tools.Reading
|
2025-03-25 21:27:54 +03:00
|
|
|
{
|
|
|
|
|
public class DefineSectionReader : LeadingTextSectionReader
|
|
|
|
|
{
|
|
|
|
|
public DefineSectionReader() : base("<!D")
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override ITemplateSection ExtractSection(ref int index, TemplateDocument document)
|
|
|
|
|
{
|
|
|
|
|
var tagEnd = TemplateText.IndexOf(">", index, StringComparison.Ordinal);
|
|
|
|
|
var sectionName = GetTagValue(index, tagEnd);
|
|
|
|
|
tagEnd += 1;
|
|
|
|
|
var endIndex = TemplateText.IndexOf("<!D>", tagEnd, StringComparison.Ordinal);
|
|
|
|
|
var storedText = TemplateText.Substring(tagEnd, endIndex - tagEnd);
|
|
|
|
|
index = endIndex + 4;
|
|
|
|
|
PassCaretToCloseSymbol();
|
|
|
|
|
PassCaretToCloseSymbol();
|
|
|
|
|
return new DefineTemplateSection(storedText, sectionName, document);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|