次の方法で共有


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ファイルが Imports oticeから持つすべての参照:参照はlgファイルからのすべての子インポートを含みます。子だけがこのlgfileに直接属しているわけではありません。 そのため、参照カウントは >= インポート数になります。

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()

コンテンツを テンプレートの文字列形式を返します。

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ファイルが Imports oticeから持つすべての参照:参照はlgファイルからのすべての子インポートを含みます。子だけがこのlgfileに直接属しているわけではありません。 そのため、参照カウントは >= インポート数になります。

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

テンプレートを評価する場合の EvaluationOptions。

戻り値

any

結果を評価します。

evaluateText(string, object, EvaluationOptions)

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

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

パラメーター

inlineStr

string

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

scope

object

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

opt
EvaluationOptions

テンプレートを評価する場合の EvaluationOptions。

戻り値

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()

コンテンツを テンプレートの文字列形式を返します。

function toString(): string

戻り値

string

テンプレートの文字列表現 コンテンツです。

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 ファイル。