Compare commits
10 Commits
0cc79e83ec
...
7df54fccbe
Author | SHA1 | Date |
---|---|---|
Matthias Portzel | 7df54fccbe | |
Matthias Portzel | 3c6b0fa167 | |
Matthias Portzel | a69928a730 | |
Daniel Demmel | c2c09947b6 | |
Daniel Demmel | 86cbfdad7b | |
Daniel Demmel | 85a153a6f7 | |
Daniel Demmel | fa350d393d | |
Daniel Demmel | 9c63456e55 | |
Daniel Demmel | 790f2b0222 | |
Daniel Demmel | 63c28f7aa9 |
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"target": "convert_file",
|
||||
"target_format": "plist",
|
||||
"ext": "tmLanguage",
|
||||
|
||||
"selector": "Handlebars.json"
|
||||
}
|
141
README.md
141
README.md
|
@ -1,136 +1,15 @@
|
|||
# Atom and Sublime Text 2 / 3 Handlebars.js bundle
|
||||
# Sublime Text 3 Handlebars
|
||||
|
||||
- Colours of Handlebars expressions are selected to be in contrast with the surrounding HTML.
|
||||
- Handlebars expressions get syntax highlighting in HTML attributes.
|
||||
- Parameters passed to block expressions get syntax highlighting too.
|
||||
- Works both with individual template files and inline templates in script tags.
|
||||
- Key bindings for `{{! Handlebars comments }}` (Sublime only)
|
||||
- <kbd>Tab</kbd> triggers for
|
||||
- `if` → `{{#if }}`
|
||||
- `ifel` → `{{#if }} {{else}}`
|
||||
- `el` → `{{else}}`
|
||||
- `elif` → `{{else if }}`
|
||||
- `un` → `{{#unless }}`
|
||||
- `ea` → `{{#each }}`
|
||||
- `wi` → `{{#with }}`
|
||||
- `par` → `{{> }}` (for partials)
|
||||
- `x-temp` → `<script type="text/x-handlebars" data-template-name="$1">` (inline script tag in HTML files using the Ember recommended `data-template-name` attribute)
|
||||
- `x-id` → `<script type="text/x-handlebars-template" id="$1">` (inline script tag in HTML files using the legacy `id` attribute)
|
||||
Forked from https://github.com/daaain/Handlebars, updated to Sublime-syntax and a bug fixed.
|
||||
|
||||
Since (as of February 2017) the syntax definitions in this repository are driving the highlights on [Github](https://github.com/github/linguist/blob/76d41697aaed6e0354202dd94e07d646c82dfe61/vendor/README.md) and in [Visual Studio Code](https://github.com/Microsoft/vscode/tree/a70621b5a18d6606fffecc05efdcd96463ff0f7f/extensions/handlebars), it's fair game to open issues related to either of these 😺
|
||||
At the time of writing, there is still discussion about fixing this upstream, leaving the future of this fork unclear.
|
||||
|
||||
## About Handlebars.js
|
||||
## Installation
|
||||
|
||||
It's a great JavaScript templating engine, based on [Mustache](http://mustache.github.com/), but amongst others adding the ability to precompile templates and to create custom helpers.
|
||||
Although not on Package Control, installation with git is very easy. Navigate to your Sublime Data directory. For help finding your data directory, see https://docs.sublimetext.io/guide/getting-started/basic-concepts.html#the-data-directory
|
||||
|
||||
Official website: [handlebarsjs.com](http://handlebarsjs.com/)
|
||||
|
||||
## Sublime Text installation
|
||||
|
||||
Get it through [Sublime Package Control](https://packagecontrol.io/).
|
||||
|
||||
If you haven't used it yet, just install it from the link above and then:
|
||||
|
||||
1. Press <kbd>Shift</kbd> + <kbd>Cmd</kbd> + <kbd>P</kbd> (OS X) or <kbd>Shift</kbd> + <kbd>Ctrl</kbd> + <kbd>P</kbd> (Windows)
|
||||
2. Type `install`, to bring up the `Package Control: Install Package` option, and press Enter
|
||||
3. Look for `Handlebars`, and press Enter to install it.
|
||||
4. Choose `Handlebars` in the bottom right corner with one of your template files open (or in case you have inline templates use Handlebars instead of HTML, it's gracefully extending it so you shouldn't lose anything)
|
||||
5. Profit
|
||||
|
||||
Package Control will also auto-update the package from this point on!
|
||||
|
||||
## Atom installation
|
||||
|
||||
1. Open Preferences > Install
|
||||
2. Type `Handlebars` into the search field
|
||||
3. Click the Install button
|
||||
4. Disable the core `language-mustache` package so that it doesn't prevent this package to be used automatically with the supported file extensions
|
||||
|
||||
## Known problems and workarounds
|
||||
|
||||
### Sublime: No auto-complete on closing HTML tags ([#23](https://github.com/daaain/Handlebars/issues/23) & [#49](https://github.com/daaain/Handlebars/issues/49))
|
||||
|
||||
**Problem**: when closing an HTML tag, the tag name doesn't get auto-completed after typing <kbd>/</kbd> (or when using the <kbd>Cmd</kbd> + <kbd>Alt</kbd> + <kbd>.</kbd> (OS X) shortcut anywhere), even though this is the default behaviour with the HTML package.
|
||||
|
||||
**Solution**: installing the [Tag](https://packagecontrol.io/packages/Tag) package re-instates these functionalities and seems to be working well with this one.
|
||||
|
||||
### Sublime: HTML tag pair doesn't get highlighted ([#48](https://github.com/daaain/Handlebars/issues/48))
|
||||
|
||||
**Problem**: moving the cursor over an HTML tag doesn't highlight its pair.
|
||||
|
||||
**Solution**: installing the [BracketHighlighter](https://packagecontrol.io/packages/BracketHighlighter) package nicely solves the problem and adds much more powerful bracket matching than the built-in one.
|
||||
|
||||
### Sublime: Expand selection to tag doesn't work ([#47](https://github.com/daaain/Handlebars/issues/47))
|
||||
|
||||
**Problem**: Expanding selection to tag doesn't work (Sublime command: `expand_selection {"to": "tag"}`).
|
||||
|
||||
**Solution**: if you install the [Emmet](https://packagecontrol.io/packages/Emmet) package you can use the `Match Tag Pair` functionality by pressing <kbd>Ctrl</kbd> + <kbd>D</kbd> (OS X) or <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>A</kbd> (Windows).
|
||||
|
||||
### Sublime: `.sublime-build` in the build system menu ([#73](https://github.com/daaain/Handlebars/issues/73))
|
||||
|
||||
**Problem**: a useless and confusing item named `.sublime-build` is added to the build system menu. This is because the package internally uses a custom build configuration to be able to target both Atom and Sublime and this gets exposed. Though it's only needed for development, Sublime doesn't seem to offer an option to hide this as the package gets installed.
|
||||
|
||||
**Solution**: delete the file from the package by running `zip -d Handlebars.sublime-package ".sublime-build"` in the folder it's installed or by any other means.
|
||||
|
||||
## Testing / contribution
|
||||
|
||||
I've recently stopped heavily using Handlebars at my day job and became a father, so any contributions are more than welcome! I'm still using Github so will make sure to keep on being responsive on issues and pull requests.
|
||||
|
||||
There are some sample templates in `test/` folder. It's possible to see the different supported and yet to be implemented use cases there.
|
||||
|
||||
### Sublime Text
|
||||
|
||||
If you want to work on the package you should install PackageDev either [from Github](https://github.com/SublimeText/PackageDev) or from Package Control. With that you can edit the JSON version (`grammars/Handlebars.json`) and let it export the Plist (`grammars/Handlebars.tmLanguage`) with the ST Build System.
|
||||
|
||||
The nicest development setup I found so far is to have the package installed via Package Control and then symlinking the development Git repo to `Sublime settings folder > Packages`, which then overrides the installed one so you can toggle between them easily.
|
||||
|
||||
Another great trick I found out about recently is the `Show scope name` shortcut (<kbd>Shift</kbd> + <kbd>Ctrl</kbd> + <kbd>P</kbd> (OS X) or <kbd>Shift</kbd> + <kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>P</kbd> (Windows)) which will display the language scope on the status bar based on where your cursor is. If you're getting tired of pressing all these keys all the time, there are a few brilliant packages which do this automatically like the more subtle [ScopeAlways](https://sublime.wbond.net/packages/ScopeAlways) or the full on [ScopeHunter](https://sublime.wbond.net/packages/ScopeHunter) – note: both need to be activated via the Command Palette.
|
||||
|
||||
Resources on ST / Textmate syntax definitions:
|
||||
|
||||
http://docs.sublimetext.info/en/latest/extensibility/syntaxdefs.html
|
||||
http://manual.macromates.com/en/language_grammars
|
||||
|
||||
### Atom
|
||||
|
||||
To see what scope Atom detects under the keyboard cursor, press <kbd>Option</kbd> + <kbd>Cmd</kbd> + <kbd>P</kbd>.
|
||||
|
||||
TODO: add contribution notes
|
||||
TODO: add proper testing based on specs in https://github.com/atom/language-mustache and https://github.com/Sneagan/atom-handlebars
|
||||
|
||||
## Precompilation
|
||||
|
||||
This package does not offer any Handlebars precompilation functionality to keep things simple, but you can use [Guard](https://github.com/guard/guard) (which is a file system watcher) and [Guard-Steering](https://github.com/guard/guard-steering) (a Handlebars precompiler from yours truly) to have all templates precompiled as you save them.
|
||||
|
||||
There's also a [Guard package for Sublime](https://github.com/cyphactor/sublime_guard) if you want integration, but I don't personally use this as I'm happy with Guard running in an iTerm window I can access from anywhere.
|
||||
|
||||
There are of course Node.js / Grunt / Gulp based compilers too ([like this](https://npmjs.org/package/grunt-handlebars-js) and [this](https://www.npmjs.com/package/gulp-compile-handlebars)), but I haven't personally used any yet for precompilation.
|
||||
|
||||
## Credits
|
||||
|
||||
Adapted from the great [sublime-text-handlebars](https://github.com/nrw/sublime-text-handlebars) package by Nicholas Westlake.
|
||||
|
||||
Thanks a lot to all the generous contributors (in alphabetical order): @bittersweetryan, @bradcliffe, @calumbrodie, @duncanbeevers, @hlvnst, @jonschlinkert, @Krutius, @samselikoff, @utkarshkukreti, @zeppelin
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
Then, in a Unix-like shell:
|
||||
```sh
|
||||
Sublime Text$ cd Packages
|
||||
Packages$ git clone https://tildegit.org/matthias/Sublime-Handlebars
|
||||
```
|
||||
|
|
|
@ -1,873 +0,0 @@
|
|||
{
|
||||
"name": "Handlebars",
|
||||
"repository": {
|
||||
"html_tags": {
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "(<)([a-zA-Z0-9:-]+)(?=[^>]*></\\2>)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.html"
|
||||
}
|
||||
},
|
||||
"end": "(>(<)/)(\\2)(>)",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "meta.scope.between-tag-pair.html"
|
||||
},
|
||||
"3": {
|
||||
"name": "entity.name.tag.html"
|
||||
},
|
||||
"4": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
}
|
||||
},
|
||||
"name": "meta.tag.any.html",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#tag-stuff"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "(<\\?)(xml)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.xml.html"
|
||||
}
|
||||
},
|
||||
"end": "(\\?>)",
|
||||
"name": "meta.tag.preprocessor.xml.html",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#tag_generic_attribute"
|
||||
},
|
||||
{
|
||||
"include": "#string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "<!--",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.comment.html"
|
||||
}
|
||||
},
|
||||
"end": "--\\s*>",
|
||||
"name": "comment.block.html",
|
||||
"patterns": [
|
||||
{
|
||||
"match": "--",
|
||||
"name": "invalid.illegal.bad-comments-or-CDATA.html"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "<!",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
}
|
||||
},
|
||||
"end": ">",
|
||||
"name": "meta.tag.sgml.html",
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "(DOCTYPE|doctype)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "entity.name.tag.doctype.html"
|
||||
}
|
||||
},
|
||||
"end": "(?=>)",
|
||||
"name": "meta.tag.sgml.doctype.html",
|
||||
"patterns": [
|
||||
{
|
||||
"match": "\"[^\">]*\"",
|
||||
"name": "string.quoted.double.doctype.identifiers-and-DTDs.html"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "\\[CDATA\\[",
|
||||
"end": "]](?=>)",
|
||||
"name": "constant.other.inline-data.html"
|
||||
},
|
||||
{
|
||||
"match": "(\\s*)(?!--|>)\\S(\\s*)",
|
||||
"name": "invalid.illegal.bad-comments-or-CDATA.html"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "(?:^\\s+)?(<)((?i:style))\\b(?![^>]*/>)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.style.html"
|
||||
},
|
||||
"3": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
}
|
||||
},
|
||||
"end": "(</)((?i:style))(>)(?:\\s*\\n)?",
|
||||
"name": "source.css.embedded.html",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#tag-stuff"
|
||||
},
|
||||
{
|
||||
"begin": "(>)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
}
|
||||
},
|
||||
"end": "(?=</(?i:style))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.css"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "(?:^\\s+)?(<)((?i:script))\\b(?![^>]*/>)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.script.html"
|
||||
}
|
||||
},
|
||||
"end": "(?<=</(script|SCRIPT))(>)(?:\\s*\\n)?",
|
||||
"endCaptures": {
|
||||
"2": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
}
|
||||
},
|
||||
"name": "source.js.embedded.html",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#tag-stuff"
|
||||
},
|
||||
{
|
||||
"begin": "(?<!</(?:script|SCRIPT))(>)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.script.html"
|
||||
}
|
||||
},
|
||||
"end": "(</)((?i:script))",
|
||||
"patterns": [
|
||||
{
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.comment.js"
|
||||
}
|
||||
},
|
||||
"match": "(//).*?((?=</script)|$\\n?)",
|
||||
"name": "comment.line.double-slash.js"
|
||||
},
|
||||
{
|
||||
"begin": "/\\*",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.comment.js"
|
||||
}
|
||||
},
|
||||
"end": "\\*/|(?=</script)",
|
||||
"name": "comment.block.js"
|
||||
},
|
||||
{
|
||||
"include": "source.js"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "(</?)((?i:body|head|html)\\b)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.structure.any.html"
|
||||
}
|
||||
},
|
||||
"end": "(>)",
|
||||
"name": "meta.tag.structure.any.html",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#tag-stuff"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "(</?)((?i:address|blockquote|dd|div|header|section|footer|aside|nav|dl|dt|fieldset|form|frame|frameset|h1|h2|h3|h4|h5|h6|iframe|noframes|object|ol|p|ul|applet|center|dir|hr|menu|pre)\\b)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.block.any.html"
|
||||
}
|
||||
},
|
||||
"end": "(>)",
|
||||
"name": "meta.tag.block.any.html",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#tag-stuff"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "(</?)((?i:a|abbr|acronym|area|b|base|basefont|bdo|big|br|button|caption|cite|code|col|colgroup|del|dfn|em|font|head|html|i|img|input|ins|isindex|kbd|label|legend|li|link|map|meta|noscript|optgroup|option|param|q|s|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|var)\\b)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.inline.any.html"
|
||||
}
|
||||
},
|
||||
"end": "((?: ?/)?>)",
|
||||
"name": "meta.tag.inline.any.html",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#tag-stuff"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "(</?)([a-zA-Z0-9:-]+)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.other.html"
|
||||
}
|
||||
},
|
||||
"end": "(>)",
|
||||
"name": "meta.tag.other.html",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#tag-stuff"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"begin": "(</?)([a-zA-Z0-9{}:-]+)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.tokenised.html"
|
||||
}
|
||||
},
|
||||
"end": "(>)",
|
||||
"name": "meta.tag.tokenised.html",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#tag-stuff"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"include": "#entities"
|
||||
},
|
||||
{
|
||||
"match": "<>",
|
||||
"name": "invalid.illegal.incomplete.html"
|
||||
},
|
||||
{
|
||||
"match": "<",
|
||||
"name": "invalid.illegal.bad-angle-bracket.html"
|
||||
}
|
||||
]
|
||||
},
|
||||
"entities": {
|
||||
"patterns": [
|
||||
{
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.entity.html"
|
||||
},
|
||||
"3": {
|
||||
"name": "punctuation.definition.entity.html"
|
||||
}
|
||||
},
|
||||
"match": "(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)",
|
||||
"name": "constant.character.entity.html"
|
||||
},
|
||||
{
|
||||
"match": "&",
|
||||
"name": "invalid.illegal.bad-ampersand.html"
|
||||
}
|
||||
]
|
||||
},
|
||||
"end_block": {
|
||||
"begin": "(\\{\\{~?/)([a-zA-Z0-9/_\\.-]+)\\s*",
|
||||
"end": "(~?\\}\\})",
|
||||
"name": "meta.function.block.end.handlebars",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "support.constant.handlebars"
|
||||
}
|
||||
},
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "support.constant.handlebars"
|
||||
},
|
||||
"2": {
|
||||
"name": "support.constant.handlebars"
|
||||
}
|
||||
},
|
||||
"patterns": []
|
||||
},
|
||||
"yfm": {
|
||||
"patterns": [
|
||||
{
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.yaml"
|
||||
}
|
||||
],
|
||||
"begin": "(?<!\\s)---\\n$",
|
||||
"end": "^---\\s",
|
||||
"name": "markup.raw.yaml.front-matter"
|
||||
}
|
||||
]
|
||||
},
|
||||
"comments": {
|
||||
"patterns": [
|
||||
{
|
||||
"patterns": [
|
||||
{
|
||||
"name": "keyword.annotation.handlebars",
|
||||
"match": "@\\w*"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
}
|
||||
],
|
||||
"begin": "\\{\\{!",
|
||||
"end": "\\}\\}",
|
||||
"name": "comment.block.handlebars"
|
||||
},
|
||||
{
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.comment.html"
|
||||
}
|
||||
},
|
||||
"begin": "<!--",
|
||||
"end": "-{2,3}\\s*>",
|
||||
"name": "comment.block.html",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "invalid.illegal.bad-comments-or-CDATA.html",
|
||||
"match": "--"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"block_comments": {
|
||||
"patterns": [
|
||||
{
|
||||
"patterns": [
|
||||
{
|
||||
"name": "keyword.annotation.handlebars",
|
||||
"match": "@\\w*"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
}
|
||||
],
|
||||
"begin": "\\{\\{!--",
|
||||
"end": "--\\}\\}",
|
||||
"name": "comment.block.handlebars"
|
||||
},
|
||||
{
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.comment.html"
|
||||
}
|
||||
},
|
||||
"begin": "<!--",
|
||||
"end": "-{2,3}\\s*>",
|
||||
"name": "comment.block.html",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "invalid.illegal.bad-comments-or-CDATA.html",
|
||||
"match": "--"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"entities": {
|
||||
"patterns": [
|
||||
{
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.entity.html"
|
||||
},
|
||||
"3": {
|
||||
"name": "punctuation.definition.entity.html"
|
||||
}
|
||||
},
|
||||
"name": "constant.character.entity.html",
|
||||
"match": "(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)"
|
||||
},
|
||||
{
|
||||
"name": "invalid.illegal.bad-ampersand.html",
|
||||
"match": "&"
|
||||
}
|
||||
]
|
||||
},
|
||||
"block_helper": {
|
||||
"begin": "(\\{\\{~?\\#)([-a-zA-Z0-9_\\./>]+)\\s?(@?[-a-zA-Z0-9_\\./]+)*\\s?(@?[-a-zA-Z0-9_\\./]+)*\\s?(@?[-a-zA-Z0-9_\\./]+)*",
|
||||
"end": "(~?\\}\\})",
|
||||
"name": "meta.function.block.start.handlebars",
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "support.constant.handlebars"
|
||||
}
|
||||
},
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "support.constant.handlebars"
|
||||
},
|
||||
"2": {
|
||||
"name": "support.constant.handlebars"
|
||||
},
|
||||
"3": {
|
||||
"name": "variable.parameter.handlebars"
|
||||
},
|
||||
"4": {
|
||||
"name": "support.constant.handlebars"
|
||||
},
|
||||
"5": {
|
||||
"name": "variable.parameter.handlebars"
|
||||
},
|
||||
"6": {
|
||||
"name": "support.constant.handlebars"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#string"
|
||||
},
|
||||
{
|
||||
"include": "#handlebars_attribute"
|
||||
}
|
||||
]
|
||||
},
|
||||
"string-single-quoted": {
|
||||
"begin": "'",
|
||||
"end": "'",
|
||||
"name": "string.quoted.single.handlebars",
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.string.end.html"
|
||||
}
|
||||
},
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.string.begin.html"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#escaped-single-quote"
|
||||
},
|
||||
{
|
||||
"include": "#block_comments"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#block_helper"
|
||||
},
|
||||
{
|
||||
"include": "#else_token"
|
||||
},
|
||||
{
|
||||
"include": "#end_block"
|
||||
},
|
||||
{
|
||||
"include": "#partial_and_var"
|
||||
}
|
||||
]
|
||||
},
|
||||
"string": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#string-single-quoted"
|
||||
},
|
||||
{
|
||||
"include": "#string-double-quoted"
|
||||
}
|
||||
]
|
||||
},
|
||||
"escaped-single-quote": {
|
||||
"name": "constant.character.escape.js",
|
||||
"match": "\\\\'"
|
||||
},
|
||||
"escaped-double-quote": {
|
||||
"name": "constant.character.escape.js",
|
||||
"match": "\\\\\""
|
||||
},
|
||||
"partial_and_var": {
|
||||
"begin": "(\\{\\{~?\\{*(>|!<)*)\\s*(@?[-a-zA-Z0-9$_\\./]+)*",
|
||||
"end": "(~?\\}\\}\\}*)",
|
||||
"name": "meta.function.inline.other.handlebars",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "support.constant.handlebars"
|
||||
},
|
||||
"3": {
|
||||
"name": "variable.parameter.handlebars"
|
||||
}
|
||||
},
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "support.constant.handlebars"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#string"
|
||||
},
|
||||
{
|
||||
"include": "#handlebars_attribute"
|
||||
}
|
||||
]
|
||||
},
|
||||
"handlebars_attribute_name": {
|
||||
"begin": "\\b([-a-zA-Z0-9_\\.]+)\\b=",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "variable.parameter.handlebars"
|
||||
}
|
||||
},
|
||||
"end": "(?='|\"|)",
|
||||
"name": "entity.other.attribute-name.handlebars"
|
||||
},
|
||||
"handlebars_attribute_value": {
|
||||
"begin": "([-a-zA-Z0-9_\\./]+)\\b",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "variable.parameter.handlebars"
|
||||
}
|
||||
},
|
||||
"end": "('|\"|)",
|
||||
"name": "entity.other.attribute-value.handlebars",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"handlebars_attribute": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#handlebars_attribute_name"
|
||||
},
|
||||
{
|
||||
"include": "#handlebars_attribute_value"
|
||||
}
|
||||
]
|
||||
},
|
||||
"extends": {
|
||||
"patterns": [
|
||||
{
|
||||
"end": "(\\}\\})",
|
||||
"begin": "(\\{\\{!<)\\s([-a-zA-Z0-9_\\./]+)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "support.function.handlebars"
|
||||
},
|
||||
"2": {
|
||||
"name": "support.class.handlebars"
|
||||
}
|
||||
},
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "support.function.handlebars"
|
||||
}
|
||||
},
|
||||
"name": "meta.preprocessor.handlebars"
|
||||
}
|
||||
]
|
||||
},
|
||||
"else_token": {
|
||||
"begin": "(\\{\\{~?else)(@?\\s(if)\\s([-a-zA-Z0-9_\\./]+))?",
|
||||
"end": "(~?\\}\\}\\}*)",
|
||||
"name": "meta.function.inline.else.handlebars",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "support.constant.handlebars"
|
||||
},
|
||||
"3": {
|
||||
"name": "support.constant.handlebars"
|
||||
},
|
||||
"4": {
|
||||
"name": "variable.parameter.handlebars"
|
||||
}
|
||||
},
|
||||
"endCaptures": {
|
||||
"1": {
|
||||
"name": "support.constant.handlebars"
|
||||
}
|
||||
}
|
||||
},
|
||||
"string-double-quoted": {
|
||||
"begin": "\"",
|
||||
"end": "\"",
|
||||
"name": "string.quoted.double.handlebars",
|
||||
"beginCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.string.begin.html"
|
||||
}
|
||||
},
|
||||
"endCaptures": {
|
||||
"0": {
|
||||
"name": "punctuation.definition.string.end.html"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#escaped-double-quote"
|
||||
},
|
||||
{
|
||||
"include": "#block_comments"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#block_helper"
|
||||
},
|
||||
{
|
||||
"include": "#else_token"
|
||||
},
|
||||
{
|
||||
"include": "#end_block"
|
||||
},
|
||||
{
|
||||
"include": "#partial_and_var"
|
||||
}
|
||||
]
|
||||
},
|
||||
"inline_script": {
|
||||
"begin": "(?:^\\s+)?(<)((?i:script))\\b(?:.*(type)=([\"'](?:text/x-handlebars-template|text/x-handlebars|text/template|x-tmpl-handlebars)[\"']))(?![^>]*/>)",
|
||||
"beginCaptures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.script.html"
|
||||
},
|
||||
"3": {
|
||||
"name": "entity.other.attribute-name.html"
|
||||
},
|
||||
"4": {
|
||||
"name": "string.quoted.double.html"
|
||||
}
|
||||
},
|
||||
"end": "(?<=</(script|SCRIPT))(>)(?:\\s*\\n)?",
|
||||
"endCaptures": {
|
||||
"2": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
}
|
||||
},
|
||||
"name": "source.handlebars.embedded.html",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#tag-stuff"
|
||||
},
|
||||
{
|
||||
"begin": "(?<!</(?:script|SCRIPT))(>)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "punctuation.definition.tag.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.tag.script.html"
|
||||
}
|
||||
},
|
||||
"end": "(</)((?i:script))",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#block_comments"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#block_helper"
|
||||
},
|
||||
{
|
||||
"include": "#end_block"
|
||||
},
|
||||
{
|
||||
"include": "#else_token"
|
||||
},
|
||||
{
|
||||
"include": "#partial_and_var"
|
||||
},
|
||||
{
|
||||
"include": "#html_tags"
|
||||
},
|
||||
{
|
||||
"include": "text.html.basic"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"tag_generic_attribute": {
|
||||
"begin": "\\b([a-zA-Z0-9_-]+)\\b\\s*(=)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "entity.other.attribute-name.generic.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.separator.key-value.html"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#string"
|
||||
}
|
||||
],
|
||||
"name": "entity.other.attribute-name.html",
|
||||
"end": "(?<='|\"|)"
|
||||
},
|
||||
"tag_id_attribute": {
|
||||
"begin": "\\b(id)\\b\\s*(=)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "entity.other.attribute-name.id.html"
|
||||
},
|
||||
"2": {
|
||||
"name": "punctuation.separator.key-value.html"
|
||||
}
|
||||
},
|
||||
"end": "(?<='|\"|)",
|
||||
"name": "meta.attribute-with-value.id.html",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tag-stuff": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#tag_id_attribute"
|
||||
},
|
||||
{
|
||||
"include": "#tag_generic_attribute"
|
||||
},
|
||||
{
|
||||
"include": "#string"
|
||||
},
|
||||
{
|
||||
"include": "#block_comments"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#block_helper"
|
||||
},
|
||||
{
|
||||
"include": "#end_block"
|
||||
},
|
||||
{
|
||||
"include": "#else_token"
|
||||
},
|
||||
{
|
||||
"include": "#partial_and_var"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scopeName": "text.html.handlebars",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#yfm"
|
||||
},
|
||||
{
|
||||
"include": "#extends"
|
||||
},
|
||||
{
|
||||
"include": "#block_comments"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#block_helper"
|
||||
},
|
||||
{
|
||||
"include": "#end_block"
|
||||
},
|
||||
{
|
||||
"include": "#else_token"
|
||||
},
|
||||
{
|
||||
"include": "#partial_and_var"
|
||||
},
|
||||
{
|
||||
"include": "#inline_script"
|
||||
},
|
||||
{
|
||||
"include": "#html_tags"
|
||||
},
|
||||
{
|
||||
"include": "text.html.basic"
|
||||
}
|
||||
],
|
||||
"fileTypes": [
|
||||
"handlebars",
|
||||
"handlebars.html",
|
||||
"hbr",
|
||||
"hbrs",
|
||||
"hbs",
|
||||
"hdbs",
|
||||
"hjs",
|
||||
"mu",
|
||||
"mustache",
|
||||
"rac",
|
||||
"stache",
|
||||
"template",
|
||||
"tmpl"
|
||||
],
|
||||
"uuid": "70E91676-DE0A-4266-A2B9-3AD2E535E484"
|
||||
}
|
|
@ -0,0 +1,462 @@
|
|||
%YAML 1.2
|
||||
---
|
||||
# http://www.sublimetext.com/docs/syntax.html
|
||||
name: Sublime Handlebars
|
||||
file_extensions:
|
||||
- handlebars
|
||||
- handlebars.html
|
||||
- hbr
|
||||
- hbrs
|
||||
- hbs
|
||||
- hdbs
|
||||
- hjs
|
||||
- mu
|
||||
- mustache
|
||||
- rac
|
||||
- stache
|
||||
- template
|
||||
- tmpl
|
||||
scope: text.html.handlebars
|
||||
contexts:
|
||||
main:
|
||||
- include: yfm
|
||||
- include: extends
|
||||
- include: block_comments
|
||||
- include: comments
|
||||
- include: block_helper
|
||||
- include: end_block
|
||||
- include: else_token
|
||||
- include: partial_and_var
|
||||
- include: inline_script
|
||||
- include: html_tags
|
||||
- include: scope:text.html.basic
|
||||
block_comments:
|
||||
- match: '\{\{!--'
|
||||
push:
|
||||
- meta_scope: comment.block.handlebars
|
||||
- match: '--\}\}'
|
||||
pop: true
|
||||
- match: '@\w*'
|
||||
scope: keyword.annotation.handlebars
|
||||
- include: comments
|
||||
- match: <!--
|
||||
captures:
|
||||
0: punctuation.definition.comment.html
|
||||
push:
|
||||
- meta_scope: comment.block.html
|
||||
- match: '-{2,3}\s*>'
|
||||
captures:
|
||||
0: punctuation.definition.comment.html
|
||||
pop: true
|
||||
- match: '--'
|
||||
scope: invalid.illegal.bad-comments-or-CDATA.html
|
||||
block_helper:
|
||||
- match: '(\{\{)(~?\#)([-a-zA-Z0-9_\./>]+)\s?(@?[-a-zA-Z0-9_\./]+)*\s?(@?[-a-zA-Z0-9_\./]+)*\s?(@?[-a-zA-Z0-9_\./]+)*'
|
||||
captures:
|
||||
1: support.constant.handlebars
|
||||
2: support.constant.handlebars keyword.control
|
||||
3: support.constant.handlebars keyword.control
|
||||
4: variable.parameter.handlebars
|
||||
5: support.constant.handlebars
|
||||
6: variable.parameter.handlebars
|
||||
7: support.constant.handlebars
|
||||
push:
|
||||
- meta_scope: meta.function.block.start.handlebars
|
||||
- match: '(~?\}\})'
|
||||
captures:
|
||||
1: support.constant.handlebars
|
||||
pop: true
|
||||
- include: string
|
||||
- include: handlebars_attribute
|
||||
comments:
|
||||
- match: '\{\{!'
|
||||
push:
|
||||
- meta_scope: comment.block.handlebars
|
||||
- match: '\}\}'
|
||||
pop: true
|
||||
- match: '@\w*'
|
||||
scope: keyword.annotation.handlebars
|
||||
- include: comments
|
||||
- match: <!--
|
||||
captures:
|
||||
0: punctuation.definition.comment.html
|
||||
push:
|
||||
- meta_scope: comment.block.html
|
||||
- match: '-{2,3}\s*>'
|
||||
captures:
|
||||
0: punctuation.definition.comment.html
|
||||
pop: true
|
||||
- match: '--'
|
||||
scope: invalid.illegal.bad-comments-or-CDATA.html
|
||||
else_token:
|
||||
- match: '(\{\{)(~?else)(@?\s(if)\s([-a-zA-Z0-9_\.\(\s\)/]+))?'
|
||||
captures:
|
||||
1: support.constant.handlebars
|
||||
2: support.constant.handlebars keyword.control
|
||||
3: support.constant.handlebars
|
||||
4: variable.parameter.handlebars
|
||||
push:
|
||||
- meta_scope: meta.function.inline.else.handlebars
|
||||
- match: '(~?\}\}\}*)'
|
||||
captures:
|
||||
1: support.constant.handlebars
|
||||
pop: true
|
||||
end_block:
|
||||
- match: '(\{\{)(~?/)([a-zA-Z0-9/_\.-]+)\s*'
|
||||
captures:
|
||||
1: support.constant.handlebars
|
||||
2: support.constant.handlebars keyword.control
|
||||
3: support.constant.handlebars keyword.control
|
||||
push:
|
||||
- meta_scope: meta.function.block.end.handlebars
|
||||
- match: '(~?\}\})'
|
||||
captures:
|
||||
1: support.constant.handlebars
|
||||
pop: true
|
||||
entities:
|
||||
- match: '(&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)'
|
||||
scope: constant.character.entity.html
|
||||
captures:
|
||||
1: punctuation.definition.entity.html
|
||||
3: punctuation.definition.entity.html
|
||||
- match: '&'
|
||||
scope: invalid.illegal.bad-ampersand.html
|
||||
escaped-double-quote:
|
||||
- match: \\"
|
||||
scope: constant.character.escape.js
|
||||
escaped-single-quote:
|
||||
- match: \\'
|
||||
scope: constant.character.escape.js
|
||||
extends:
|
||||
- match: '(\{\{!<)\s([-a-zA-Z0-9_\./]+)'
|
||||
captures:
|
||||
1: support.function.handlebars
|
||||
2: support.class.handlebars
|
||||
push:
|
||||
- meta_scope: meta.preprocessor.handlebars
|
||||
- match: '(\}\})'
|
||||
captures:
|
||||
1: support.function.handlebars
|
||||
pop: true
|
||||
handlebars_attribute:
|
||||
- include: handlebars_attribute_name
|
||||
- include: handlebars_attribute_value
|
||||
handlebars_attribute_name:
|
||||
- match: '\b([-a-zA-Z0-9_\.]+)\b='
|
||||
captures:
|
||||
1: variable.parameter.handlebars
|
||||
push:
|
||||
- meta_scope: entity.other.attribute-name.handlebars
|
||||
- match: (?='|"|)
|
||||
captures:
|
||||
1: variable.parameter.handlebars
|
||||
pop: true
|
||||
handlebars_attribute_value:
|
||||
- match: '([-a-zA-Z0-9_\./]+)\b'
|
||||
captures:
|
||||
1: variable.parameter.handlebars
|
||||
push:
|
||||
- meta_scope: entity.other.attribute-value.handlebars
|
||||
- match: ('|"|)
|
||||
captures:
|
||||
1: variable.parameter.handlebars
|
||||
pop: true
|
||||
- include: string
|
||||
html_tags:
|
||||
- match: '(<)([a-zA-Z0-9:-]+)(?=[^>]*></\2>)'
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.html
|
||||
push:
|
||||
- meta_scope: meta.tag.any.html
|
||||
- match: (>(<)/)(\2)(>)
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: meta.scope.between-tag-pair.html
|
||||
3: entity.name.tag.html
|
||||
4: punctuation.definition.tag.html
|
||||
pop: true
|
||||
- include: tag-stuff
|
||||
- match: (<\?)(xml)
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.xml.html
|
||||
push:
|
||||
- meta_scope: meta.tag.preprocessor.xml.html
|
||||
- match: (\?>)
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.xml.html
|
||||
pop: true
|
||||
- include: tag_generic_attribute
|
||||
- include: string
|
||||
- match: <!--
|
||||
captures:
|
||||
0: punctuation.definition.comment.html
|
||||
push:
|
||||
- meta_scope: comment.block.html
|
||||
- match: '--\s*>'
|
||||
captures:
|
||||
0: punctuation.definition.comment.html
|
||||
pop: true
|
||||
- match: '--'
|
||||
scope: invalid.illegal.bad-comments-or-CDATA.html
|
||||
- match: <!
|
||||
captures:
|
||||
0: punctuation.definition.tag.html
|
||||
push:
|
||||
- meta_scope: meta.tag.sgml.html
|
||||
- match: '>'
|
||||
captures:
|
||||
0: punctuation.definition.tag.html
|
||||
pop: true
|
||||
- match: (DOCTYPE|doctype)
|
||||
captures:
|
||||
1: entity.name.tag.doctype.html
|
||||
push:
|
||||
- meta_scope: meta.tag.sgml.doctype.html
|
||||
- match: (?=>)
|
||||
captures:
|
||||
1: entity.name.tag.doctype.html
|
||||
pop: true
|
||||
- match: '"[^">]*"'
|
||||
scope: string.quoted.double.doctype.identifiers-and-DTDs.html
|
||||
- match: '\[CDATA\['
|
||||
push:
|
||||
- meta_scope: constant.other.inline-data.html
|
||||
- match: ']](?=>)'
|
||||
pop: true
|
||||
- match: (\s*)(?!--|>)\S(\s*)
|
||||
scope: invalid.illegal.bad-comments-or-CDATA.html
|
||||
- match: '(?:^\s+)?(<)((?i:style))\b(?![^>]*/>)'
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.style.html
|
||||
3: punctuation.definition.tag.html
|
||||
push:
|
||||
- meta_scope: source.css.embedded.html
|
||||
- match: (</)((?i:style))(>)(?:\s*\n)?
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.style.html
|
||||
3: punctuation.definition.tag.html
|
||||
pop: true
|
||||
- include: tag-stuff
|
||||
- match: (>)
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
push:
|
||||
- match: (?=</(?i:style))
|
||||
pop: true
|
||||
- include: scope:source.css
|
||||
- match: '(?:^\s+)?(<)((?i:script))\b(?![^>]*/>)'
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.script.html
|
||||
push:
|
||||
- meta_scope: source.js.embedded.html
|
||||
- match: (?<=</(script|SCRIPT))(>)(?:\s*\n)?
|
||||
captures:
|
||||
2: punctuation.definition.tag.html
|
||||
pop: true
|
||||
- include: tag-stuff
|
||||
- match: (?<!</(?:script|SCRIPT))(>)
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.script.html
|
||||
embed: scope:source.js
|
||||
escape: "(</)(script)"
|
||||
embed_scope: "inner-js-content"
|
||||
escape_captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.script.html
|
||||
- match: (</?)((?i:body|head|html)\b)
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.structure.any.html
|
||||
push:
|
||||
- meta_scope: meta.tag.structure.any.html
|
||||
- match: (>)
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.structure.any.html
|
||||
pop: true
|
||||
- include: tag-stuff
|
||||
- match: (</?)((?i:address|blockquote|dd|div|header|section|footer|aside|nav|dl|dt|fieldset|form|frame|frameset|h1|h2|h3|h4|h5|h6|iframe|noframes|object|ol|p|ul|applet|center|dir|hr|menu|pre)\b)
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.block.any.html
|
||||
push:
|
||||
- meta_scope: meta.tag.block.any.html
|
||||
- match: (>)
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.block.any.html
|
||||
pop: true
|
||||
- include: tag-stuff
|
||||
- match: (</?)((?i:a|abbr|acronym|area|b|base|basefont|bdo|big|br|button|caption|cite|code|col|colgroup|del|dfn|em|font|head|html|i|img|input|ins|isindex|kbd|label|legend|li|link|map|meta|noscript|optgroup|option|param|q|s|samp|script|select|small|span|strike|strong|style|sub|sup|table|tbody|td|textarea|tfoot|th|thead|title|tr|tt|u|var)\b)
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.inline.any.html
|
||||
push:
|
||||
- meta_scope: meta.tag.inline.any.html
|
||||
- match: '((?: ?/)?>)'
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.inline.any.html
|
||||
pop: true
|
||||
- include: tag-stuff
|
||||
- match: '(</?)([a-zA-Z0-9:-]+)'
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.other.html
|
||||
push:
|
||||
- meta_scope: meta.tag.other.html
|
||||
- match: (>)
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.other.html
|
||||
pop: true
|
||||
- include: tag-stuff
|
||||
- match: '(</?)([a-zA-Z0-9{}:-]+)'
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.tokenised.html
|
||||
push:
|
||||
- meta_scope: meta.tag.tokenised.html
|
||||
- match: (>)
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.tokenised.html
|
||||
pop: true
|
||||
- include: tag-stuff
|
||||
- include: entities
|
||||
- match: <>
|
||||
scope: invalid.illegal.incomplete.html
|
||||
- match: <
|
||||
scope: invalid.illegal.bad-angle-bracket.html
|
||||
inline_script:
|
||||
- match: '(?:^\s+)?(<)((?i:script))\b(?:.*(type)=(["''](?:text/x-handlebars-template|text/x-handlebars|text/template|x-tmpl-handlebars)["'']))(?![^>]*/>)'
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.script.html
|
||||
3: entity.other.attribute-name.html
|
||||
4: string.quoted.double.html
|
||||
push:
|
||||
- meta_scope: source.handlebars.embedded.html
|
||||
- match: (?<=</(script|SCRIPT))(>)(?:\s*\n)?
|
||||
captures:
|
||||
2: punctuation.definition.tag.html
|
||||
pop: true
|
||||
- include: tag-stuff
|
||||
- match: (?<!</(?:script|SCRIPT))(>)
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.script.html
|
||||
push:
|
||||
- match: (</)((?i:script))
|
||||
captures:
|
||||
1: punctuation.definition.tag.html
|
||||
2: entity.name.tag.script.html
|
||||
pop: true
|
||||
- include: block_comments
|
||||
- include: comments
|
||||
- include: block_helper
|
||||
- include: end_block
|
||||
- include: else_token
|
||||
- include: partial_and_var
|
||||
- include: html_tags
|
||||
- include: scope:text.html.basic
|
||||
partial_and_var:
|
||||
- match: '(\{\{~?\{*(>|!<)*)\s*(@?[-a-zA-Z0-9$_\./]+)*'
|
||||
captures:
|
||||
1: support.constant.handlebars
|
||||
3: variable.parameter.handlebars
|
||||
push:
|
||||
- meta_scope: meta.function.inline.other.handlebars
|
||||
- match: '(~?\}\}\}*)'
|
||||
captures:
|
||||
1: support.constant.handlebars
|
||||
pop: true
|
||||
- include: string
|
||||
- include: handlebars_attribute
|
||||
string:
|
||||
- include: string-single-quoted
|
||||
- include: string-double-quoted
|
||||
string-double-quoted:
|
||||
- match: '"'
|
||||
captures:
|
||||
0: punctuation.definition.string.begin.html
|
||||
push:
|
||||
- meta_scope: string.quoted.double.handlebars
|
||||
- match: '"'
|
||||
captures:
|
||||
0: punctuation.definition.string.end.html
|
||||
pop: true
|
||||
- include: escaped-double-quote
|
||||
- include: block_comments
|
||||
- include: comments
|
||||
- include: block_helper
|
||||
- include: else_token
|
||||
- include: end_block
|
||||
- include: partial_and_var
|
||||
string-single-quoted:
|
||||
- match: "'"
|
||||
captures:
|
||||
0: punctuation.definition.string.begin.html
|
||||
push:
|
||||
- meta_scope: string.quoted.single.handlebars
|
||||
- match: "'"
|
||||
captures:
|
||||
0: punctuation.definition.string.end.html
|
||||
pop: true
|
||||
- include: escaped-single-quote
|
||||
- include: block_comments
|
||||
- include: comments
|
||||
- include: block_helper
|
||||
- include: else_token
|
||||
- include: end_block
|
||||
- include: partial_and_var
|
||||
tag-stuff:
|
||||
- include: tag_id_attribute
|
||||
- include: tag_generic_attribute
|
||||
- include: string
|
||||
- include: block_comments
|
||||
- include: comments
|
||||
- include: block_helper
|
||||
- include: end_block
|
||||
- include: else_token
|
||||
- include: partial_and_var
|
||||
tag_generic_attribute:
|
||||
- match: '\b([a-zA-Z0-9_-]+)\b\s*(=)'
|
||||
captures:
|
||||
1: entity.other.attribute-name.generic.html
|
||||
2: punctuation.separator.key-value.html
|
||||
push:
|
||||
- meta_scope: entity.other.attribute-name.html
|
||||
- match: (?<='|"|)
|
||||
captures:
|
||||
1: entity.other.attribute-name.generic.html
|
||||
2: punctuation.separator.key-value.html
|
||||
pop: true
|
||||
- include: string
|
||||
tag_id_attribute:
|
||||
- match: \b(id)\b\s*(=)
|
||||
captures:
|
||||
1: entity.other.attribute-name.id.html
|
||||
2: punctuation.separator.key-value.html
|
||||
push:
|
||||
- meta_scope: meta.attribute-with-value.id.html
|
||||
- match: (?<='|"|)
|
||||
captures:
|
||||
1: entity.other.attribute-name.id.html
|
||||
2: punctuation.separator.key-value.html
|
||||
pop: true
|
||||
- include: string
|
||||
yfm:
|
||||
- match: (?<!\s)---\n$
|
||||
push:
|
||||
- meta_scope: markup.raw.yaml.front-matter
|
||||
- match: ^---\s
|
||||
pop: true
|
||||
- include: scope:source.yaml
|
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
|
@ -1,11 +1,8 @@
|
|||
{
|
||||
"name": "Handlebars",
|
||||
"version": "1.7.1",
|
||||
"description": "Fullest Handlebars syntax support for Atom",
|
||||
"repository": "https://github.com/daaain/Handlebars",
|
||||
"name": "Sublime Handlebars",
|
||||
"version": "2.0.0",
|
||||
"description": "Handlebars syntax support for Sublime Text 4",
|
||||
"repository": "https://tildegit.org/matthias/Sublime-Handlebars",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"atom": ">0.50.0"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<p>Testing <strong>{{{testToken}}}</strong> {{#if otherCondition}}<strong>"{{otherTestToken}}"</strong> {{/if}}</p>
|
||||
{{else}}
|
||||
<p>'Thus spoke Zarathustra' – "ORLY?"</p>
|
||||
{{/if}}
|
||||
|
||||
<div class="{{class}}{{#if shouldBeRed}} red{{/if}}">
|
||||
<custom-element>Test</custom-element>
|
||||
|
@ -77,6 +78,8 @@
|
|||
<p>First</p>
|
||||
{{else if alternate}}
|
||||
<p>Second</p>
|
||||
{{else if (sub-exp this.message)}}
|
||||
<p>Third</p>
|
||||
{{/if}}
|
||||
|
||||
{{#x-card onsubmit=attrs.onsubmit title='Login to Peepchat' buttonText='Login'}}
|
||||
|
|
Reference in New Issue