Templates class
LGファイルが持つプロパティを含むLGの入り口、および関数を評価します。
コンストラクター
プロパティ
| all |
現在の lg ファイルからすべての診断を取得し、lg ファイルを参照します。 |
| all |
現在の lg ファイルからすべてのテンプレートを取得し、lg ファイルを参照します。 |
| content | LG コンテンツ。 |
| diagnostics | 診断。 |
| enable |
LG テンプレートで fromFile が許可されているかどうかを示します。 |
| expression |
式パーサー。 |
| id | lg リソースの ID。 |
| import |
インポートされた lg ファイルのリソース ID を解決するためのデリゲート。 |
| imports | このLGファイルが直接含まれている要素をインポートします。 |
| inline |
インライン コンテンツの一時テンプレート ID。 |
| lg |
現在の LG ファイルの削除オプションを取得します。 @returns LG テンプレートを評価するときのオプションかどうかを示す値です。 |
| named |
インポート エイリアスからテンプレートにマップします。 |
| namespace | 現在の LG ファイルに登録する名前空間を取得します。 @returns 現在の LG ファイルに登録する名前空間を表す文字列値です。 |
| options | LGファイルのオプション。 |
| references | このLGファイルが Imports oticeから持つすべての参照:参照はlgファイルからのすべての子インポートを含みます。子だけがこのlgfileに直接属しているわけではありません。 そのため、参照カウントは >= インポート数になります。 |
| source | lg リソースのソース。 lg ファイルの完全なパス。 |
メソッド
| add |
新しいテンプレートを追加し、LG ファイルを返します。 |
| analyze |
テンプレートを分析して、変数やテンプレート参照を含む静的アナライザーの結果を取得します。 |
| delete |
存在するテンプレートを削除します。 |
| evaluate(string, object, Evaluation |
指定された名前とスコープを使用してテンプレートを評価します。 |
| evaluate |
インライン テンプレート str を評価するために使用します。 |
| expand |
指定された名前とスコープを持つテンプレートを展開します。 ランダムな応答ではなく、考えられるすべての応答を返します。 |
| parse |
ファイルを解析し、LG ファイルを返します。 |
| parse |
LGコンテンツをテンプレートに変換するためのパーサー。 |
| parse |
LGコンテンツをテンプレートに変換するためのパーサー。 |
| push(Template[]) | コレクションに 1 つ以上のテンプレートを追加します。 |
| to |
テンプレートのコレクションを取得します。 |
| to |
|
| update |
テンプレートを更新し、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>)
パラメーター
- imports
随意。 TemplateImport インスタンスの一覧。
- diagnostics
随意。 診断 インスタンスの一覧。
- references
- 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
プロパティ値
Template[]
現在のlgファイルと参照lgファイルからのすべてのテンプレート。
content
LG コンテンツ。
content: string
プロパティ値
string
diagnostics
enableFromFile
LG テンプレートで fromFile が許可されているかどうかを示します。
static enableFromFile: boolean = false
プロパティ値
boolean
expressionParser
式パーサー。
expressionParser: ExpressionParser
プロパティ値
ExpressionParser
id
lg リソースの ID。
id: string
プロパティ値
string
importResolver
インポートされた lg ファイルのリソース ID を解決するためのデリゲート。
importResolver: ImportResolverDelegate
プロパティ値
imports
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
評価で表示される状態。
テンプレートを評価する場合の EvaluationOptions。
戻り値
any
結果を評価します。
evaluateText(string, object, EvaluationOptions)
インライン テンプレート str を評価するために使用します。
function evaluateText(inlineStr: string, scope?: object, opt: EvaluationOptions): any
パラメーター
- inlineStr
-
string
評価されるインライン文字列。
- scope
-
object
Scope オブジェクトまたは JToken。
テンプレートを評価する場合の EvaluationOptions。
戻り値
any
評価された結果オブジェクト。
expandTemplate(string, object, EvaluationOptions)
指定された名前とスコープを持つテンプレートを展開します。 ランダムな応答ではなく、考えられるすべての応答を返します。
function expandTemplate(templateName: string, scope?: object, opt: EvaluationOptions): any[]
パラメーター
- templateName
-
string
評価するテンプレート名。
- scope
-
object
評価で表示される状態。
テンプレートを展開する場合の 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[])
toArray()
toString()
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 ファイル。