Table of Contents

Class TemplateToken

Namespace
JD.AI.Rendering
Assembly
JD.AI.dll

An individual token produced by Parse(string).

public sealed record TemplateToken : IEquatable<TemplateToken>
Inheritance
TemplateToken
Implements
Inherited Members

Properties

IsConditional

Whether this segment is optional (uses the ? suffix in the template).

public bool IsConditional { get; init; }

Property Value

bool

IsLiteral

Whether this token is a literal text fragment.

public bool IsLiteral { get; init; }

Property Value

bool

LiteralText

The literal text, set when IsLiteral is true.

public string? LiteralText { get; init; }

Property Value

string

SegmentKey

The segment key, set when IsLiteral is false.

public string? SegmentKey { get; init; }

Property Value

string

Methods

Literal(string)

Creates a literal text token.

public static TemplateToken Literal(string text)

Parameters

text string

Returns

TemplateToken

Segment(string, bool)

Creates a segment placeholder token.

public static TemplateToken Segment(string key, bool conditional)

Parameters

key string
conditional bool

Returns

TemplateToken