mirror of https://github.com/sharkdp/bat.git
Add Svelte as a syntax
This commit is contained in:
parent
85594956cf
commit
072fb380d8
|
@ -197,6 +197,9 @@
|
||||||
[submodule "assets/syntaxes/02_Extra/Apache"]
|
[submodule "assets/syntaxes/02_Extra/Apache"]
|
||||||
path = assets/syntaxes/02_Extra/Apache
|
path = assets/syntaxes/02_Extra/Apache
|
||||||
url = https://github.com/colinta/ApacheConf.tmLanguage
|
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"]
|
[submodule "assets/themes/Coldark"]
|
||||||
path = assets/themes/Coldark
|
path = assets/themes/Coldark
|
||||||
url = https://github.com/ArmandPhilippot/coldark-bat.git
|
url = https://github.com/ArmandPhilippot/coldark-bat.git
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
## Syntaxes
|
## Syntaxes
|
||||||
|
|
||||||
- Manpage syntax highlighting has been improved, see #1315 (@keith-hall)
|
- Manpage syntax highlighting has been improved, see #1315 (@keith-hall)
|
||||||
|
- Add Svelte file syntax, see #1285 (@kjmph)
|
||||||
|
|
||||||
## New themes
|
## New themes
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit bf92f5b7b69c8ea641d6822fd6d12cc2d9341956
|
|
@ -0,0 +1,57 @@
|
||||||
|
[38;2;255;255;255m<[0m[3;38;2;249;38;114mscript[0m[38;2;255;255;255m>[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;255;255;255monMount[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114mfrom[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116msvelte[0m[38;2;230;219;116m'[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;255;255;255mList[0m[38;2;248;248;242m [0m[38;2;249;38;114mfrom[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m./List.svelte[0m[38;2;230;219;116m'[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;255;255;255mItem[0m[38;2;248;248;242m [0m[38;2;249;38;114mfrom[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m./Item.svelte[0m[38;2;230;219;116m'[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mitem[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mlet[0m[38;2;248;248;242m [0m[38;2;255;255;255mpage[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239masync[0m[38;2;166;226;46m [0m[3;38;2;102;217;239mfunction[0m[38;2;166;226;46m [0m[38;2;166;226;46mhashchange[0m[38;2;255;255;255m([0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m//[0m[38;2;117;113;94m the poor man's router![0m
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mconst[0m[38;2;248;248;242m [0m[38;2;255;255;255mpath[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;166;226;46mwindow[0m[38;2;255;255;255m.[0m[38;2;255;255;255mlocation[0m[38;2;255;255;255m.[0m[38;2;255;255;255mhash[0m[38;2;255;255;255m.[0m[38;2;248;248;242mslice[0m[38;2;255;255;255m([0m[38;2;174;129;255m1[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255mpath[0m[38;2;255;255;255m.[0m[38;2;248;248;242mstartsWith[0m[38;2;255;255;255m([0m[38;2;230;219;116m'[0m[38;2;230;219;116m/item[0m[38;2;230;219;116m'[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mconst[0m[38;2;248;248;242m [0m[38;2;255;255;255mid[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;255;255;255mpath[0m[38;2;255;255;255m.[0m[38;2;248;248;242mslice[0m[38;2;255;255;255m([0m[38;2;174;129;255m6[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;255;255;255mitem[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mawait[0m[38;2;248;248;242m [0m[38;2;248;248;242mfetch[0m[38;2;255;255;255m([0m[38;2;249;38;114m`[0m[38;2;230;219;116mh[0m[38;2;230;219;116mt[0m[38;2;230;219;116mt[0m[38;2;230;219;116mp[0m[38;2;230;219;116ms[0m[38;2;230;219;116m:[0m[38;2;230;219;116m/[0m[38;2;230;219;116m/[0m[38;2;230;219;116mn[0m[38;2;230;219;116mo[0m[38;2;230;219;116md[0m[38;2;230;219;116me[0m[38;2;230;219;116m-[0m[38;2;230;219;116mh[0m[38;2;230;219;116mn[0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mi[0m[38;2;230;219;116m.[0m[38;2;230;219;116mh[0m[38;2;230;219;116me[0m[38;2;230;219;116mr[0m[38;2;230;219;116mo[0m[38;2;230;219;116mk[0m[38;2;230;219;116mu[0m[38;2;230;219;116ma[0m[38;2;230;219;116mp[0m[38;2;230;219;116mp[0m[38;2;230;219;116m.[0m[38;2;230;219;116mc[0m[38;2;230;219;116mo[0m[38;2;230;219;116mm[0m[38;2;230;219;116m/[0m[38;2;230;219;116mi[0m[38;2;230;219;116mt[0m[38;2;230;219;116me[0m[38;2;230;219;116mm[0m[38;2;230;219;116m/[0m[38;2;249;38;114m${[0m[38;2;255;255;255mid[0m[38;2;249;38;114m}[0m[38;2;249;38;114m`[0m[38;2;255;255;255m)[0m[38;2;255;255;255m.[0m[38;2;248;248;242mthen[0m[38;2;255;255;255m([0m[3;38;2;253;151;31mr[0m[38;2;248;248;242m [0m[3;38;2;102;217;239m=>[0m[38;2;248;248;242m [0m[38;2;255;255;255mr[0m[38;2;255;255;255m.[0m[38;2;248;248;242mjson[0m[38;2;248;248;242m()[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;166;226;46mwindow[0m[38;2;255;255;255m.[0m[38;2;248;248;242mscrollTo[0m[38;2;255;255;255m([0m[38;2;174;129;255m0[0m[38;2;248;248;242m,[0m[38;2;174;129;255m0[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;255;255;255m([0m[38;2;255;255;255mpath[0m[38;2;255;255;255m.[0m[38;2;248;248;242mstartsWith[0m[38;2;255;255;255m([0m[38;2;230;219;116m'[0m[38;2;230;219;116m/top[0m[38;2;230;219;116m'[0m[38;2;255;255;255m)[0m[38;2;255;255;255m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;255;255;255mpage[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m+[0m[38;2;255;255;255mpath[0m[38;2;255;255;255m.[0m[38;2;248;248;242mslice[0m[38;2;255;255;255m([0m[38;2;174;129;255m5[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;255;255;255mitem[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mnull[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;166;226;46mwindow[0m[38;2;255;255;255m.[0m[38;2;255;255;255mlocation[0m[38;2;255;255;255m.[0m[38;2;255;255;255mhash[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;230;219;116m'[0m[38;2;230;219;116m/top/1[0m[38;2;230;219;116m'[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;248;248;242monMount[0m[38;2;255;255;255m([0m[38;2;255;255;255mhashchange[0m[38;2;255;255;255m)[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;255;255;255m</[0m[3;38;2;249;38;114mscript[0m[38;2;255;255;255m>[0m
|
||||||
|
|
||||||
|
[38;2;255;255;255m<[0m[38;2;249;38;114mstyle[0m[38;2;255;255;255m>[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mmain[0m[38;2;248;248;242m [0m[38;2;255;255;255m{[0m
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mposition[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrelative[0m[38;2;255;255;255m;[0m
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mmax-width[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m800[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mmargin[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;102;217;239mauto[0m[38;2;255;255;255m;[0m
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mmin-height[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m101[0m[38;2;249;38;114mvh[0m[38;2;255;255;255m;[0m
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mpadding[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;249;38;114mem[0m[38;2;255;255;255m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;255;255;255m}[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mmain[0m[38;2;248;248;242m [0m[38;2;166;226;46m:[0m[38;2;166;226;46mglobal[0m[38;2;248;248;242m([0m[38;2;166;226;46m.[0m[38;2;166;226;46mmeta[0m[38;2;248;248;242m) [0m[38;2;255;255;255m{[0m
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mcolor[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m#[0m[38;2;190;132;255m999[0m[38;2;255;255;255m;[0m
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mfont-size[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m12[0m[38;2;249;38;114mpx[0m[38;2;255;255;255m;[0m
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mmargin[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;249;38;114mem[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;255;255;255m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;255;255;255m}[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mmain[0m[38;2;248;248;242m [0m[38;2;166;226;46m:[0m[38;2;166;226;46mglobal[0m[38;2;248;248;242m([0m[38;2;249;38;114ma[0m[38;2;248;248;242m) [0m[38;2;255;255;255m{[0m
|
||||||
|
[38;2;248;248;242m [0m[3;38;2;102;217;239mcolor[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrgb[0m[38;2;255;255;255m([0m[38;2;190;132;255m0[0m[38;2;248;248;242m,[0m[38;2;190;132;255m0[0m[38;2;248;248;242m,[0m[38;2;190;132;255m150[0m[38;2;255;255;255m)[0m[38;2;255;255;255m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;255;255;255m}[0m
|
||||||
|
[38;2;255;255;255m</[0m[38;2;249;38;114mstyle[0m[38;2;255;255;255m>[0m
|
||||||
|
|
||||||
|
[38;2;255;255;255m<[0m[38;2;249;38;114msvelte:window[0m[38;2;248;248;242m [0m[38;2;102;217;239mon[0m[38;2;166;226;46m:[0m[38;2;230;219;116mhashchange[0m[38;2;166;226;46m=[0m[38;2;248;248;242m{[0m[38;2;255;255;255mhashchange[0m[38;2;248;248;242m}[0m[38;2;255;255;255m/>[0m
|
||||||
|
|
||||||
|
[38;2;255;255;255m<[0m[38;2;249;38;114mmain[0m[38;2;255;255;255m>[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;249;38;114m#if[0m[38;2;248;248;242m [0m[38;2;255;255;255mitem[0m[38;2;248;248;242m}[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;255;255;255m<[0m[38;2;249;38;114mItem[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;255;255;255mitem[0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;166;226;46mreturnTo[0m[38;2;166;226;46m=[0m[38;2;255;255;255m"[0m[38;2;230;219;116m#/top/[0m[38;2;230;219;116m{[0m[38;2;255;255;255mpage[0m[38;2;230;219;116m}[0m[38;2;255;255;255m"[0m[38;2;255;255;255m/>[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;249;38;114m:else if[0m[38;2;248;248;242m [0m[38;2;255;255;255mpage[0m[38;2;248;248;242m}[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;255;255;255m<[0m[38;2;249;38;114mList[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;255;255;255mpage[0m[38;2;248;248;242m}[0m[38;2;255;255;255m/>[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;249;38;114m/if[0m[38;2;248;248;242m}[0m
|
||||||
|
[38;2;255;255;255m</[0m[38;2;249;38;114mmain[0m[38;2;255;255;255m>[0m
|
|
@ -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>
|
|
@ -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.
|
Loading…
Reference in New Issue