【发布时间】:2018-10-12 16:41:28
【问题描述】:
基于How do I make multiple targets from a set of templates for the source?,我现在想实现一个简单的模板引擎。
我很高兴使用 sed 直接替换,但我也想要条件。
例如,如果一个模板看起来像这样:
This is the file for engine:#if version != 'latest'##version#-#endif#alpine
不同版本的输出(例如 7.0 和最新版本)。
This is the file for engine:7.0-alpine
This is the file for engine:alpine
在sed 中写这句话虽然可能,但确实意味着我不得不重新发明轮子。
对于适用于 unix 环境的简单模板有哪些建议?
【问题讨论】:
标签: makefile templating