template engine

This commit is contained in:
EugeneTes
2026-02-03 14:27:13 +01:00
parent 46b648d753
commit ec5decb12e
31 changed files with 4640 additions and 946 deletions

View File

@@ -0,0 +1,84 @@
namespace Inspectron.Epson.TemplateEngine.Parsing;
public abstract class TemplateNode
{
public List<TemplateNode> Children { get; set; } = new();
}
public class ReceiptNode : TemplateNode { }
public class LineNode : TemplateNode
{
public string? Text { get; set; }
public bool Bold { get; set; }
public bool Big { get; set; }
public bool Tall { get; set; }
public bool Red { get; set; }
public string Align { get; set; } = "left";
public int? LineSpacing { get; set; }
public bool Wrap { get; set; }
public int WrapIndent { get; set; }
}
public class ColumnsNode : TemplateNode
{
public string? Left { get; set; }
public string? Right { get; set; }
public bool Bold { get; set; }
public bool Big { get; set; }
public bool Tall { get; set; }
public bool Red { get; set; }
public int? LineSpacing { get; set; }
public bool Wrap { get; set; }
public int WrapIndent { get; set; }
}
public class RowNode : TemplateNode
{
public List<ColumnDef> Columns { get; set; } = new();
public bool Bold { get; set; }
public bool Big { get; set; }
public bool Tall { get; set; }
public bool Red { get; set; }
public int? LineSpacing { get; set; }
}
public class ColumnDef
{
public string? Text { get; set; }
public int? Width { get; set; }
public string Align { get; set; } = "left";
}
public class SeparatorNode : TemplateNode
{
public char Character { get; set; } = '-';
}
public class CutNode : TemplateNode { }
public class FeedNode : TemplateNode
{
public int Lines { get; set; } = 1;
}
public class ForeachNode : TemplateNode
{
public string Items { get; set; } = "";
public string Var { get; set; } = "";
}
public class IfNode : TemplateNode
{
public string Test { get; set; } = "";
}
public class ElseNode : TemplateNode { }
public class TableNode : TemplateNode
{
public List<ColumnDef> Columns { get; set; } = new();
public string? HeaderItems { get; set; }
public string? Items { get; set; }
public string? Var { get; set; }
}