Переименование
This commit is contained in:
+2
-2
@@ -2,13 +2,13 @@ using System;
|
|||||||
|
|
||||||
namespace mROA.CodegenTools
|
namespace mROA.CodegenTools
|
||||||
{
|
{
|
||||||
public class DefineTemplatePart : ITemplatePart, ITagged
|
public class DefineTemplateSection : ITemplateSection, ITagged
|
||||||
{
|
{
|
||||||
public TemplateDocument Context { get; set; }
|
public TemplateDocument Context { get; set; }
|
||||||
public string StoredText { get; }
|
public string StoredText { get; }
|
||||||
private readonly string _tag;
|
private readonly string _tag;
|
||||||
|
|
||||||
public DefineTemplatePart(string storedText, string tag, TemplateDocument context)
|
public DefineTemplateSection(string storedText, string tag, TemplateDocument context)
|
||||||
{
|
{
|
||||||
StoredText = storedText;
|
StoredText = storedText;
|
||||||
_tag = tag;
|
_tag = tag;
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
namespace mROA.CodegenTools
|
namespace mROA.CodegenTools
|
||||||
{
|
{
|
||||||
public interface ITemplatePart
|
public interface ITemplateSection
|
||||||
{
|
{
|
||||||
TemplateDocument Context { get; set; }
|
TemplateDocument Context { get; set; }
|
||||||
int TargetLength { get; }
|
int TargetLength { get; }
|
||||||
string Bake();
|
string Bake();
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ITagged : ITemplatePart
|
public interface ITagged : ITemplateSection
|
||||||
{
|
{
|
||||||
string Tag { get; }
|
string Tag { get; }
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@ namespace mROA.CodegenTools
|
|||||||
|
|
||||||
public void Setup(object value)
|
public void Setup(object value)
|
||||||
{
|
{
|
||||||
if (!(value is string) && !(value is ITemplatePart) )
|
if (!(value is string) && !(value is ITemplateSection) )
|
||||||
return;
|
return;
|
||||||
if (IsInserted(value))
|
if (IsInserted(value))
|
||||||
return;
|
return;
|
||||||
@@ -61,7 +61,7 @@ namespace mROA.CodegenTools
|
|||||||
case string s:
|
case string s:
|
||||||
return s;
|
return s;
|
||||||
default:
|
default:
|
||||||
return ((ITemplatePart)_insertedValue).Bake();
|
return ((ITemplateSection)_insertedValue).Bake();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace mROA.CodegenTools
|
namespace mROA.CodegenTools
|
||||||
{
|
{
|
||||||
public class LinkTemplatePart : ITemplatePart
|
public class LinkTemplateSection : ITemplateSection
|
||||||
{
|
{
|
||||||
private readonly string _linkedTag;
|
private readonly string _linkedTag;
|
||||||
|
|
||||||
public LinkTemplatePart(string linkedTag, TemplateDocument context)
|
public LinkTemplateSection(string linkedTag, TemplateDocument context)
|
||||||
{
|
{
|
||||||
_linkedTag = linkedTag;
|
_linkedTag = linkedTag;
|
||||||
Context = context;
|
Context = context;
|
||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
namespace mROA.CodegenTools
|
namespace mROA.CodegenTools
|
||||||
{
|
{
|
||||||
public class LiteralTemplatePart : ITemplatePart
|
public class LiteralTemplateSection : ITemplateSection
|
||||||
{
|
{
|
||||||
private string _internalText;
|
private string _internalText;
|
||||||
|
|
||||||
public LiteralTemplatePart(string internalText, TemplateDocument context)
|
public LiteralTemplateSection(string internalText, TemplateDocument context)
|
||||||
{
|
{
|
||||||
_internalText = internalText;
|
_internalText = internalText;
|
||||||
Context = context;
|
Context = context;
|
||||||
+2
-2
@@ -2,14 +2,14 @@ using System;
|
|||||||
|
|
||||||
namespace mROA.CodegenTools
|
namespace mROA.CodegenTools
|
||||||
{
|
{
|
||||||
public class ProgrammableTextPart : ITemplatePart
|
public class ProgrammableTextSection : ITemplateSection
|
||||||
{
|
{
|
||||||
public TemplateDocument Context { get; set; }
|
public TemplateDocument Context { get; set; }
|
||||||
public int TargetLength => 0;
|
public int TargetLength => 0;
|
||||||
|
|
||||||
private Func<object, string> _bakeFunc;
|
private Func<object, string> _bakeFunc;
|
||||||
|
|
||||||
public ProgrammableTextPart(Func<object, string> bakeFunc, TemplateDocument context)
|
public ProgrammableTextSection(Func<object, string> bakeFunc, TemplateDocument context)
|
||||||
{
|
{
|
||||||
_bakeFunc = bakeFunc;
|
_bakeFunc = bakeFunc;
|
||||||
Context = context;
|
Context = context;
|
||||||
@@ -6,7 +6,7 @@ namespace mROA.CodegenTools
|
|||||||
{
|
{
|
||||||
public class TemplateDocument
|
public class TemplateDocument
|
||||||
{
|
{
|
||||||
public List<ITemplatePart> Parts { get; }
|
public List<ITemplateSection> Parts { get; }
|
||||||
public object AdditionalContext { get; set; }
|
public object AdditionalContext { get; set; }
|
||||||
public ITagged this[string tag] => Parts.OfType<ITagged>().FirstOrDefault(i => i.Tag == tag);
|
public ITagged this[string tag] => Parts.OfType<ITagged>().FirstOrDefault(i => i.Tag == tag);
|
||||||
public void Insert(string tag, object value)
|
public void Insert(string tag, object value)
|
||||||
|
|||||||
Reference in New Issue
Block a user