summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Hubert <kjmph@users.noreply.github.com>2020-10-29 14:33:09 -0400
committerGitHub <noreply@github.com>2020-10-29 19:33:09 +0100
commit072fb380d82df11e167d34b6a37dfe9fe1a2fb19 (patch)
tree342dbe5541f61a7e5bba6ef385ca7ca91b26c944
parent85594956cfd0874849e08bf45320c98acb4adb59 (diff)
Add Svelte as a syntax
-rw-r--r--.gitmodules3
-rw-r--r--CHANGELOG.md1
m---------assets/syntaxes/02_Extra/Svelte0
-rw-r--r--tests/syntax-tests/highlighted/Svelte/App.svelte57
-rw-r--r--tests/syntax-tests/source/Svelte/App.svelte57
-rw-r--r--tests/syntax-tests/source/Svelte/LICENSE14
6 files changed, 132 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
index 09ef55f3..e25256f1 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -197,6 +197,9 @@
[submodule "assets/syntaxes/02_Extra/Apache"]
path = assets/syntaxes/02_Extra/Apache
url = https://github.com/colinta/ApacheConf.tmLanguage
+[submodule "assets/syntaxes/02_Extra/Svelte"]
+ path = assets/syntaxes/02_Extra/Svelte
+ url = https://github.com/corneliusio/svelte-sublime
[submodule "assets/themes/Coldark"]
path = assets/themes/Coldark
url = https://github.com/ArmandPhilippot/coldark-bat.git
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f67e3bf8..f374dd3a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@
## Syntaxes
- Manpage syntax highlighting has been improved, see #1315 (@keith-hall)
+- Add Svelte file syntax, see #1285 (@kjmph)
## New themes
diff --git a/assets/syntaxes/02_Extra/Svelte b/assets/syntaxes/02_Extra/Svelte
new file mode 160000
+Subproject bf92f5b7b69c8ea641d6822fd6d12cc2d934195
diff --git a/tests/syntax-tests/highlighted/Svelte/App.svelte b/tests/syntax-tests/highlighted/Svelte/App.svelte
new file mode 100644
index 00000000..aff961d5
--- /dev/null
+++ b/tests/syntax-tests/highlighted/Svelte/App.svelte
@@ -0,0 +1,57 @@
+<script>
+ import { onMount } from 'svelte';
+ import List from './List.svelte';
+ import Item from './Item.svelte';
+
+ let item;
+ let page;
+
+ async function hashchange() {
+ // the poor man's router!
+ const path = window.location.hash.slice(1);
+
+ if (path.startsWith('/item')) {
+ const id = path.slice(6);
+ item = await fetch(`https://node-hnapi.herokuapp.com/item/${id}`).then(r => r.json());
+
+ window.scrollTo(0,0);
+ } else if (path.startsWith('/top')) {
+ page = +path.slice(5);
+ item = null;
+ } else {
+ window.location.hash = '/top/1';
+ }
+ }
+
+ onMount(hashchange);
+</script>
+
+<style>
+ main {
+ position: relative;
+ max-width: 800px;
+ margin: 0 auto;
+ min-height: 101vh;
+ padding: 1em;
+ }
+
+ main :global(.meta) {
+ color: #999;
+ font-size: 12px;
+ margin: 0 0 1em 0;
+ }
+
+ main :global(a) {
+ color: rgb(0,0,150);
+ }
+</style>
+
+<svelte:window on:hashchange={hashchange}/>
+
+<main>
+ {#if item}
+ <Item {item} returnTo="#/top/{page}"/>
+ {:else if page}
+ <List {page}/>
+ {/if}
+</main>
diff --git a/tests/syntax-tests/source/Svelte/App.svelte b/tests/syntax-tests/source/Svelte/App.svelte
new file mode 100644
index 00000000..0ede0a00
--- /dev/null
+++ b/tests/syntax-tests/source/Svelte/App.svelte
@@ -0,0 +1,57 @@
+<script>
+ import { onMount } from 'svelte';
+ import List from './List.svelte';
+ import Item from './Item.svelte';
+
+ let item;
+ let page;
+
+ async function hashchange() {
+ // the poor man's router!
+ const path = window.location.hash.slice(1);
+
+ if (path.startsWith('/item')) {
+ const id = path.slice(6);
+ item = await fetch(`https://node-hnapi.herokuapp.com/item/${id}`).then(r => r.json());
+
+ window.scrollTo(0,0);
+ } else if (path.startsWith('/top')) {
+ page = +path.slice(5);
+ item = null;
+ } else {
+ window.location.hash = '/top/1';
+ }
+ }
+
+ onMount(hashchange);
+</script>
+
+<style>
+ main {
+ position: relative;
+ max-width: 800px;
+ margin: 0 auto;
+ min-height: 101vh;
+ padding: 1em;
+ }
+
+ main :global(.meta) {
+ color: #999;
+ font-size: 12px;
+ margin: 0 0 1em 0;
+ }
+
+ main :global(a) {
+ color: rgb(0,0,150);
+ }
+</style>
+
+<svelte:window on:hashchange={hashchange}/>
+
+<main>
+ {#if item}
+ <Item {item} returnTo="#/top/{page}"/>
+ {:else if page}
+ <List {page}/>
+ {/if}
+</main>
diff --git a/tests/syntax-tests/source/Svelte/LICENSE b/tests/syntax-tests/source/Svelte/LICENSE
new file mode 100644
index 00000000..91bf34d4
--- /dev/null
+++ b/tests/syntax-tests/source/Svelte/LICENSE
@@ -0,0 +1,14 @@
+The `App.svelte` file has been added from:
+
+https://github.com/sveltejs/svelte/blob/master/site/content/examples/21-miscellaneous/01-hacker-news/App.svelte
+
+Under the following license:
+
+
+Copyright (c) 2016-20 [these people](https://github.com/sveltejs/svelte/graphs/contributors)
+
+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.