From 3bbfc907f382dad5877966e7114c9ce359db2be8 Mon Sep 17 00:00:00 2001 From: Michael Rawlings Date: Fri, 17 Mar 2017 02:46:20 -0700 Subject: [PATCH] [Add Language] Marko (#3519) * add marko * update marko --- .gitmodules | 3 ++ grammars.yml | 2 ++ lib/linguist/languages.yml | 12 ++++++++ samples/Marko/counter.marko | 26 ++++++++++++++++ samples/Marko/hello.marko | 15 +++++++++ samples/Marko/rgb-sliders.marko | 36 ++++++++++++++++++++++ vendor/README.md | 1 + vendor/grammars/marko-tmbundle | 1 + vendor/licenses/grammar/marko-tmbundle.txt | 25 +++++++++++++++ 9 files changed, 121 insertions(+) create mode 100644 samples/Marko/counter.marko create mode 100644 samples/Marko/hello.marko create mode 100644 samples/Marko/rgb-sliders.marko create mode 160000 vendor/grammars/marko-tmbundle create mode 100644 vendor/licenses/grammar/marko-tmbundle.txt diff --git a/.gitmodules b/.gitmodules index 4a0961a4..10fe99af 100644 --- a/.gitmodules +++ b/.gitmodules @@ -833,3 +833,6 @@ [submodule "vendor/grammars/openscad.tmbundle"] path = vendor/grammars/openscad.tmbundle url = https://github.com/tbuser/openscad.tmbundle +[submodule "vendor/grammars/marko-tmbundle"] + path = vendor/grammars/marko-tmbundle + url = https://github.com/marko-js/marko-tmbundle diff --git a/grammars.yml b/grammars.yml index 2f566a9e..6ce1c294 100755 --- a/grammars.yml +++ b/grammars.yml @@ -489,6 +489,8 @@ vendor/grammars/make.tmbundle: - source.makefile vendor/grammars/mako-tmbundle: - text.html.mako +vendor/grammars/marko-tmbundle: +- text.marko vendor/grammars/mathematica-tmbundle: - source.mathematica vendor/grammars/matlab.tmbundle: diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 53fb09c4..e4588c08 100755 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -2471,6 +2471,18 @@ Markdown: - ".ron" tm_scope: source.gfm language_id: 222 +Marko: + group: HTML + type: markup + tm_scope: text.marko + extensions: + - ".marko" + aliases: + - markojs + ace_mode: text + codemirror_mode: htmlmixed + codemirror_mime_type: text/html + language_id: 932782397 Mask: type: markup color: "#f97732" diff --git a/samples/Marko/counter.marko b/samples/Marko/counter.marko new file mode 100644 index 00000000..b9ab9fc8 --- /dev/null +++ b/samples/Marko/counter.marko @@ -0,0 +1,26 @@ +class { + constructor() { + this.state = { count:0 }; + } + increment() { + this.state.count++; + } +} + +style { + .count { + color:#09c; + font-size:3em; + } + .example-button { + font-size:1em; + padding:0.5em; + } +} + + + ${state.count} + + + Click me! + \ No newline at end of file diff --git a/samples/Marko/hello.marko b/samples/Marko/hello.marko new file mode 100644 index 00000000..3d550b0e --- /dev/null +++ b/samples/Marko/hello.marko @@ -0,0 +1,15 @@ +$ var name = 'Frank'; +$ var colors = ['red', 'green', 'blue']; + +

+ Hello ${name}! +

+ +
    +
  • + ${color} +
  • +
+
+ No colors! +
diff --git a/samples/Marko/rgb-sliders.marko b/samples/Marko/rgb-sliders.marko new file mode 100644 index 00000000..91b13915 --- /dev/null +++ b/samples/Marko/rgb-sliders.marko @@ -0,0 +1,36 @@ +static const colors = ['red', 'green', 'blue']; +static const defaultColor = [255, 0, 0]; + +class { + onInput(input) { + this.state = { color: input.color || defaultColor }; + } + + updateColor() { + this.state.color = colors.map((color) => { + return parseInt(this.getEl(color + 'Input').value, 10); + }); + } + + getStyleColor() { + return 'rgb(' + this.state.color.join(',') + ')'; + } +} + + + + +
+ + +
+ + + + + diff --git a/vendor/README.md b/vendor/README.md index 13819bac..5357f9e9 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -195,6 +195,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting - **Makefile:** [textmate/make.tmbundle](https://github.com/textmate/make.tmbundle) - **Mako:** [marconi/mako-tmbundle](https://github.com/marconi/mako-tmbundle) - **Markdown:** [atom/language-gfm](https://github.com/atom/language-gfm) +- **Marko:** [marko-js/marko-tmbundle](https://github.com/marko-js/marko-tmbundle) - **Mask:** [tenbits/sublime-mask](https://github.com/tenbits/sublime-mask) - **Mathematica:** [shadanan/mathematica-tmbundle](https://github.com/shadanan/mathematica-tmbundle) - **Matlab:** [textmate/matlab.tmbundle](https://github.com/textmate/matlab.tmbundle) diff --git a/vendor/grammars/marko-tmbundle b/vendor/grammars/marko-tmbundle new file mode 160000 index 00000000..bbfc8db3 --- /dev/null +++ b/vendor/grammars/marko-tmbundle @@ -0,0 +1 @@ +Subproject commit bbfc8db307890fb5df8fbf35b0a1c5af9193dd59 diff --git a/vendor/licenses/grammar/marko-tmbundle.txt b/vendor/licenses/grammar/marko-tmbundle.txt new file mode 100644 index 00000000..72ed713b --- /dev/null +++ b/vendor/licenses/grammar/marko-tmbundle.txt @@ -0,0 +1,25 @@ +--- +type: grammar +name: marko-tmbundle +license: mit +--- +The MIT License (MIT) + +Copyright (c) 2014 David Rios + +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.