-
Notifications
You must be signed in to change notification settings - Fork 113
Comments
Conversation
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.
Who came up with this abbreviation? Is it really used? I mean, we're not on DOS any more...
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.
Wow, seems to be standard: https://github.com/donpark/hbs, https://github.com/leshill/handlebars_assets. Well, back to 1985 then...
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.
haha - I blame lazy typists ;)
korny
commented
Feb 17, 2013
Thanks for your pull request! I got a few questions.
- Handlebars is a free template language, but your scanner assumes it's outputting HTML. That's true in a lot (most?) of cases, it's possible to use it for HAML, JavaScript, or even Ruby code. (The same argument could be made for ERb, though.) What do you think? Should we mark the scanner as HTML+Handlebars or something, like Pygments does? Should the output language be a parameter?
- Your scanner only highlights comments and general tags. I think it would be great to have more colors here, for example for blocks, functions, arguments, path components. Do you want to add that?
dgeb
commented
Jun 25, 2013
@korny I am so sorry for letting this PR fall through the cracks. You asked some good questions that I didn't have immediate answers to and then I let this slip to the bottom of my stack. I've just rebased this PR and will try to follow through more promptly this time.
I hear what you're saying regarding Handlebars as a free template language. I really tried to follow the pattern set for erb to keep this simple and because it's directly analogous. I think that if we were to generalize one, we should generalize both scanners in the same way. Are any other scanners this flexible? Can we start simple and then pursue the flexibility later?
You're also right that I've kept the actual highlighting pretty simple. I'm highlighting delimiters ({{, }}, {{#, /}}, {{{, }}}), attributes names and values, and comments. I'm reusing the html scanner within handlebars blocks in order to highlight attribute names and values. We could choose to highlight blocks like {{#each comments}} ... {{/each}} differently from non-block expressions {{comment}}, but I'm not sure we could go much further. Because almost any word can be registered as a helper, it's impossible to distinguish a helper's name from a simple path expression without context. Maybe there are other opportunities for highlighting that I'm missing... please let me know if you can provide some examples. Also, let me know if you want to differentiate block vs. non-block expressions.
I'll try to see this through ASAP now, assuming you're interested in merging it. Thanks in advance.
dustinfarris
commented
Nov 30, 2013
@korny Would it be appropriate to merge this in even in its current state. Sort of as an MVP that can be improved in future pull requests?
korny
commented
Jan 8, 2014
I'm interested in merging it, but I don't like to add "beta" scanners. It should be more complete before it is included in CodeRay, see my comments above.
I've written a new scanner for the Handlebars templating language. I will submit a corresponding pull request to coderay-scanner-tests very soon.
Just let me know if you have any questions or suggestions. Thanks!