MiniTemplator is a compact template engine for HTML files.
と紹介されている。 HTMLの生成を目的としたコンパクトなテンプレートエンジンのよう。
- ここから ZIPファイルをダウンロードし解凍する。
- 解凍したファイルに、「MiniTemplator.cls」というファイルがあるので、 このファイルをVB Script Editorにインポートする。
- テンプレートファイルを予め作っておく。
- テンプレートエンジン(オブジェクト)を作成する。
- テンプレートエンジンにテンプレートファイルを読み込む。
- テンプレートエンジンに変数やブロックを設定する。
- 結果ファイルを出力する。
' テンプレートエンジン生成
Dim templator As New MiniTemplator
' テンプレートファイル読込
templator.ReadTemplateFromFile {fullfilename}
' 変数を設定する
templator.SetVariable "key", {値}
' ブロックを指定する
templator.AddBlock {ブロック名}
' 適用結果をファイル出力する
templator.GenerateOutputToFile {filename}