次の方法で共有


Templates class

LGファイルが持つプロパティを含むLGの入り口、および関数を評価します。

コンストラクター

Templates(Template[], TemplateImport[], Diagnostic[], Templates[], string, string, ExpressionParser, ImportResolverDelegate, string[], string, Record<string, Templates>)

Templates クラスの新しいインスタンスを作成します。

プロパティ

allDiagnostics

現在の lg ファイルからすべての診断を取得し、lg ファイルを参照します。

allTemplates

現在の lg ファイルからすべてのテンプレートを取得し、lg ファイルを参照します。

content

LG コンテンツ。

diagnostics

診断。

enableFromFile

LG テンプレートで fromFile が許可されているかどうかを示します。

expressionParser

式パーサー。

id

lg リソースの ID。

importResolver

インポートされた lg ファイルのリソース ID を解決するためのデリゲート。

imports

このLGファイルに直接含まれる要素をインポートします。

inlineTemplateIdPrefix

インライン コンテンツの一時テンプレート ID。

lgOptions

現在の LG ファイルの削除オプションを取得します。 @returns LG テンプレートを評価するときのオプションかどうかを示す値。

namedReferences

インポート エイリアスからテンプレートにマップします。

namespace

現在の LG ファイルに登録する名前空間を取得します。 @returns 現在の LG ファイルに登録する名前空間を表す文字列値。

options

LG ファイル のオプション。

references

このLGファイルがインポートから持っているすべての参照は、lgファイルからのすべての子インポートを含みます。参照は、子だけでなく、このlgfileに直接属しています。 そのため、参照カウントは >count をインポートします。

source

lg リソースのソース。 lg ファイルの完全なパス。

メソッド

addTemplate(string, string[], string)

新しいテンプレートを追加し、LG ファイルを返します。

analyzeTemplate(string, AnalyzerOptions)

テンプレートを分析して、変数やテンプレート参照を含む静的アナライザーの結果を取得します。

deleteTemplate(string)

存在するテンプレートを削除します。

evaluate(string, object, EvaluationOptions)

指定された名前とスコープを使用してテンプレートを評価します。

evaluateText(string, object, EvaluationOptions)

インライン テンプレート str を評価するには、 を使用します。

expandTemplate(string, object, EvaluationOptions)

指定された名前とスコープを持つテンプレートを展開します。 ランダムな応答ではなく、考えられるすべての応答を返します。

parseFile(string, ImportResolverDelegate, ExpressionParser)

ファイルを解析し、LG ファイルを返します。

parseResource(LGResource, ImportResolverDelegate, ExpressionParser)

lgコンテンツをテンプレートに変換するためのパーサー。

parseText(string, string, ImportResolverDelegate, ExpressionParser)

lgコンテンツをテンプレートに変換するためのパーサー。

push(Template[])

コレクションに 1 つ以上のテンプレートを追加します。

toArray()

テンプレートのコレクションを取得します。

toString()

Templates コンテンツの文字列表現を返します。

updateTemplate(string, string, string[], string)

テンプレートを更新し、LG ファイルを返します。

コンストラクターの詳細

Templates(Template[], TemplateImport[], Diagnostic[], Templates[], string, string, ExpressionParser, ImportResolverDelegate, string[], string, Record<string, Templates>)

Templates クラスの新しいインスタンスを作成します。

new Templates(items?: Template[], imports?: TemplateImport[], diagnostics?: Diagnostic[], references?: Templates[], content?: string, id?: string, expressionParser?: ExpressionParser, importResolverDelegate?: ImportResolverDelegate, options?: string[], source?: string, namedReferences?: Record<string, Templates>)

パラメーター

items

Template[]

省略可能。 テンプレート インスタンスの一覧。

imports

TemplateImport[]

省略可能。 TemplateImport インスタンスの一覧。

diagnostics

Diagnostic[]

省略可能。 診断インスタンスの一覧。

references

Templates[]

省略可能。 テンプレート インスタンス 一覧。

content

string

省略可能。 現在の Templates インスタンスのコンテンツ。

