utopia-project 0.37.6 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/context/documentation-guidelines.md +12 -7
- data/lib/utopia/project/import_map.rb +1 -0
- data/lib/utopia/project/version.rb +1 -1
- data/pages/_page.xnode +8 -13
- data/public/_components/@socketry/syntax/Syntax/CodeElement.js +293 -0
- data/public/_components/@socketry/syntax/Syntax/Errors.js +52 -0
- data/public/_components/@socketry/syntax/Syntax/Language/apache.js +49 -0
- data/public/_components/@socketry/syntax/Syntax/Language/applescript.js +157 -0
- data/public/_components/@socketry/syntax/Syntax/Language/assembly.js +42 -0
- data/public/_components/@socketry/syntax/Syntax/Language/bash-script.js +108 -0
- data/public/_components/@socketry/syntax/Syntax/Language/bash.js +32 -0
- data/public/_components/@socketry/syntax/Syntax/Language/basic.js +232 -0
- data/public/_components/@socketry/syntax/Syntax/Language/c++.js +1 -0
- data/public/_components/@socketry/syntax/Syntax/Language/c.js +1 -0
- data/public/_components/@socketry/syntax/Syntax/Language/clang.js +201 -0
- data/public/_components/@socketry/syntax/Syntax/Language/cpp.js +1 -0
- data/public/_components/@socketry/syntax/Syntax/Language/csharp.js +166 -0
- data/public/_components/@socketry/syntax/Syntax/Language/css.js +244 -0
- data/public/_components/@socketry/syntax/Syntax/Language/diff.js +24 -0
- data/public/_components/@socketry/syntax/Syntax/Language/go.js +135 -0
- data/public/_components/@socketry/syntax/Syntax/Language/haskell.js +110 -0
- data/public/_components/@socketry/syntax/Syntax/Language/html.js +69 -0
- data/public/_components/@socketry/syntax/Syntax/Language/io.js +68 -0
- data/public/_components/@socketry/syntax/Syntax/Language/java.js +134 -0
- data/public/_components/@socketry/syntax/Syntax/Language/javascript.js +89 -0
- data/public/_components/@socketry/syntax/Syntax/Language/json.js +36 -0
- data/public/_components/@socketry/syntax/Syntax/Language/lisp.js +38 -0
- data/public/_components/@socketry/syntax/Syntax/Language/lua.js +87 -0
- data/public/_components/@socketry/syntax/Syntax/Language/markdown.js +112 -0
- data/public/_components/@socketry/syntax/Syntax/Language/nginx.js +37 -0
- data/public/_components/@socketry/syntax/Syntax/Language/objective-c.js +1 -0
- data/public/_components/@socketry/syntax/Syntax/Language/ocaml.js +225 -0
- data/public/_components/@socketry/syntax/Syntax/Language/pascal.js +166 -0
- data/public/_components/@socketry/syntax/Syntax/Language/patch.js +2 -0
- data/public/_components/@socketry/syntax/Syntax/Language/perl5.js +317 -0
- data/public/_components/@socketry/syntax/Syntax/Language/php-script.js +112 -0
- data/public/_components/@socketry/syntax/Syntax/Language/php.js +18 -0
- data/public/_components/@socketry/syntax/Syntax/Language/plain.js +20 -0
- data/public/_components/@socketry/syntax/Syntax/Language/protobuf.js +77 -0
- data/public/_components/@socketry/syntax/Syntax/Language/python.js +208 -0
- data/public/_components/@socketry/syntax/Syntax/Language/ruby.js +124 -0
- data/public/_components/@socketry/syntax/Syntax/Language/scala.js +81 -0
- data/public/_components/@socketry/syntax/Syntax/Language/smalltalk.js +30 -0
- data/public/_components/@socketry/syntax/Syntax/Language/sql.js +865 -0
- data/public/_components/@socketry/syntax/Syntax/Language/super-collider.js +70 -0
- data/public/_components/@socketry/syntax/Syntax/Language/swift.js +176 -0
- data/public/_components/@socketry/syntax/Syntax/Language/xml.js +76 -0
- data/public/_components/@socketry/syntax/Syntax/Language/xrb.js +33 -0
- data/public/_components/@socketry/syntax/Syntax/Language/yaml.js +29 -0
- data/public/_components/@socketry/syntax/Syntax/Language.js +276 -0
- data/public/_components/@socketry/syntax/Syntax/Loader.js +78 -0
- data/public/_components/@socketry/syntax/Syntax/Match.js +546 -0
- data/public/_components/@socketry/syntax/Syntax/Rule.js +306 -0
- data/public/_components/@socketry/syntax/Syntax.js +356 -0
- data/public/_components/@socketry/syntax/license.md +21 -0
- data/public/_components/@socketry/syntax/package.json +43 -0
- data/public/_components/@socketry/syntax/readme.md +162 -0
- data/public/_components/@socketry/syntax/themes/base/apache.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/applescript.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/assembly.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/bash.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/basic.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/c.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/clang.css +0 -0
- data/public/_components/@socketry/syntax/themes/base/csharp.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/css.css +22 -0
- data/public/_components/@socketry/syntax/themes/base/diff.css +48 -0
- data/public/_components/@socketry/syntax/themes/base/go.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/haskell.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/html.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/io.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/java.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/javascript.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/json.css +41 -0
- data/public/_components/@socketry/syntax/themes/base/lisp.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/lua.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/markdown.css +16 -0
- data/public/_components/@socketry/syntax/themes/base/nginx.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/ocaml.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/pascal.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/perl5.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/php-script.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/php.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/plain.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/protobuf.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/python.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/ruby.css +23 -0
- data/public/_components/@socketry/syntax/themes/base/scala.css +3 -0
- data/public/_components/@socketry/syntax/themes/base/smalltalk.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/sql.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/super-collider.css +33 -0
- data/public/_components/@socketry/syntax/themes/base/swift.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/syntax.css +63 -0
- data/public/_components/@socketry/syntax/themes/base/xml.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/xrb.css +29 -0
- data/public/_components/@socketry/syntax/themes/base/yaml.css +1 -0
- data/public/_components/@socketry/syntax/themes/theming.md +233 -0
- data/public/_static/sidebar.js +55 -22
- data/public/_static/site.css +0 -4
- data.tar.gz.sig +0 -0
- metadata +94 -1
- metadata.gz.sig +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('html');
|
|
5
|
+
|
|
6
|
+
// Custom handler for all <script> tags - determines language based on type attribute
|
|
7
|
+
language.push({
|
|
8
|
+
pattern: /<script(\s+[^>]*?)?>((.|\n)*?)<\/script>/im,
|
|
9
|
+
matches: Rule.extractConditionalMatch(1, 2, [
|
|
10
|
+
{pattern: /type\s*=\s*["']importmap["']/i, language: 'json'},
|
|
11
|
+
{pattern: /type\s*=\s*["'](?:text|application)\/javascript["']/i, language: 'javascript'},
|
|
12
|
+
{language: 'javascript'} // Fallback: no type or unknown type defaults to JavaScript (HTML5)
|
|
13
|
+
])
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// Embedded CSS in <style> tags
|
|
17
|
+
language.push({
|
|
18
|
+
pattern: /<style.*?type=.?text\/css.*?>((.|\n)*?)<\/style>/im,
|
|
19
|
+
matches: Rule.extractMatches({language: 'css'})
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Embedded PHP
|
|
23
|
+
language.push({
|
|
24
|
+
pattern: /((<\?php)([\s\S]*?)(\?>))/m,
|
|
25
|
+
matches: Rule.extractMatches(
|
|
26
|
+
{type: 'php-tag', allow: ['keyword', 'php-script']},
|
|
27
|
+
{type: 'keyword'},
|
|
28
|
+
{language: 'php-script'},
|
|
29
|
+
{type: 'keyword'}
|
|
30
|
+
)
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Embedded Ruby
|
|
34
|
+
language.push({
|
|
35
|
+
pattern: /((<\?rb?)([\s\S]*?)(\?>))/m,
|
|
36
|
+
matches: Rule.extractMatches(
|
|
37
|
+
{type: 'ruby-tag', allow: ['keyword', 'ruby']},
|
|
38
|
+
{type: 'keyword'},
|
|
39
|
+
{language: 'ruby'},
|
|
40
|
+
{type: 'keyword'}
|
|
41
|
+
)
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// ERB-style instructions
|
|
45
|
+
language.push({
|
|
46
|
+
pattern: /<%=?(.*?)(%>)/,
|
|
47
|
+
type: 'instruction',
|
|
48
|
+
allow: ['string']
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// DOCTYPE declarations
|
|
52
|
+
language.push({
|
|
53
|
+
pattern: /<\!(DOCTYPE(.*?))>/,
|
|
54
|
+
matches: Rule.extractMatches({type: 'doctype'})
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Percent escapes
|
|
58
|
+
language.push({
|
|
59
|
+
pattern: /(%[0-9a-f]{2})/i,
|
|
60
|
+
type: 'percent-escape',
|
|
61
|
+
only: ['html']
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Derive from XML for tag parsing
|
|
65
|
+
language.derives('xml');
|
|
66
|
+
|
|
67
|
+
export default function register(syntax) {
|
|
68
|
+
syntax.register('html', language);
|
|
69
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('io');
|
|
5
|
+
|
|
6
|
+
language.push(Rule.cStyleFunction);
|
|
7
|
+
|
|
8
|
+
const keywords = ['return'];
|
|
9
|
+
|
|
10
|
+
// Operators ordered longest-first
|
|
11
|
+
const operators = [
|
|
12
|
+
'::=',
|
|
13
|
+
':=',
|
|
14
|
+
'or',
|
|
15
|
+
'and',
|
|
16
|
+
'new',
|
|
17
|
+
'delete',
|
|
18
|
+
'@',
|
|
19
|
+
'+',
|
|
20
|
+
'*',
|
|
21
|
+
'/',
|
|
22
|
+
'-',
|
|
23
|
+
'&',
|
|
24
|
+
'|',
|
|
25
|
+
'~',
|
|
26
|
+
'!',
|
|
27
|
+
'%',
|
|
28
|
+
'<',
|
|
29
|
+
'=',
|
|
30
|
+
'>',
|
|
31
|
+
'[',
|
|
32
|
+
']'
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
language.push(keywords, {type: 'keyword'});
|
|
36
|
+
language.push(operators, {type: 'operator'});
|
|
37
|
+
|
|
38
|
+
// Extract space delimited method invocations
|
|
39
|
+
language.push({
|
|
40
|
+
pattern: /\b([ \t]+([a-z]+))/i,
|
|
41
|
+
matches: Rule.extractMatches({index: 2, type: 'function'})
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
language.push({
|
|
45
|
+
pattern: /\)([ \t]+([a-z]+))/i,
|
|
46
|
+
matches: Rule.extractMatches({index: 2, type: 'function'})
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// CamelCase types
|
|
50
|
+
language.push(Rule.camelCaseType);
|
|
51
|
+
|
|
52
|
+
language.push(Rule.perlStyleComment);
|
|
53
|
+
language.push(Rule.cStyleComment);
|
|
54
|
+
language.push(Rule.cppStyleComment);
|
|
55
|
+
language.push(Rule.webLink);
|
|
56
|
+
|
|
57
|
+
// Strings
|
|
58
|
+
language.push(Rule.singleQuotedString);
|
|
59
|
+
language.push(Rule.doubleQuotedString);
|
|
60
|
+
language.push(Rule.stringEscape);
|
|
61
|
+
|
|
62
|
+
// Numbers
|
|
63
|
+
language.push(Rule.decimalNumber);
|
|
64
|
+
language.push(Rule.hexNumber);
|
|
65
|
+
|
|
66
|
+
export default function register(syntax) {
|
|
67
|
+
syntax.register('io', language);
|
|
68
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('java');
|
|
5
|
+
|
|
6
|
+
const keywords = [
|
|
7
|
+
'abstract',
|
|
8
|
+
'continue',
|
|
9
|
+
'for',
|
|
10
|
+
'switch',
|
|
11
|
+
'assert',
|
|
12
|
+
'default',
|
|
13
|
+
'goto',
|
|
14
|
+
'synchronized',
|
|
15
|
+
'do',
|
|
16
|
+
'if',
|
|
17
|
+
'break',
|
|
18
|
+
'implements',
|
|
19
|
+
'throw',
|
|
20
|
+
'else',
|
|
21
|
+
'import',
|
|
22
|
+
'throws',
|
|
23
|
+
'case',
|
|
24
|
+
'enum',
|
|
25
|
+
'return',
|
|
26
|
+
'transient',
|
|
27
|
+
'catch',
|
|
28
|
+
'extends',
|
|
29
|
+
'try',
|
|
30
|
+
'final',
|
|
31
|
+
'interface',
|
|
32
|
+
'static',
|
|
33
|
+
'class',
|
|
34
|
+
'finally',
|
|
35
|
+
'strictfp',
|
|
36
|
+
'volatile',
|
|
37
|
+
'const',
|
|
38
|
+
'native',
|
|
39
|
+
'super',
|
|
40
|
+
'while'
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const access = ['private', 'protected', 'public', 'package'];
|
|
44
|
+
|
|
45
|
+
const types = [
|
|
46
|
+
'void',
|
|
47
|
+
'byte',
|
|
48
|
+
'short',
|
|
49
|
+
'int',
|
|
50
|
+
'long',
|
|
51
|
+
'float',
|
|
52
|
+
'double',
|
|
53
|
+
'boolean',
|
|
54
|
+
'char'
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
// Operators ordered longest-first to match correctly
|
|
58
|
+
const operators = [
|
|
59
|
+
'>>>=',
|
|
60
|
+
'<<=',
|
|
61
|
+
'>>=',
|
|
62
|
+
'>>>',
|
|
63
|
+
'instanceof',
|
|
64
|
+
'==',
|
|
65
|
+
'!=',
|
|
66
|
+
'<=',
|
|
67
|
+
'>=',
|
|
68
|
+
'<<',
|
|
69
|
+
'>>',
|
|
70
|
+
'&&',
|
|
71
|
+
'||',
|
|
72
|
+
'++',
|
|
73
|
+
'--',
|
|
74
|
+
'+=',
|
|
75
|
+
'-=',
|
|
76
|
+
'*=',
|
|
77
|
+
'/=',
|
|
78
|
+
'%=',
|
|
79
|
+
'&=',
|
|
80
|
+
'^=',
|
|
81
|
+
'|=',
|
|
82
|
+
'new',
|
|
83
|
+
'delete',
|
|
84
|
+
'<',
|
|
85
|
+
'>',
|
|
86
|
+
'+',
|
|
87
|
+
'-',
|
|
88
|
+
'~',
|
|
89
|
+
'!',
|
|
90
|
+
'*',
|
|
91
|
+
'/',
|
|
92
|
+
'%',
|
|
93
|
+
'&',
|
|
94
|
+
'^',
|
|
95
|
+
'|',
|
|
96
|
+
'?',
|
|
97
|
+
'='
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
const constants = ['this', 'true', 'false', 'null'];
|
|
101
|
+
|
|
102
|
+
language.push(constants, {type: 'constant'});
|
|
103
|
+
language.push(types, {type: 'type'});
|
|
104
|
+
language.push(keywords, {type: 'keyword'});
|
|
105
|
+
language.push(operators, {type: 'operator'});
|
|
106
|
+
language.push(access, {type: 'access'});
|
|
107
|
+
|
|
108
|
+
// Camel Case Types
|
|
109
|
+
language.push(Rule.camelCaseType);
|
|
110
|
+
|
|
111
|
+
// Comments
|
|
112
|
+
language.push(Rule.cStyleComment);
|
|
113
|
+
language.push(Rule.cppStyleComment);
|
|
114
|
+
language.push(Rule.webLink);
|
|
115
|
+
|
|
116
|
+
// Numbers
|
|
117
|
+
language.push(Rule.decimalNumber);
|
|
118
|
+
language.push(Rule.hexNumber);
|
|
119
|
+
|
|
120
|
+
// Strings
|
|
121
|
+
language.push(Rule.singleQuotedString);
|
|
122
|
+
language.push(Rule.doubleQuotedString);
|
|
123
|
+
language.push(Rule.stringEscape);
|
|
124
|
+
|
|
125
|
+
language.push(Rule.cStyleFunction);
|
|
126
|
+
|
|
127
|
+
language.processes['function'] = Rule.webLinkProcess(
|
|
128
|
+
'java "Developer Documentation"',
|
|
129
|
+
true
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
export default function register(syntax) {
|
|
133
|
+
syntax.register('java', language);
|
|
134
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('javascript');
|
|
5
|
+
|
|
6
|
+
// Constants/values
|
|
7
|
+
language.push(['this', 'true', 'false', 'null'], {type: 'constant'});
|
|
8
|
+
|
|
9
|
+
// Keywords
|
|
10
|
+
language.push(
|
|
11
|
+
[
|
|
12
|
+
'async',
|
|
13
|
+
'await',
|
|
14
|
+
'break',
|
|
15
|
+
'case',
|
|
16
|
+
'catch',
|
|
17
|
+
'class',
|
|
18
|
+
'const',
|
|
19
|
+
'continue',
|
|
20
|
+
'debugger',
|
|
21
|
+
'default',
|
|
22
|
+
'delete',
|
|
23
|
+
'do',
|
|
24
|
+
'else',
|
|
25
|
+
'export',
|
|
26
|
+
'extends',
|
|
27
|
+
'finally',
|
|
28
|
+
'for',
|
|
29
|
+
'function',
|
|
30
|
+
'if',
|
|
31
|
+
'import',
|
|
32
|
+
'in',
|
|
33
|
+
'instanceof',
|
|
34
|
+
'let',
|
|
35
|
+
'new',
|
|
36
|
+
'return',
|
|
37
|
+
'super',
|
|
38
|
+
'switch',
|
|
39
|
+
'this',
|
|
40
|
+
'throw',
|
|
41
|
+
'try',
|
|
42
|
+
'typeof',
|
|
43
|
+
'var',
|
|
44
|
+
'void',
|
|
45
|
+
'while',
|
|
46
|
+
'with',
|
|
47
|
+
'yield'
|
|
48
|
+
],
|
|
49
|
+
{type: 'keyword'}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
// Operators
|
|
53
|
+
language.push(['+', '*', '/', '-', '&', '|', '~', '!', '%', '<', '=', '>', '...'], {
|
|
54
|
+
type: 'operator'
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Access modifiers
|
|
58
|
+
language.push(
|
|
59
|
+
['implements', 'package', 'protected', 'interface', 'private', 'public'],
|
|
60
|
+
{type: 'access'}
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
// Regular expressions
|
|
64
|
+
language.push(Rule.perlStyleRegularExpression);
|
|
65
|
+
|
|
66
|
+
// Camel Case Types
|
|
67
|
+
language.push(Rule.camelCaseType);
|
|
68
|
+
|
|
69
|
+
// Comments
|
|
70
|
+
language.push(Rule.cStyleComment);
|
|
71
|
+
language.push(Rule.cppStyleComment);
|
|
72
|
+
language.push(Rule.webLink);
|
|
73
|
+
|
|
74
|
+
// Strings
|
|
75
|
+
language.push(Rule.singleQuotedString);
|
|
76
|
+
language.push(Rule.doubleQuotedString);
|
|
77
|
+
language.push(Rule.stringEscape);
|
|
78
|
+
|
|
79
|
+
// Numbers
|
|
80
|
+
language.push(Rule.decimalNumber);
|
|
81
|
+
language.push(Rule.hexNumber);
|
|
82
|
+
|
|
83
|
+
// Functions
|
|
84
|
+
language.push(Rule.cStyleFunction);
|
|
85
|
+
|
|
86
|
+
export default function register(syntax) {
|
|
87
|
+
syntax.register('javascript', language);
|
|
88
|
+
syntax.alias('javascript', ['js', 'actionscript']);
|
|
89
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('json');
|
|
5
|
+
|
|
6
|
+
// JSON values: true, false, null
|
|
7
|
+
language.push(['true', 'false', 'null'], {type: 'constant'});
|
|
8
|
+
|
|
9
|
+
// JSON numbers (integers, floats, scientific notation)
|
|
10
|
+
language.push({
|
|
11
|
+
pattern: /-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/,
|
|
12
|
+
type: 'constant'
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// JSON strings (with escapes)
|
|
16
|
+
language.push({
|
|
17
|
+
pattern: /"(?:[^"\\]|\\.)*"/,
|
|
18
|
+
type: 'string'
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Object keys (strings followed by colon)
|
|
22
|
+
language.push({
|
|
23
|
+
pattern: /("(?:[^"\\]|\\.)*")(\s*)(:)/,
|
|
24
|
+
matches: Rule.extractMatches(
|
|
25
|
+
{type: 'key'},
|
|
26
|
+
null,
|
|
27
|
+
{type: 'operator'}
|
|
28
|
+
)
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Structural characters
|
|
32
|
+
language.push(['{', '}', '[', ']', ','], {type: 'operator'});
|
|
33
|
+
|
|
34
|
+
export default function register(syntax) {
|
|
35
|
+
syntax.register('json', language);
|
|
36
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
const lispStyleComment = {
|
|
4
|
+
pattern: /(;+) .*$/m,
|
|
5
|
+
type: 'comment',
|
|
6
|
+
allow: ['href']
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// This syntax is intentionally very sparse. This is because it is a general syntax for Lisp like languages.
|
|
10
|
+
// It might be a good idea to make specific dialects (e.g. common lisp, scheme, clojure, etc)
|
|
11
|
+
|
|
12
|
+
const language = new Language('lisp');
|
|
13
|
+
|
|
14
|
+
language.push(['(', ')'], {type: 'operator'});
|
|
15
|
+
|
|
16
|
+
language.push(lispStyleComment);
|
|
17
|
+
|
|
18
|
+
language.push(Rule.hexNumber);
|
|
19
|
+
language.push(Rule.decimalNumber);
|
|
20
|
+
language.push(Rule.webLink);
|
|
21
|
+
|
|
22
|
+
language.push({
|
|
23
|
+
pattern: /\(\s*([^\s\(\)]+)/im,
|
|
24
|
+
matches: Rule.extractMatches({type: 'function'})
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
language.push({
|
|
28
|
+
pattern: /#[a-z]+/i,
|
|
29
|
+
type: 'constant'
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Strings
|
|
33
|
+
language.push(Rule.multiLineDoubleQuotedString);
|
|
34
|
+
language.push(Rule.stringEscape);
|
|
35
|
+
|
|
36
|
+
export default function register(syntax) {
|
|
37
|
+
syntax.register('lisp', language);
|
|
38
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('lua');
|
|
5
|
+
|
|
6
|
+
const keywords = [
|
|
7
|
+
'and',
|
|
8
|
+
'break',
|
|
9
|
+
'do',
|
|
10
|
+
'else',
|
|
11
|
+
'elseif',
|
|
12
|
+
'end',
|
|
13
|
+
'false',
|
|
14
|
+
'for',
|
|
15
|
+
'function',
|
|
16
|
+
'if',
|
|
17
|
+
'in',
|
|
18
|
+
'local',
|
|
19
|
+
'nil',
|
|
20
|
+
'not',
|
|
21
|
+
'or',
|
|
22
|
+
'repeat',
|
|
23
|
+
'return',
|
|
24
|
+
'then',
|
|
25
|
+
'true',
|
|
26
|
+
'until',
|
|
27
|
+
'while'
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
// Operators ordered longest-first
|
|
31
|
+
const operators = [
|
|
32
|
+
'==',
|
|
33
|
+
'~=',
|
|
34
|
+
'<=',
|
|
35
|
+
'>=',
|
|
36
|
+
'..',
|
|
37
|
+
'+',
|
|
38
|
+
'-',
|
|
39
|
+
'*',
|
|
40
|
+
'/',
|
|
41
|
+
'%',
|
|
42
|
+
'^',
|
|
43
|
+
'#',
|
|
44
|
+
'=',
|
|
45
|
+
'<',
|
|
46
|
+
'>',
|
|
47
|
+
'?',
|
|
48
|
+
':'
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
const values = ['self', 'true', 'false', 'nil'];
|
|
52
|
+
|
|
53
|
+
language.push(values, {type: 'constant'});
|
|
54
|
+
language.push(keywords, {type: 'keyword'});
|
|
55
|
+
language.push(operators, {type: 'operator'});
|
|
56
|
+
|
|
57
|
+
// CamelCase types
|
|
58
|
+
language.push(Rule.camelCaseType);
|
|
59
|
+
language.push(Rule.cStyleFunction);
|
|
60
|
+
|
|
61
|
+
// Single-line comments
|
|
62
|
+
language.push({
|
|
63
|
+
pattern: /\-\-.*$/m,
|
|
64
|
+
type: 'comment',
|
|
65
|
+
allow: ['href']
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Multi-line comments
|
|
69
|
+
language.push({
|
|
70
|
+
pattern: /\-\-\[\[(\n|.)*?\]\]\-\-/m,
|
|
71
|
+
type: 'comment',
|
|
72
|
+
allow: ['href']
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Strings
|
|
76
|
+
language.push(Rule.singleQuotedString);
|
|
77
|
+
language.push(Rule.doubleQuotedString);
|
|
78
|
+
language.push(Rule.stringEscape);
|
|
79
|
+
|
|
80
|
+
language.push(Rule.hexNumber);
|
|
81
|
+
language.push(Rule.decimalNumber);
|
|
82
|
+
|
|
83
|
+
language.push(Rule.webLink);
|
|
84
|
+
|
|
85
|
+
export default function register(syntax) {
|
|
86
|
+
syntax.register('lua', language);
|
|
87
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('markdown');
|
|
5
|
+
|
|
6
|
+
// Headers
|
|
7
|
+
language.push({
|
|
8
|
+
pattern: /^#{1,6}\s+.+$/m,
|
|
9
|
+
type: 'heading'
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
// Bold (strong emphasis)
|
|
13
|
+
language.push({
|
|
14
|
+
pattern: /\*\*(.+?)\*\*/,
|
|
15
|
+
type: 'strong'
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
language.push({
|
|
19
|
+
pattern: /__(.+?)__/,
|
|
20
|
+
type: 'strong'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Italic (emphasis)
|
|
24
|
+
language.push({
|
|
25
|
+
pattern: /\*(.+?)\*/,
|
|
26
|
+
type: 'emphasis'
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
language.push({
|
|
30
|
+
pattern: /_(.+?)_/,
|
|
31
|
+
type: 'emphasis'
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Code blocks with language
|
|
35
|
+
language.push({
|
|
36
|
+
pattern: /^```[\w-]*\n[\s\S]*?\n```$/m,
|
|
37
|
+
type: 'code'
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Inline code
|
|
41
|
+
language.push({
|
|
42
|
+
// Do not allow newlines inside inline code to avoid spanning across blocks/fences:
|
|
43
|
+
pattern: /`([^`\n\r]+)`/,
|
|
44
|
+
type: 'code'
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Links - make them clickable
|
|
48
|
+
language.push({
|
|
49
|
+
pattern: /\[([^\]]+)\]\(([^)]+)\)/,
|
|
50
|
+
type: 'link',
|
|
51
|
+
matches: Rule.extractMatches(
|
|
52
|
+
{type: 'string'}, // Link text
|
|
53
|
+
{
|
|
54
|
+
type: 'link',
|
|
55
|
+
process: function (container, match) {
|
|
56
|
+
const anchor = document.createElement('a');
|
|
57
|
+
anchor.className = container.className;
|
|
58
|
+
anchor.textContent = container.textContent;
|
|
59
|
+
anchor.href = match.value;
|
|
60
|
+
return anchor;
|
|
61
|
+
}
|
|
62
|
+
} // URL
|
|
63
|
+
)
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Images
|
|
67
|
+
language.push({
|
|
68
|
+
pattern: /!\[([^\]]*)\]\(([^)]+)\)/,
|
|
69
|
+
type: 'link'
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// Blockquotes
|
|
73
|
+
language.push({
|
|
74
|
+
pattern: /^>\s+.+$/m,
|
|
75
|
+
type: 'quote'
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Unordered lists
|
|
79
|
+
language.push({
|
|
80
|
+
pattern: /^[\s]*[-*+]\s+/m,
|
|
81
|
+
type: 'list-marker'
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Ordered lists
|
|
85
|
+
language.push({
|
|
86
|
+
pattern: /^[\s]*\d+\.\s+/m,
|
|
87
|
+
type: 'list-marker'
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Horizontal rules
|
|
91
|
+
language.push({
|
|
92
|
+
pattern: /^(?:[-*_]){3,}$/m,
|
|
93
|
+
type: 'operator'
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// URLs - make them clickable
|
|
97
|
+
language.push({
|
|
98
|
+
...Rule.webLink,
|
|
99
|
+
type: 'link',
|
|
100
|
+
process: function (container, match) {
|
|
101
|
+
const anchor = document.createElement('a');
|
|
102
|
+
anchor.className = container.className;
|
|
103
|
+
anchor.textContent = match.value;
|
|
104
|
+
anchor.href = match.value;
|
|
105
|
+
return anchor;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
export default function register(syntax) {
|
|
110
|
+
syntax.register('markdown', language);
|
|
111
|
+
syntax.alias('markdown', ['md']);
|
|
112
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('nginx');
|
|
5
|
+
|
|
6
|
+
// Directives with web links to nginx documentation
|
|
7
|
+
language.push({
|
|
8
|
+
pattern: /((\w+).*?);/,
|
|
9
|
+
matches: Rule.extractMatches(
|
|
10
|
+
{type: 'directive', allow: '*'},
|
|
11
|
+
{
|
|
12
|
+
type: 'function',
|
|
13
|
+
process: Rule.webLinkProcess('http://nginx.org/r/')
|
|
14
|
+
}
|
|
15
|
+
)
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// Keywords (blocks with { )
|
|
19
|
+
language.push({
|
|
20
|
+
pattern: /(\w+).*?{/,
|
|
21
|
+
matches: Rule.extractMatches({type: 'keyword'})
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// Variables ($var)
|
|
25
|
+
language.push({pattern: /(\$)[\w]+/, type: 'variable'});
|
|
26
|
+
|
|
27
|
+
// Comments and strings
|
|
28
|
+
language.push(Rule.perlStyleComment);
|
|
29
|
+
language.push(Rule.singleQuotedString);
|
|
30
|
+
language.push(Rule.doubleQuotedString);
|
|
31
|
+
|
|
32
|
+
// Web links
|
|
33
|
+
language.push(Rule.webLink);
|
|
34
|
+
|
|
35
|
+
export default function register(syntax) {
|
|
36
|
+
syntax.register('nginx', language);
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default} from './clang.js';
|