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

Make --template-dir option search in standard template dir too #1221

Closed
dplanella opened this issue Apr 10, 2017 · 7 comments
Closed

Make --template-dir option search in standard template dir too #1221

dplanella opened this issue Apr 10, 2017 · 7 comments

Comments

@dplanella
Copy link
Contributor

Right now, unless I did not understand it correctly, from my own tests I notice that if I specify the template-dir for gollum to use that path to look for mustache templates, it will completely ignore the templates in the original standard path.

That makes overriding templates a bit cumbersome. That is, if I just want to modify the page.rb template, it's not enough to edit it and place it under template-dir. I will need to copy all of the other templates to template-dir, even if they are unmodified from stock. Otherwise gollum won't find it.

It would be good to make the template-dir option a bit cleverer by making template-dir the first location to search for templates, and then fall back to the stock template location if it cannot find a given template in template-dir. In this way template-dir would only define a priority location, and modified templates could simply be dropped in there.

Another option would be to enable template-dir to accept multiple directories ordered by priority, but I find that falling back to the stock location is simpler and cleaner.

Thanks!

@bartkamphorst
Copy link
Member

Good idea to use the default location as the fallback location if template_dir is specified. Care to submit a PR?

@dplanella
Copy link
Contributor Author

Happy to give it a go, although I'm more of a Python developer, so it might take me a while to get going with Ruby.

Would you have some quick pointers as to where the template_dir handling should be done in the Gollum code?

@dometto
Copy link
Member

dometto commented Apr 10, 2017

I like the idea, but I wonder whether this is possible without patching mustache. Right now it seems to accept just a single argument as template_path. See here.

@dplanella
Copy link
Contributor Author

Argh. Thanks for the comment. So essentially, this means that it's an issue in upstream mustache instead of Gollum, correct?

@bartkamphorst
Copy link
Member

Looks that way. 😞

@dometto
Copy link
Member

dometto commented Apr 10, 2017

Yes, that's right. You could report the issue there, though, as it seems mustache is still being updated. It seems quite useful to me to be able to pass an Array of file paths to template_path so that mustache will look for templates in each of them in order. Perhaps the developers there could point you towards how to address this in a PR.

If progress is made on it, we'll reopen this, and we would be more than happy to incorporate it into gollum.

@dometto dometto closed this as completed Apr 10, 2017
@dplanella
Copy link
Contributor Author

Thanks, closing sounds good for now. I need to spend some more time on it to better understand mustache before I open an issue there, but for future reference next time I look at it, this is somewhat related: http://stackoverflow.com/q/20358730

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants