Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
mustache-sinatra
gem just received a bump release, which now utillizes the latestmustache
. Unfortunately, this has suddenly exposedgollum
to breaking changes in the latestmustache
. I found two:Broken call to View#escape
Error:
NoMethodError private method escape called for <<Precious::Views::Create: ...
.Diagnosis: in the latest
mustache
, views are expected to have anescape
instead of anescapeHTML
method. We were using theescapeHTML
method provided by theRack::Utils
modules. By including that module, we also include a private#escape
method, which mustache is now attempting to call.Fix: instead of including
Rack::Utils
, just use the defaultMustache#escape
, which usesCGI.escapeHTML
. Overriding the#escape
method is only necessary for providing custom (non-HTML) escaping.Broken template cascades
Our logic for template cascading fails, causing a test failure for using custom partials inside a custom template (
"test_overridden_navbar_partial_is_used"
intest_template_cascade.rb
).Diagnosis: we provided a custom class method
Layout.partial
, but the newest version of mustache ended up calling an instance methodPage#partial
, i.e. the mustache default. So our overriding logic was simply not being called.Fix: providing the necessary instance method
#partial
which provides the necessary overriding logic. I have still implemented the helper methods as class methods.@bartkamphorst I would appreciate a review of this fix, since I'm not really familiar with the template cascade functionality.
This fix would only be included in the next major release of gollum. Should we backport a fix for
5.x
, pinningmustache
to an older version?