id

string

省略可能。 現在の Templates インスタンスの ID。

expressionParser

ExpressionParser

省略可能。 ExpressionParser を使用して、コンテンツ内の式を解析します。

importResolverDelegate
ImportResolverDelegate

省略可能。 LG インポート ID をテンプレート テキストに解決するリゾルバー。

options

string[]

省略可能。 テンプレートの評価中のオプションを表す文字列の一覧。

source

string

省略可能。 テンプレート ソース。

namedReferences

Record<string, Templates>

省略可能。 "as" 構文でインポートされた eferences(例: myAlias として インポート )。

プロパティの詳細

allDiagnostics

現在の lg ファイルからすべての診断を取得し、lg ファイルを参照します。

Diagnostic[] allDiagnostics

プロパティ値

現在のlgファイルと参照lgファイルからのすべての診断。

allTemplates

現在の lg ファイルからすべてのテンプレートを取得し、lg ファイルを参照します。

Template[] allTemplates

プロパティ値

現在のlgファイルからのすべてのテンプレートとlgファイルを参照します。

content

LG コンテンツ。

content: string

プロパティ値

string

diagnostics

診断。

diagnostics: Diagnostic[]

プロパティ値

enableFromFile

LG テンプレートで fromFile が許可されているかどうかを示します。

static enableFromFile: boolean = false

プロパティ値

boolean

expressionParser

式パーサー。

expressionParser: ExpressionParser

プロパティ値

ExpressionParser

id

lg リソースの ID。

id: string

プロパティ値

string

importResolver

インポートされた lg ファイルのリソース ID を解決するためのデリゲート。

importResolver: ImportResolverDelegate

プロパティ値

imports

このLGファイルに直接含まれる要素をインポートします。

imports: TemplateImport[]

プロパティ値

inlineTemplateIdPrefix

インライン コンテンツの一時テンプレート ID。

static inlineTemplateIdPrefix: string = "__temp__"

プロパティ値

string

lgOptions

現在の LG ファイルの削除オプションを取得します。 @returns LG テンプレートを評価するときのオプションかどうかを示す値。

EvaluationOptions lgOptions

プロパティ値

namedReferences

インポート エイリアスからテンプレートにマップします。

namedReferences: Record<string, Templates>

プロパティ値

Record<string, Templates>

namespace

現在の LG ファイルに登録する名前空間を取得します。 @returns 現在の LG ファイルに登録する名前空間を表す文字列値。

string namespace

プロパティ値

string

options

LG ファイル のオプション。

options: string[]

プロパティ値

string[]

references

このLGファイルがインポートから持っているすべての参照は、lgファイルからのすべての子インポートを含みます。参照は、子だけでなく、このlgfileに直接属しています。 そのため、参照カウントは >count をインポートします。

references: Templates[]

プロパティ値

source

lg リソースのソース。 lg ファイルの完全なパス。

source: string

プロパティ値

string

メソッドの詳細

addTemplate(string, string[], string)

新しいテンプレートを追加し、LG ファイルを返します。

function addTemplate(templateName: string, parameters: string[], templateBody: string): Templates

パラメーター

templateName

string

新しいテンプレート名。

parameters

string[]

新しいパラメーター。

templateBody

string

新しいテンプレート本文。

戻り値

新しい lg ファイル。

analyzeTemplate(string, AnalyzerOptions)

テンプレートを分析して、変数やテンプレート参照を含む静的アナライザーの結果を取得します。

function analyzeTemplate(templateName: string, analyzerOptions?: AnalyzerOptions): AnalyzerResult

パラメーター

templateName

string

評価するテンプレート名。

analyzerOptions
AnalyzerOptions

テンプレートを分析するためのオプション。

戻り値

アナライザーの結果。

deleteTemplate(string)

存在するテンプレートを削除します。

function deleteTemplate(templateName: string): Templates

パラメーター

templateName

string

削除するテンプレート。

戻り値

新しい lg ファイルを返します。

evaluate(string, object, EvaluationOptions)

