我有一堆YAML文件在一个配置文件夹和模板文件夹中的一堆模板。有一个简单的一个衬垫或功能,我可以用它来解决模板文件YAML文件和替代生成可执行的脚本解析YAML文件并替换为模板
输入:
config文件夹:config/yaml1
,config/yaml2
,config/yaml3.
。
模板:template/template1
,template/template2
,template3
。
输出
scripts/script1
,script2
,script3
脚本的数=模板数
有2种类型的模板
一说是直接置换 例
YAML1:
Titles:4
SubTitles:10
Template1:
Number of Titles {Titles} where as Number of Subtitles is {SubTitles}
其他模板是嵌套的。基本上,模板需要基于YAML 实例进行循环:
YAML2:
Book: "The Choice of using Choice"
Author: "Unknown1"
Book: "Chasing Choices"
Author:"Known2"
Template2
Here are all the Books with Author Info
The author of the {Book} is {Author}