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

Already on GitHub? Sign in to your account

template-options #156

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
2 participants

rkh asked me to wrap this up in a pull request on another fork from a previous version. i've forked the most recent and done that.

simple modifications that allow passing an evaluation scope to templates as well as an option to use a different file extension other than that of the name of the rendering engine.

i've also added some unit tests to templates_test.rb, but I must confess to not actually getting to the point of running them because of all the necessary test dependencies.

Paul Walker added some commits Jan 7, 2011

Paul Walker template rendering options: :scope - eval scope other than self, :ext…
…ension - file extension other than template engine name
b7975b8
Paul Walker whitespace alignment e899375
Paul Walker fixed option in unit test b377fe8
Owner

rkh commented Jan 7, 2011

Thanks, I'll do a code review later.

Owner

rkh commented Jan 8, 2011

I like the scope option. Setting the extension, not so much. I'm not really sure what the use case is. Do you want to associate one file extension with different template engines? Otherwise you should really just register the extension with Tilt and Sinatra will find the file.

Except registering it with Tilt doesn't work as Sinatra creates the path on it's own and always adds the engine as the extension. I do think it would be better if Sinatra read the extension value from Tilt. However this very small tweak at least give users the ability to change it. Also, Sinatra essentially wraps and hides the capabilities of Tilt so design wise I would still prefer this and default to the extension value from Tilt.

All of our templates have an .html extension and when Sinatra introduced Tilt, it broke our templates until I monkey patched this in. I don't think there's any argument that users should be forced to use a certain file extension. Text editors aren't always configurable to tweak there settings to recognize a forced file extension as a certain document format. Also, this is something Sinatra users had before the introduction of Tilt that was taken away.

Owner

rkh commented Jan 8, 2011

It does check with Tilt, it only checks with the engine value first, see base.rb#L505-509. This was mainly introduced since markdown templates usually have a md extension. But I see your point.

Owner

rkh commented Feb 19, 2011

I assume the .html issue is fixed with 5467056? If so, I would like to only pull in the scope feature.

Owner

rkh commented Feb 19, 2011

Add :scope to CHANGES. Closed by 8ca5fa5.

@zzak zzak added a commit to zzak/sinatra that referenced this pull request Jul 22, 2016

@zzak zzak Fix capture bug with slim from patch by @minad
See judofyr/temple#86

Closes #156
Closes #145
50733f7

@zzak zzak added a commit to zzak/sinatra that referenced this pull request Jul 22, 2016

@zzak zzak Fix capture bug with slim from patch by @minad
See judofyr/temple#86

Closes #156
Closes #145
43797c9

This issue was closed.

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