我有一堆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}