configletの副次的な用途は、ドキュメントの生成です。
generateコマンドを使うと、テンプレートからinstructions/introductionsのドキュメントを生成できます。
configlet [global-options] generate
Global options:
-h, --help Show this help message and exit
--version Show this tool's version information and exit
-t, --track-dir <dir> Specify a track directory to use instead of the current directory
-v, --verbosity <verbosity> The verbosity of output. Allowed values: q[uiet], n[ormal], d[etailed]
configletが生成できるドキュメントは次のとおりです。
それぞれの概念演習には、introduction.mdファイルがあります。また、各演習には任意でintroduction.md.tplファイルを持たせることができます。
テンプレートファイルは通常のMarkdownファイルと同じように扱いますが、1つだけ追加の機能があります。プレースホルダーを指定できるのです。次のプレースホルダーが使えます。
%{concept:<slug>}:その概念のintroduction.mdドキュメントを参照しますconfigletが、概念演習にintroduction.md.tplファイルがあることを検出すると、そこからintroduction.mdファイルを生成します。生成されるintroductionの内容はテンプレートと同じです。ただし、プレースホルダーは、それが参照するドキュメントの内容に置き換えられます。
configletが、実践演習がintroduction.mdファイルを持つProblem Specificationsの演習を実装していることを検出すると、その実践演習の.meta/introduction.mdファイルを、Problem Specificationsの演習のintroduction.mdファイルと同期します。
configletが、実践演習がProblem Specificationsの演習を実装していることを検出すると、その実践演習の.meta/instructions.mdファイルを、Problem Specificationsの演習のinstructions.mdファイルと同期します。instructions.mdファイルが見つからない場合は、description.mdファイルと同期します。
configletが、実践演習がProblem Specificationsの演習を実装していることを検出すると、Problem Specificationsの演習のmetadata.ymlファイルにあるsourceキーとsource_urlキーを、その実践演習の.meta/config.jsonファイルにあるsourceプロパティとsource_urlプロパティに同期します。