Skip to content

Commit 9a8cfdc

Browse files
committed
Update Prism to 1.27.0
There are now 277 (from 276) syntaxes supported. See: <https://github.com/PrismJS/prism/blob/master/CHANGELOG.md#1270-2022-02-17>
1 parent 4b72dd6 commit 9a8cfdc

File tree

11 files changed

+115
-10
lines changed

11 files changed

+115
-10
lines changed

lang/autoit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function autoit(Prism) {
2626
}
2727
},
2828
directive: {
29-
pattern: /(^[\t ]*)#\w+/m,
29+
pattern: /(^[\t ]*)#[\w-]+/m,
3030
lookbehind: true,
3131
alias: 'keyword'
3232
},

lang/editorconfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default function editorconfig(Prism) {
1010
section: {
1111
pattern: /(^[ \t]*)\[.+\]/m,
1212
lookbehind: true,
13-
alias: 'keyword',
13+
alias: 'selector',
1414
inside: {
1515
regex: /\\\\[\[\]{},!?.*]/,
1616
// Escape special characters with '\\'

lang/ini.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function ini(Prism) {
1414
pattern: /(^[ \f\t\v]*)[#;][^\n\r]*/m,
1515
lookbehind: true
1616
},
17-
header: {
17+
section: {
1818
pattern: /(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,
1919
lookbehind: true,
2020
inside: {

lang/mongodb.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ export default function mongodb(Prism) {
9393
'$sortByCount',
9494
'$unionWith',
9595
'$unset',
96-
'$unwind', // aggregation pipeline operators
96+
'$unwind',
97+
'$setWindowFields', // aggregation pipeline operators
9798
'$abs',
9899
'$accumulator',
99100
'$acos',
@@ -223,7 +224,17 @@ export default function mongodb(Prism) {
223224
'$type',
224225
'$week',
225226
'$year',
226-
'$zip', // aggregation pipeline query modifiers
227+
'$zip',
228+
'$count',
229+
'$dateAdd',
230+
'$dateDiff',
231+
'$dateSubtract',
232+
'$dateTrunc',
233+
'$getField',
234+
'$rand',
235+
'$sampleRate',
236+
'$setField',
237+
'$unsetField', // aggregation pipeline query modifiers
227238
'$comment',
228239
'$explain',
229240
'$hint',

lang/purebasic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ slightly changed to pass all tests
1616
Prism.languages.purebasic = Prism.languages.extend('clike', {
1717
comment: /;.*/,
1818
keyword:
19-
/\b(?:align|and|as|break|calldebugger|case|compilercase|compilerdefault|compilerelse|compilerelseif|compilerendif|compilerendselect|compilererror|compilerif|compilerselect|continue|data|datasection|debug|debuglevel|declare|declarec|declarecdll|declaredll|declaremodule|default|define|dim|disableasm|disabledebugger|disableexplicit|else|elseif|enableasm|enabledebugger|enableexplicit|end|enddatasection|enddeclaremodule|endenumeration|endif|endimport|endinterface|endmacro|endmodule|endprocedure|endselect|endstructure|endstructureunion|endwith|enumeration|extends|fakereturn|for|foreach|global|gosub|goto|if|import|importc|includebinary|includefile|includepath|interface|macro|module|newlist|newmap|next|not|or|procedure|procedurec|procedurecdll|proceduredll|procedurereturn|protected|prototype|prototypec|read|redim|repeat|restore|return|runtime|select|shared|static|step|structure|structureunion|swap|threaded|to|until|wend|while|with|xincludefile|xor)\b/i,
19+
/\b(?:align|and|as|break|calldebugger|case|compilercase|compilerdefault|compilerelse|compilerelseif|compilerendif|compilerendselect|compilererror|compilerif|compilerselect|continue|data|datasection|debug|debuglevel|declare|declarec|declarecdll|declaredll|declaremodule|default|define|dim|disableasm|disabledebugger|disableexplicit|else|elseif|enableasm|enabledebugger|enableexplicit|end|enddatasection|enddeclaremodule|endenumeration|endif|endimport|endinterface|endmacro|endmodule|endprocedure|endselect|endstructure|endstructureunion|endwith|enumeration|extends|fakereturn|for|foreach|forever|global|gosub|goto|if|import|importc|includebinary|includefile|includepath|interface|macro|module|newlist|newmap|next|not|or|procedure|procedurec|procedurecdll|proceduredll|procedurereturn|protected|prototype|prototypec|read|redim|repeat|restore|return|runtime|select|shared|static|step|structure|structureunion|swap|threaded|to|until|wend|while|with|xincludefile|xor)\b/i,
2020
function: /\b\w+(?:\.\w+)?\s*(?=\()/,
2121
number: /(?:\$[\da-f]+|\b-?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)\b/i,
2222
operator:
2323
/(?:@\*?|\?|\*)\w+|-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*/@]/
2424
})
2525
Prism.languages.insertBefore('purebasic', 'keyword', {
26-
tag: /#\w+/,
26+
tag: /#\w+\$?/,
2727
asm: {
2828
pattern: /(^[\t ]*)!.*/m,
2929
lookbehind: true,

lang/scala.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,37 @@ export default function scala(Prism) {
2424
/\b(?:Any|AnyRef|AnyVal|Boolean|Byte|Char|Double|Float|Int|Long|Nothing|Short|String|Unit)\b/,
2525
symbol: /'[^\d\s\\]\w*/
2626
})
27+
Prism.languages.insertBefore('scala', 'triple-quoted-string', {
28+
'string-interpolation': {
29+
pattern:
30+
/\b[a-z]\w*(?:"""(?:[^$]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*?"""|"(?:[^$"\r\n]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*")/i,
31+
greedy: true,
32+
inside: {
33+
id: {
34+
pattern: /^\w+/,
35+
greedy: true,
36+
alias: 'function'
37+
},
38+
escape: {
39+
pattern: /\\\$"|\$[$"]/,
40+
greedy: true,
41+
alias: 'symbol'
42+
},
43+
interpolation: {
44+
pattern: /\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,
45+
greedy: true,
46+
inside: {
47+
punctuation: /^\$\{?|\}$/,
48+
expression: {
49+
pattern: /[\s\S]+/,
50+
inside: Prism.languages.scala
51+
}
52+
}
53+
},
54+
string: /[\s\S]+/
55+
}
56+
}
57+
})
2758
delete Prism.languages.scala['class-name']
2859
delete Prism.languages.scala['function']
2960
}

lang/systemd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default function systemd(Prism) {
6767
}
6868
}
6969
},
70-
operator: /=/
70+
punctuation: /=/
7171
}
7272
})(Prism)
7373
}

lang/uorazor.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// @ts-nocheck
2+
uorazor.displayName = 'uorazor'
3+
uorazor.aliases = []
4+
5+
/** @type {import('../core.js').Syntax} */
6+
export default function uorazor(Prism) {
7+
Prism.languages.uorazor = {
8+
'comment-hash': {
9+
pattern: /#.*/,
10+
alias: 'comment',
11+
greedy: true
12+
},
13+
'comment-slash': {
14+
pattern: /\/\/.*/,
15+
alias: 'comment',
16+
greedy: true
17+
},
18+
string: {
19+
pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
20+
inside: {
21+
punctuation: /^['"]|['"]$/
22+
},
23+
greedy: true
24+
},
25+
'source-layers': {
26+
pattern:
27+
/\b(?:arms|backpack|blue|bracelet|cancel|clear|cloak|criminal|earrings|enemy|facialhair|friend|friendly|gloves|gray|grey|ground|hair|head|innerlegs|innertorso|innocent|lefthand|middletorso|murderer|neck|nonfriendly|onehandedsecondary|outerlegs|outertorso|pants|red|righthand|ring|self|shirt|shoes|talisman|waist)\b/i,
28+
alias: 'function'
29+
},
30+
'source-commands': {
31+
pattern:
32+
/\b(?:alliance|attack|cast|clearall|clearignore|clearjournal|clearlist|clearsysmsg|createlist|createtimer|dclick|dclicktype|dclickvar|dress|dressconfig|drop|droprelloc|emote|getlabel|guild|gumpclose|gumpresponse|hotkey|ignore|lasttarget|lift|lifttype|menu|menuresponse|msg|org|organize|organizer|overhead|pause|poplist|potion|promptresponse|pushlist|removelist|removetimer|rename|restock|say|scav|scavenger|script|setability|setlasttarget|setskill|settimer|setvar|sysmsg|target|targetloc|targetrelloc|targettype|undress|unignore|unsetvar|useobject|useonce|useskill|usetype|virtue|wait|waitforgump|waitformenu|waitforprompt|waitforstat|waitforsysmsg|waitfortarget|walk|wfsysmsg|wft|whisper|yell)\b/,
33+
alias: 'function'
34+
},
35+
'tag-name': {
36+
pattern: /(^\{%-?\s*)\w+/,
37+
lookbehind: true,
38+
alias: 'keyword'
39+
},
40+
delimiter: {
41+
pattern: /^\{[{%]-?|-?[%}]\}$/,
42+
alias: 'punctuation'
43+
},
44+
function:
45+
/\b(?:atlist|close|closest|count|counter|counttype|dead|dex|diffhits|diffmana|diffstam|diffweight|find|findbuff|finddebuff|findlayer|findtype|findtypelist|followers|gumpexists|hidden|hits|hp|hue|human|humanoid|ingump|inlist|insysmessage|insysmsg|int|invul|lhandempty|list|listexists|mana|maxhits|maxhp|maxmana|maxstam|maxweight|monster|mounted|name|next|noto|paralyzed|poisoned|position|prev|previous|queued|rand|random|rhandempty|skill|stam|str|targetexists|timer|timerexists|varexist|warmode|weight)\b/,
46+
keyword:
47+
/\b(?:and|as|break|continue|else|elseif|endfor|endif|endwhile|for|if|loop|not|or|replay|stop|while)\b/,
48+
boolean: /\b(?:false|null|true)\b/,
49+
number: /\b0x[\dA-Fa-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][-+]?\d+)?/,
50+
operator: [
51+
{
52+
pattern:
53+
/(\s)(?:and|b-and|b-or|b-xor|ends with|in|is|matches|not|or|same as|starts with)(?=\s)/,
54+
lookbehind: true
55+
},
56+
/[=<>]=?|!=|\*\*?|\/\/?|\?:?|[-+~%|]/
57+
],
58+
punctuation: /[()\[\]{}:.,]/
59+
}
60+
}

lib/all.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ import toml from '../lang/toml.js'
262262
import tremor from '../lang/tremor.js'
263263
import typoscript from '../lang/typoscript.js'
264264
import unrealscript from '../lang/unrealscript.js'
265+
import uorazor from '../lang/uorazor.js'
265266
import v from '../lang/v.js'
266267
import vala from '../lang/vala.js'
267268
import velocity from '../lang/velocity.js'
@@ -540,6 +541,7 @@ refractor.register(toml)
540541
refractor.register(tremor)
541542
refractor.register(typoscript)
542543
refractor.register(unrealscript)
544+
refractor.register(uorazor)
543545
refractor.register(v)
544546
refractor.register(vala)
545547
refractor.register(velocity)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"@types/prismjs": "^1.0.0",
4848
"hastscript": "^7.0.0",
4949
"parse-entities": "^4.0.0",
50-
"prismjs": "~1.26.0"
50+
"prismjs": "~1.27.0"
5151
},
5252
"devDependencies": {
5353
"@babel/core": "^7.0.0",

readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ That’s why there are three entry points for refractor:
4747

4848
* `lib/core.js` — 0 languages
4949
* `lib/common.js` (default) — 36 languages
50-
* `lib/all.js`276 languages
50+
* `lib/all.js`277 languages
5151

5252
<!--count end-->
5353

@@ -631,6 +631,7 @@ syntaxes are made to work with global variables and are not importable.
631631
* [ ] [`twig`](https://github.com/wooorm/refractor/blob/main/lang/twig.js)
632632
* [ ] [`typoscript`](https://github.com/wooorm/refractor/blob/main/lang/typoscript.js) — alias: `tsconfig`
633633
* [ ] [`unrealscript`](https://github.com/wooorm/refractor/blob/main/lang/unrealscript.js) — alias: `uc`, `uscript`
634+
* [ ] [`uorazor`](https://github.com/wooorm/refractor/blob/main/lang/uorazor.js)
634635
* [ ] [`uri`](https://github.com/wooorm/refractor/blob/main/lang/uri.js) — alias: `url`
635636
* [ ] [`v`](https://github.com/wooorm/refractor/blob/main/lang/v.js)
636637
* [ ] [`vala`](https://github.com/wooorm/refractor/blob/main/lang/vala.js)

0 commit comments

Comments
 (0)