28 lines
729 B
C#
28 lines
729 B
C#
namespace Inspectron.Epson.Templates.Language.Nodes;
|
|
|
|
public enum ColumnAlignment
|
|
{
|
|
Left,
|
|
Right,
|
|
Center
|
|
}
|
|
|
|
public record ColumnNode(
|
|
int Width,
|
|
ColumnAlignment Alignment,
|
|
List<ITemplateNode> ContentNodes,
|
|
SourcePosition Position) : ITemplateNode
|
|
{
|
|
public IReadOnlyList<ITemplateNode> Children => ContentNodes;
|
|
|
|
public static (int Width, ColumnAlignment Alignment) ParseColumnSpec(string value)
|
|
{
|
|
var parts = value.Split(',', 2);
|
|
var width = int.Parse(parts[0]);
|
|
var align = parts.Length > 1
|
|
? Enum.TryParse<ColumnAlignment>(parts[1], true, out var a) ? a : ColumnAlignment.Left
|
|
: ColumnAlignment.Left;
|
|
return (width, align);
|
|
}
|
|
}
|