【发布时间】:2017-02-25 01:00:52
【问题描述】:
我在配置文件夹中有一堆 YAML 文件,在模板文件夹中有一堆模板。是否有一个简单的衬线或函数可用于解析 YAML 文件并替换模板文件以生成可执行脚本
输入:
配置文件夹:config/yaml1、config/yaml2、config/yaml3.。
模板:template/template1、template/template2、template3。
输出scripts/script1, script2, script3
脚本数=模板数
有两种类型的模板
直接替换 示例
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}
【问题讨论】: