From 20fdac95f67523468e6544edda5b652140a00a70 Mon Sep 17 00:00:00 2001 From: Michael Hadley Date: Thu, 25 May 2017 01:15:32 -0700 Subject: [PATCH] Add Closure Templates (#3634) * Add Closure Templates to languages.yml * Run script/add-grammar * Add sample * Run script/set-language-ids * Add codemirror_mime_type --- .gitmodules | 3 +++ grammars.yml | 2 ++ lib/linguist/languages.yml | 15 +++++++++-- samples/Closure Templates/example.soy | 24 +++++++++++++++++ vendor/README.md | 1 + vendor/grammars/language-closure-templates | 1 + .../grammar/language-closure-templates.txt | 26 +++++++++++++++++++ 7 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 samples/Closure Templates/example.soy create mode 160000 vendor/grammars/language-closure-templates create mode 100644 vendor/licenses/grammar/language-closure-templates.txt diff --git a/.gitmodules b/.gitmodules index cce6dbd4..db054dfe 100644 --- a/.gitmodules +++ b/.gitmodules @@ -845,3 +845,6 @@ [submodule "vendor/grammars/dartlang"] path = vendor/grammars/dartlang url = https://github.com/dart-atom/dartlang +[submodule "vendor/grammars/language-closure-templates"] + path = vendor/grammars/language-closure-templates + url = https://github.com/mthadley/language-closure-templates diff --git a/grammars.yml b/grammars.yml index 3ed4460b..d9ef658e 100755 --- a/grammars.yml +++ b/grammars.yml @@ -358,6 +358,8 @@ vendor/grammars/language-click: - source.click vendor/grammars/language-clojure: - source.clojure +vendor/grammars/language-closure-templates: +- text.html.soy vendor/grammars/language-coffee-script: - source.coffee - source.litcoffee diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 53ce4099..fb5d73ca 100755 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -2,8 +2,7 @@ # # type - Either data, programming, markup, prose, or nil # aliases - An Array of additional aliases (implicitly -# includes the lowercase name with spaces replaced -# by dashes) +# includes name.downcase) # ace_mode - A String name of the Ace Mode used for highlighting whenever # a file is edited. This must match one of the filenames in http://git.io/3XO_Cg. # Use "text" if a mode does not exist. @@ -688,6 +687,18 @@ Clojure: filenames: - riemann.config language_id: 62 +Closure Templates: + type: markup + group: HTML + ace_mode: soy_template + codemirror_mode: soy + codemirror_mime_type: text/x-soy + alias: + - soy + extensions: + - ".soy" + tm_scope: text.html.soy + language_id: 357046146 CoffeeScript: type: programming tm_scope: source.coffee diff --git a/samples/Closure Templates/example.soy b/samples/Closure Templates/example.soy new file mode 100644 index 00000000..2976eaa8 --- /dev/null +++ b/samples/Closure Templates/example.soy @@ -0,0 +1,24 @@ +{namespace Exmaple} + +/** + * Example + */ +{template .foo} + {@param count: string} + {@param? name: int} + + {if isNonnull($name)} +

{$name}

+ {/if} + +
+ {switch count} + {case 0} + {call Empty.view} + {param count: $count /} + {/call} + {default} +

Wow, so many!

+ {/switch} +
+{/template} diff --git a/vendor/README.md b/vendor/README.md index 29e31733..cd6d9619 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -59,6 +59,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting - **Click:** [stenverbois/language-click](https://github.com/stenverbois/language-click) - **CLIPS:** [psicomante/CLIPS-sublime](https://github.com/psicomante/CLIPS-sublime) - **Clojure:** [atom/language-clojure](https://github.com/atom/language-clojure) +- **Closure Templates:** [mthadley/language-closure-templates](https://github.com/mthadley/language-closure-templates) - **CMake:** [textmate/cmake.tmbundle](https://github.com/textmate/cmake.tmbundle) - **COBOL:** [bitbucket:bitlang/sublime_cobol](https://bitbucket.org/bitlang/sublime_cobol) - **CoffeeScript:** [atom/language-coffee-script](https://github.com/atom/language-coffee-script) diff --git a/vendor/grammars/language-closure-templates b/vendor/grammars/language-closure-templates new file mode 160000 index 00000000..beed1f87 --- /dev/null +++ b/vendor/grammars/language-closure-templates @@ -0,0 +1 @@ +Subproject commit beed1f87f392ff22919ba9b33d84ed9064453329 diff --git a/vendor/licenses/grammar/language-closure-templates.txt b/vendor/licenses/grammar/language-closure-templates.txt new file mode 100644 index 00000000..8ac352bc --- /dev/null +++ b/vendor/licenses/grammar/language-closure-templates.txt @@ -0,0 +1,26 @@ +--- +type: grammar +name: language-closure-templates +license: mit +--- +MIT License + +Copyright (c) 2017 Michael T. Hadley + +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.