-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Need affordance to url-encode a post's permalink. #1946
Comments
I think that I added to core to achieve the composition. My gut says that this functionality will find heavy use in apps. |
How that could work, is another question, as you say it is not possible to compose to helpers together. However, encode takes 'a thing' and encodes it, what that thing looks like could be a lot of things. One idea would be to use
If encode gets a helper passed to it, it executes the helper with other given arguments first, and encodes the resulting string. Otherwise, it does as it does now, and encodes the context it is given. This is just an idea mind, I'm not saying this is the right solution. Just trying to come up with some ideas to push the discussion forward as I agree that this is necessary. |
Preface: Latest version of Handlebars has subexpressions functionality. Done with {{encode (url absolute="true")}}. I don't have a strong opinion here. I've been coding under Python 3 lately, so I'll probably be biased toward an analogue. Based on your comment, the current I must say I find the term "helper" too vague, but any alternatives that come to mind are way to mathy. I'll mention and reject the obvious candidate: "filter." It's fitness doesn't justify overloading the term. Alternatively, I'm new to Handlebars. I expect to use something like
The lurking limitation here, though, is the single context getting filtered. Subexpressions can build a DAG of filters all pouring into a final result, while the blocks above are linear (maybe not, but messy nonetheless). I prefer the {{encode helper="url" absolute="true"}} spec as a stopgap awaiting subexpressions. |
Express-HBS just moved to the most recent Handlebars (support for subexpressions). Anybody have a handle on changes between v0.5 and v0.6? I'm going to drop the maintainer a line and upgrade locally, but I'm not running a production site. Anybody else interested in seeing subexpressions? |
This would be working if it wasn't for TryGhost/express-hbs#56 |
Closing against #4362 which explains the existing issues with the |
I'm integrating a couple of social apis into Ghost, but I see no affordance to url-encode a post's permalink. Am I overlooking the existing functionality? If not, I like the prospect of an additional parameter to the
url
helper along the lines ofencoding="url"
. But have I correctly intuited from #1089 that encoded and url-encoded are synonymous in themer-space? Would aurl
-parallel helper calledencodedUrl
find a home in core?The text was updated successfully, but these errors were encountered: