ansigenome icon indicating copy to clipboard operation
ansigenome copied to clipboard

Make it possible to use $HOME in options_readme_template

Open ypid opened this issue 10 years ago • 6 comments

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

ypid avatar Jan 31 '15 19:01 ypid

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

nickjj avatar Jan 31 '15 19:01 nickjj

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.

ypid avatar Jan 31 '15 20:01 ypid

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

nickjj avatar Jan 31 '15 22:01 nickjj

Yes.

ypid avatar Jan 31 '15 22:01 ypid

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:

https://github.com/nickjj/ansigenome/blob/4ac66e2a381ebbbbd84f673d96f8a8162a2a13f0/ansigenome/scan.py#L51

nickjj avatar Feb 01 '15 11:02 nickjj

All right, no problem. Thanks.

ypid avatar Feb 01 '15 12:02 ypid