aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Nicolas Veigel <art.jnveigel@gmail.com>2024-03-16 05:29:02 +0100
committerLouis Pilfold <louis@lpil.uk>2024-03-26 10:31:25 +0000
commita487a95221f803fa25e15bdb156c23805c57f5aa (patch)
tree7681afae1b2f1ac0287e38d1dc3101615bcc2831
parenteb47a893c941000803984d9100e3856040404f3b (diff)
downloadtour-a487a95221f803fa25e15bdb156c23805c57f5aa.tar.gz
tour-a487a95221f803fa25e15bdb156c23805c57f5aa.zip
chore: format files
-rw-r--r--static/css/fonts.css2
-rw-r--r--static/css/layout.css4
-rw-r--r--static/css/theme.css6
-rw-r--r--static/js/highlight/highlight-gleam.js73
4 files changed, 57 insertions, 28 deletions
diff --git a/static/css/fonts.css b/static/css/fonts.css
index 1f07a2e..da3a3f6 100644
--- a/static/css/fonts.css
+++ b/static/css/fonts.css
@@ -25,4 +25,4 @@
--font-size-normal: calc(var(--gap) * 1.5);
--font-size-small: calc(var(--gap) * 1.2);
--font-size-extra-small: calc(var(--gap));
-} \ No newline at end of file
+}
diff --git a/static/css/layout.css b/static/css/layout.css
index 6b6d1ac..609eeef 100644
--- a/static/css/layout.css
+++ b/static/css/layout.css
@@ -5,6 +5,6 @@
--gap-quad: calc(4 * var(--gap));
--gap-half: calc(0.5 * var(--gap));
--gap-quarter: calc(0.25 * var(--gap));
-
+
--navbar-height: calc(var(--gap-double) + 20px);
-} \ No newline at end of file
+}
diff --git a/static/css/theme.css b/static/css/theme.css
index 4d12e42..c098cfa 100644
--- a/static/css/theme.css
+++ b/static/css/theme.css
@@ -9,7 +9,9 @@ Derives app colors for both dark & light themes from common.css variables
--light-pink: #fff8fe;
--gray-light: #dfdfdf;
- --drop-shadow: 0 0 var(--gap-quarter) var(--color-background), var(--gap) var(--gap) 0 var(--color-drop-shadow), inset 0 0 0 1px var(--color-accent-muted);
+ --drop-shadow: 0 0 var(--gap-quarter) var(--color-background),
+ var(--gap) var(--gap) 0 var(--color-drop-shadow),
+ inset 0 0 0 1px var(--color-accent-muted);
--color-navbar-background: var(--faff-pink);
--color-navbar-text: var(--light-theme-text);
@@ -49,4 +51,4 @@ html.theme-dark {
--color-accent-muted: var(--color-accent-dark);
--color-text-accent: var(--color-accent);
color-scheme: dark;
-} \ No newline at end of file
+}
diff --git a/static/js/highlight/highlight-gleam.js b/static/js/highlight/highlight-gleam.js
index 47362a4..cc03f40 100644
--- a/static/js/highlight/highlight-gleam.js
+++ b/static/js/highlight/highlight-gleam.js
@@ -16,14 +16,41 @@ import * as regexes from "./regexes.js";
*/
const cp = (obj) => ({ ...obj });
-
// Define operators and keywords to highlight gleam code without spawning an editor
const GLEAM_OPERATORS = [
- "<<", ">>", "<-", "->", "|>", "<>", "..",
- "<=", "<=.", ">=", ">=.", "==", "==.", "%", "%.",
- "!=", "!=.", '<', "<.", ">", ">.", "&&", "||",
- "+", "+.", "-", "-.", "/", "/.", "*", "*.", "=",
-]
+ "<<",
+ ">>",
+ "<-",
+ "->",
+ "|>",
+ "<>",
+ "..",
+ "<=",
+ "<=.",
+ ">=",
+ ">=.",
+ "==",
+ "==.",
+ "%",
+ "%.",
+ "!=",
+ "!=.",
+ "<",
+ "<.",
+ ">",
+ ">.",
+ "&&",
+ "||",
+ "+",
+ "+.",
+ "-",
+ "-.",
+ "/",
+ "/.",
+ "*",
+ "*.",
+ "=",
+];
const GLEAM_KEYWORDS = [
"as",
"assert",
@@ -52,10 +79,10 @@ const GLEAM_KEYWORDS = [
/**
* HLJS modes
* Glorified regular expressions used to target & highlight code snippets
- *
+ *
* Ordered by `relevance` -> more or less translates to parsing order / priority
* https://highlightjs.readthedocs.io/en/stable/language-guide.html#relevance
- *
+ *
* Their `scope` maps to 1 or more css class
* https://highlightjs.readthedocs.io/en/stable/css-classes-reference.html
*/
@@ -82,7 +109,7 @@ const FUNCTION_PARAM = {
scope: "function-param",
match: regexes.functionParam,
relevance: 0,
-}
+};
const DISCARD_NAMES = {
scope: "attribute",
@@ -94,7 +121,7 @@ const MODULES = {
scope: "module",
match: regexes.importModule,
relevance: 0,
-}
+};
// Relevance 1
@@ -106,10 +133,10 @@ const OPERATORS = {
$pattern: /\b\S+\b/g,
},
relevance: 1,
-}
+};
const KEYWORDS = {
- name: 'Gleam keywords',
+ name: "Gleam keywords",
scope: "keyword",
keywords: {
keyword: GLEAM_KEYWORDS.join(" "),
@@ -132,20 +159,20 @@ const NUMBERS = {
scope: "number",
variants: [
{
- begin: regexes.number.binary
+ begin: regexes.number.binary,
},
{
- begin: regexes.number.octal
+ begin: regexes.number.octal,
},
{
- begin: regexes.number.hex
+ begin: regexes.number.hex,
},
{
- begin: regexes.number.decOrFloat
+ begin: regexes.number.decOrFloat,
},
{
- match: regexes.number.scientific
- }
+ match: regexes.number.scientific,
+ },
],
relevance: 2,
};
@@ -157,7 +184,7 @@ const TYPES = {
scope: "type",
match: regexes.type,
relevance: 3,
-}
+};
// Relevance 4
@@ -186,7 +213,7 @@ const ATTRIBUTES = {
scope: "attribute",
match: regexes.attribute,
relevance: 6,
-}
+};
// Relevance 7
@@ -230,12 +257,12 @@ const COMMENTS = {
scope: "comment",
match: regexes.comment,
relevance: 10,
-}
+};
/**
* Register the Gleam lang to HLJS global exported from `./highlight.core.min.js`
*/
-hljs.registerLanguage("gleam", function(hljs) {
+hljs.registerLanguage("gleam", function (hljs) {
return {
name: "Gleam",
aliases: ["gleam"],
@@ -266,4 +293,4 @@ hljs.registerLanguage("gleam", function(hljs) {
*/
addEventListener("DOMContentLoaded", () => {
hljs.highlightAll();
-})
+});