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
Fix Liquid filter typo in breadcrumb component (strip
instead of trim
)
#1434
Conversation
Thank you for submitting a PR @Zarthus!
Oh interesting, this difference really surprises me. We ran 0.8.0 on a few different client sites just to see if there's anything that our internal testing has missed, and it's completely possible that something still slipped through the cracks (e.g. maybe the If I could ask: do you have a public repo that's able to demonstrate this problem? Would help us double-check and verify what the problem is! If not, a toy repository that can reproduce the issue would also be really helpful. Separately, I agree that (will also tag in @pdmosses) |
Hey Matt! Unfortunately our repository is private (and I confirm it works for this repository specifically, I just cannot figure out where the FWIW; it's being built on an enterprise account on GitHub (the SaaS version; so github.com) privately hosted on our internal company network (it's a docs page). Something perhaps interesting is that we have the following setting enabled, and disabling
liquid:
error_mode: strict
strict_filters: true # <== setting this to false makes the build pass
|
def invoke(method, *args)
if self.class.invokable?(method)
send(method, *args)
elsif @context.strict_filters
raise Liquid::UndefinedFilter, "undefined filter #{method}"
else
args.first
end
rescue ::ArgumentError => e
raise Liquid::ArgumentError, e.message, e.backtrace
end |
@Zarthus Many thanks for reporting and diagnosing this bug! The filter Apparently JtD has never set However, JtD can't set {%- if site.just_the_docs.collections %} Footnotes
|
Thank you @pdmosses! I'm happy to include a commit into a singular PR (this one), if that is maintainers preference. For now, I've opened a separate one so we can talk and review both issues in isolation (#1435) As this is a legitimate bugfix I assume it might be more straightforward to not mix concerns (and have as an easy to release .1 patch version), and review both topics separately. But again - happy to go whichever way is preferred. |
strip
instead of trim
)
Thanks everyone for your quick responses! I feel silly and also did not know about
I agree with this! (I will also note that changes in our |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quickly tested this on our own site + just-the-docs tests, and this LGTM! I'll also let @pdmosses chime in with an official review before merging. Thanks again @Zarthus for your contribution!
Notably, I have not found a site that outputs different content, whitespace or not, with this change. I assume one such site exists - happy to investigate this later if we're interested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@mattxwang presumably you'll add a CHANGELOG entry before merging.
I think the filter was added to make the result independent of whether the site nav HTML rendered by JtD has any whitespace between its elements. Currently, most Liquid tags and filters in the nav code remove adjacent whitespace; so does HTML compression. |
Huh. CI failure is an issue with htmlproofer, not this PR. Going to rerun that check. |
Appreciate it, thank you all, folks! |
Okay, I've just cut a release to RubyGems (and GPR, though I suspect few people use it). @Zarthus you should be able to pull and build 0.8.1 shortly (if it's not available already). Could you give this a spin and verify that it also resolves your issue? Thank you to @Zarthus, @rmg, and @pdmosses for your quick communication on this PR - couldn't have done it without y'all! |
Happy to do so! Will report back tomorrow as it's midnight here at this point :) (though I'll be very confident it'll work, as when debugging the issue and test the PR I used our internal docs site and just replaced 'trim' with 'strip' in the gem's installed source to be confident that was problem and also the only issue 😉) |
We are running into an issue upgrading from 0.7 to 0.8, suggesting that
trim
is not a method.Looking at the liquid docs, we're probably looking for
strip
and nottrim
https://shopify.github.io/liquid/filters/strip/
https://github.com/Shopify/liquid/blob/main/History.md#300--2014-11-12, I don't see a trim so it may have been an extension? This does work normally on just-the-docs itself running from scratch, so it might also be a bug in our application (or combination of different versions in plugins).