nickjj/ansigenome

Make it possible to use $HOME in options_readme_template

ypid opened this issue · 6 comments

ypid commented

Hi

Great project. Is it possible to specify the path to the readme template as follows, where ~ would be expanded as $HOME?

options_readme_template: ~/.ansigenome/ypid.README.rst.j2

Currently, ansigenome says:

The following template could not be found:
~/.ansigenome/README.rst.j2

or

The following template could not be found:
$HOME/.ansigenome/README.rst.j2

Hello,

Are you having issues with using custom templates? Currently you can put the custom templates anywhere you want. It's up to the include statement in the template to determine where it's located.

Example:
https://github.com/nickjj/ansigenome#custom-readme-template

ypid commented

Which include statement? You mean the:

{% extends "README.md.j2" %}

I meant in order to use a custom template, you have to specify this path in ~/.ansigenome.conf as options_readme_template and this must by the full path as far as I understand the source and my tests are confirming that.

Ok, so the issue here is that ~ and $HOME aren't expanding to /home/ypid?

ypid commented

Yes.

It will be a few days before I can patch this but using os.path.expanduser and os.path.expandvars on this line should do it:

extend_path = self.config["options_readme_template"]

ypid commented

All right, no problem. Thanks.