-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
chore: pre-release checklist #1
Comments
@tunnckoCore how do you want to divide up the tasks? Do you want to do unit tests? Or convert filters? Or both? Or we can each pick a few categories of filters to work on. |
I can handle the tests and few categories.
Ookey. |
Awesome! Let me know which categories you're going to do so I don't do the same ones. thanks! |
The |
sounds good! |
@tunnckoCore if you remember, try to put the methods in alphabetical order so we can more easily scan for missing/duplicate filters. Not a big deal. |
Yea, was thinking about that too. Btw, should we preserve the underscore naming? I don't think so, because we are in the JavaScript land and linters may signal errors if users follow camelcase or other convention. |
Yeah, let's keep the underscores. I know it sucks, I agree - I don't like them personally either. My main goal is to make it really easy for Jekyll users to switch to another framework. We can easily create aliases for those though. Edit: also it will make it a lot easier for us to scan the filters on liquid libs and check for parity. |
We can figure this out before we publish. Maybe we'll create a "name mapper" for aliases, so we can use camelcase, but for now IMHO it will make this easier if we stick to the same names. |
One more thing... I'm trying to make most of the filters generic, but there are a few that have |
@tunnckoCore I just pushed up. Hopefully you don't get any conflicts, I didn't touch tests or the filters you're working on (do you get notifications when someone pushes up to a repository you collaborate on?) |
No, everything is good. I'm working on a branch too ;d
Yea, it's not a problem to me, I always have tons of notif cuz I watch tons of repos. |
K, here is an example of how I'm doing comments. Don't worry too much about these, I can edit: /**
* Truncate a string to the specified `length`, and append
* it with an elipsis, `…`.
*
* ```html
* {{ "<span>foo bar baz</span>" | ellipsis: 7 }}
* <!-- Results in: 'foo bar…' -->
* ```
* @param {String} str
* @param {Number} length The desired length of the returned string.
* @param {String} suffix (optional) Custom characters to append. Default is `…`.
* @return {String} The truncated string.
* @api public
*/
exports.ellipsis = (str, len, suffix) => {
return isString(str) ? (exports.truncate(str, len) + (suffix || '…')) : '';
}; I'm debating whether or not we should do the code examples in the comments, or if we should do them separately in docs. Several years ago I created a code comment linter that reported how many methods were undocumented and a few other useful stats. IMHO that might be a good solution here. I have something we can use if we want to go this route. edit: it would be awesome if our docs had examples for several template engines, but comments like the following are just too verbose and hard to maintain: /**
* Pads the given string with another string until the resulting
* string reaches the specified maxiumum length. The padding is
* applied from the end (right) of the current string.
*
* ```js
* <!-- Signature: string.pad_end(str, maxLength[, padString]) -->
* Liquid: {{ "Foo" | pad_end: 10, "0" }}
* Handlebars: {{pad_end "Foo" 10 "0"}}
* ejs: <%= pad_end("Foo", 10, "0") %>
* <!-- Results in: 'Foo0000000' -->
* ```
* @param {String} str
* @param {String} maxLength
* @param {String} padString
* @return {String}
* @api public
*/ I have an idea... I'll create another issue. |
What about just using multiple /**
* Pads the given string with another string until the resulting
* string reaches the specified maxiumum length. The padding is
* applied from the end (right) of the current string.
*
* @example hbs
* <h1>{{ pad_end "Foo" 10 "0" }}</h1>
*
* @example liquid
* <h1>{{ "Foo" | pad_end: 10, "0" }}</h1>
*
* @example ejs
* <h1><%= pad_end("Foo", 10, "0") %></h1>
*
* @param {String} str
* @param {String} maxLength
* @param {String} padString
* @return {String}
* @public
*/ It not looks that |
I’m not a big fan of that format. It’s based on javadoc and IMHO it looks messy.
…Sent from my iPhone
On Nov 25, 2018, at 10:53 PM, Charlike Mike Reagent ***@***.***> wrote:
What about just using multiple @examples?
/**
* Pads the given string with another string until the resulting
* string reaches the specified maxiumum length. The padding is
* applied from the end (right) of the current string.
*
* @example hbs
* <h1>{{ pad_end "Foo" 10 "0" }}</h1>
*
* @example liquid
* <h1>{{ "Foo" | pad_end: 10, "0" }}</h1>
*
* @example ejs
* <h1><%= pad_end("Foo", 10, "0") %></h1>
*
* @param {String} str
* @param {String} maxLength
* @param {String} padString
* @return {String}
* @public
*/
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
And what? I noticed that you are not fan (in the |
Should we throw from the helpers or just to return an empty string? |
The convention with most template engines is to just return an empty string. I assume this is because it's better than having Honestly, I've never felt good about either option here. What are your thoughts? @doowb?
I'm not sure what you mean. |
I just added more javadoc tests so you can see what I mean. Let me know if I'm not understanding what you mean. |
I think they should still throw but the template engine to handle that cases, so users will immediately understand what happens. It is always better to inform the user instead of giving him some
Yea yea, I know. I got your point, it's personal preference.
Actually no. 😆 It seems weird. Because in the api docs they see the actual example code, syntax highlighted, but in the code comments they see some gfm fence block, which isn't highlighted... Yes, with |
So, to be clear, you are saying that this "seems weird" which renders to because... even though it's identical to what's in the code comment, the ...makes it easier to see where the example begins and ends? You think that's more obvious than Okay, I'm totally cool with people having different opinions, and it's 100% fine if you just prefer |
Honestly, the reason I don't like |
Haha, I disable that. I don't like when code comments are colored similar to the actual code. It's just my preference. I find it distracting. |
Tests
There are other javascript ports of liquid, we can probably get more tests and filters from those as well.
cc @tunnckoCore @doowb
The text was updated successfully, but these errors were encountered: