aboutsummaryrefslogtreecommitdiffstats
path: root/public/prism/prism-uorazor.js
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-13 19:32:56 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commit006b15b467a5cd835a6eab1b49023100bdc8f2e6 (patch)
tree949c7295c2e206f42357f135bab4696ddf6576ec /public/prism/prism-uorazor.js
parent00f147a7a687d5772bcc538bc606cfff972178cd (diff)
refactor(components): rewrite Code component and usePrism hook
* move Prism styles to Sass placeholders to avoid repeats * let usePrism consumer define its plugins (remove default ones) * remove `plugins` prop from Code component * add new props to Code component to let consumer configure plugins (and handle plugin list from the given options) However there are some problems with Prism plugins: line-highlight and treeview does not seems to be loaded. I don't want to use Babel instead of SWC so I have no solution for now.
Diffstat (limited to 'public/prism/prism-uorazor.js')
-rw-r--r--public/prism/prism-uorazor.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/public/prism/prism-uorazor.js b/public/prism/prism-uorazor.js
new file mode 100644
index 0000000..64c7a56
--- /dev/null
+++ b/public/prism/prism-uorazor.js
@@ -0,0 +1,53 @@
+Prism.languages.uorazor = {
+ 'comment-hash': {
+ pattern: /#.*/,
+ alias: 'comment',
+ greedy: true,
+ },
+ 'comment-slash': {
+ pattern: /\/\/.*/,
+ alias: 'comment',
+ greedy: true,
+ },
+ string: {
+ pattern: /("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,
+ inside: {
+ punctuation: /^['"]|['"]$/,
+ },
+ greedy: true,
+ },
+ 'source-layers': {
+ pattern:
+ /\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,
+ alias: 'function',
+ },
+ 'source-commands': {
+ pattern:
+ /\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/,
+ alias: 'function',
+ },
+ 'tag-name': {
+ pattern: /(^\{%-?\s*)\w+/,
+ lookbehind: true,
+ alias: 'keyword',
+ },
+ delimiter: {
+ pattern: /^\{[{%]-?|-?[%}]\}$/,
+ alias: 'punctuation',
+ },
+ function:
+ /\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/,
+ keyword:
+ /\b(?:and|as|break|continue|else|elseif|endfor|endif|endwhile|for|if|loop|not|or|replay|stop|while)\b/,
+ boolean: /\b(?:false|null|true)\b/,
+ number: /\b0x[\dA-Fa-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][-+]?\d+)?/,
+ operator: [
+ {
+ pattern:
+ /(\s)(?:and|b-and|b-or|b-xor|ends with|in|is|matches|not|or|same as|starts with)(?=\s)/,
+ lookbehind: true,
+ },
+ /[=<>]=?|!=|\*\*?|\/\/?|\?:?|[-+~%|]/,
+ ],
+ punctuation: /[()\[\]{}:.,]/,
+};