指定された名前とスコープを使用してテンプレートを評価します。

function evaluate(templateName: string, scope?: object, opt: EvaluationOptions): any

パラメーター

templateName

string

評価するテンプレート名。

scope

object

評価に表示される状態。

opt
EvaluationOptions

Evaluationテンプレートを評価する際のオプション。

戻り値

any

結果を評価します。

evaluateText(string, object, EvaluationOptions)

インライン テンプレート str を評価するには、 を使用します。

function evaluateText(inlineStr: string, scope?: object, opt: EvaluationOptions): any

パラメーター

inlineStr

string

評価されるインライン文字列。

scope

object

Scope オブジェクトまたは JToken。

opt
EvaluationOptions

Evaluationテンプレートを評価する際のオプション。

戻り値

any

評価された結果オブジェクト。

expandTemplate(string, object, EvaluationOptions)

指定された名前とスコープを持つテンプレートを展開します。 ランダムな応答ではなく、考えられるすべての応答を返します。

function expandTemplate(templateName: string, scope?: object, opt: EvaluationOptions): any[]

パラメーター

templateName

string

評価するテンプレート名。

scope

object

評価に表示される状態。

opt
EvaluationOptions

テンプレートの展開における EvaluationOptions。

戻り値

any[]

結果を展開します。

parseFile(string, ImportResolverDelegate, ExpressionParser)

ファイルを解析し、LG ファイルを返します。

static function parseFile(filePath: string, importResolver?: ImportResolverDelegate, expressionParser?: ExpressionParser): Templates

パラメーター

filePath

string

LG 絶対ファイル パス..

importResolver
ImportResolverDelegate

LG インポート ID をテンプレート テキストに解決するリゾルバー。

expressionParser

ExpressionParser

式を評価するための式パーサー。

戻り値

新しい lg ファイル。

parseResource(LGResource, ImportResolverDelegate, ExpressionParser)

lgコンテンツをテンプレートに変換するためのパーサー。

static function parseResource(resource: LGResource, importResolver?: ImportResolverDelegate, expressionParser?: ExpressionParser): Templates

パラメーター

resource
LGResource

LG リソース。

importResolver
ImportResolverDelegate

LG インポート ID をテンプレート テキストに解決するリゾルバー。

expressionParser

ExpressionParser

式を評価するための式パーサー。

戻り値

エンティティ。

parseText(string, string, ImportResolverDelegate, ExpressionParser)

警告

この API は非推奨になりました。

This method will soon be deprecated. Use ParseResource instead.

lgコンテンツをテンプレートに変換するためのパーサー。

static function parseText(content: string, id: string, importResolver?: ImportResolverDelegate, expressionParser?: ExpressionParser): Templates

パラメーター

content

string

テキスト コンテンツには lg テンプレートが含まれています。

id

string

Id はコンテンツの識別子です。 importResolver が未定義の場合、id は完全なパス文字列である必要があります。

importResolver
ImportResolverDelegate

LG インポート ID をテンプレート テキストに解決するリゾルバー。

expressionParser

ExpressionParser

式を評価するための式パーサー。

戻り値

エンティティ。

push(Template[])

コレクションに 1 つ以上のテンプレートを追加します。

function push(args: Template[])

パラメーター

args

Template[]

追加するテンプレートの一覧。

toArray()

テンプレートのコレクションを取得します。

function toArray(): Template[]

戻り値

コレクション テンプレートの内部リストへの参照。

toString()

Templates コンテンツの文字列表現を返します。

function toString(): string

戻り値

string

Templates コンテンツの文字列表現。

updateTemplate(string, string, string[], string)

テンプレートを更新し、LG ファイルを返します。

function updateTemplate(templateName: string, newTemplateName: string, parameters: string[], templateBody: string): Templates

パラメーター

templateName

string

Orignial テンプレート名。

newTemplateName

string

新しいテンプレート名。

parameters

string[]

新しいパラメーター。

templateBody

string

新しいテンプレート本文。

戻り値

新しい lg ファイル。