Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow template type per template #58

Closed
jayvdb opened this issue Jun 6, 2018 · 2 comments
Closed

Allow template type per template #58

jayvdb opened this issue Jun 6, 2018 · 2 comments

Comments

@jayvdb
Copy link
Member

jayvdb commented Jun 6, 2018

Currently template_type can only appear at:

configuration:
  template_type: ...
  ...

While that default is ok, it should be possible to override it per template.
e.g.

targets:
  - output: LICENSE
    template: license.mako
    template_type: mako
@chfw
Copy link
Member

chfw commented Jun 10, 2018

No, the syntax won't change. For example, for mako, they will be:

targets:
  - LICENSE: license.mako
  - output: setup.py
    template: setup.py.mako
    configuration: config.yml

No changes to jinja based syntax.

of course, it will have a dependency: moban-mako exists and is installed in current python environment.

chfw added a commit that referenced this issue Jun 10, 2018
chfw added a commit that referenced this issue Jun 11, 2018
* ✨ choose a template based on its file extension. fix #43

* 📚 update change log

* 🐛 fix the template names

* 📚 udpate readme

* ✨ default template engine will be jinja2 if template type(file extension) cannot be found

* 👕 address review feedback. #61

* 🎨 keep cli --template_type option

* ✨ allow template_type in moban file to indicate default template engine. i.e. if unknown template type(file suffix) is found, the default template engine is used. So if mako engine is specified via template_type, an unknown template file such as strange.template will be rendered by mako engine

* ✨ allow jinja2 become template suffix too, meaning a.jj2 and b.jinja2 will be rendered by the same engine. however, for now, the engine instance will not be the same. later on, this can be consolidated

* 📚 update change log. #58

* ✨ associate jinja2 engine with more file types, j2, jinja and retore the default template engine name as jinja2

* 📚 documentation update
@chfw
Copy link
Member

chfw commented Jun 11, 2018

I am cleaning my to-do list so closing issues that are to be delivered.

@chfw chfw closed this as completed Jun 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants