Skip to content

Commit

Permalink
Merge branch 'master' into issue3350
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Mar 5, 2022
2 parents cd1f387 + 3bd8fdb commit 1a020d1
Show file tree
Hide file tree
Showing 22 changed files with 831 additions and 30 deletions.
36 changes: 36 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,41 @@
# Prism Changelog


## 1.27.0 (2022-02-17)

### New components

* __UO Razor Script__ (#3309) [`3f8cc5a0`](https://github.com/PrismJS/prism/commit/3f8cc5a0)

### Updated components

* __AutoIt__
* Allow hyphen in directive (#3308) [`bcb2e2c8`](https://github.com/PrismJS/prism/commit/bcb2e2c8)
* __EditorConfig__
* Change alias of `section` from `keyword` to `selector` (#3305) [`e46501b9`](https://github.com/PrismJS/prism/commit/e46501b9)
* __Ini__
* Swap out `header` for `section` (#3304) [`deb3a97f`](https://github.com/PrismJS/prism/commit/deb3a97f)
* __MongoDB__
* Added v5 support (#3297) [`8458c41f`](https://github.com/PrismJS/prism/commit/8458c41f)
* __PureBasic__
* Added missing keyword and fixed constants ending with `$` (#3320) [`d6c53726`](https://github.com/PrismJS/prism/commit/d6c53726)
* __Scala__
* Added support for interpolated strings (#3293) [`441a1422`](https://github.com/PrismJS/prism/commit/441a1422)
* __Systemd configuration file__
* Swap out `operator` for `punctuation` (#3306) [`2eb89e15`](https://github.com/PrismJS/prism/commit/2eb89e15)

### Updated plugins

* __Command Line__
* Escape markup in command line output (#3341) [`e002e78c`](https://github.com/PrismJS/prism/commit/e002e78c)
* Add support for line continuation and improved colors (#3326) [`1784b175`](https://github.com/PrismJS/prism/commit/1784b175)
* Added span around command and output (#3312) [`82d0ca15`](https://github.com/PrismJS/prism/commit/82d0ca15)

### Other

* __Core__
* Added better error message for missing grammars (#3311) [`2cc4660b`](https://github.com/PrismJS/prism/commit/2cc4660b)

## 1.26.0 (2022-01-06)

### New components
Expand Down
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions components.json
Expand Up @@ -299,6 +299,10 @@
"title": "Content-Security-Policy",
"owner": "ScottHelme"
},
"cooklang": {
"title": "Cooklang",
"owner": "ahue"
},
"coq": {
"title": "Coq",
"owner": "RunDevelopment"
Expand Down
146 changes: 146 additions & 0 deletions components/prism-cooklang.js
@@ -0,0 +1,146 @@
(function (Prism) {

// see https://github.com/cooklang/spec/blob/main/EBNF.md

var single_token_suffix = /(?:(?!\s)[\d$+<=a-zA-Z\x80-\uFFFF])+/.source;
var multi_token_infix = /[^{}@#]+/.source;
var multi_token_suffix = /\{[^}#@]*\}/.source;

var multi_token = multi_token_infix + multi_token_suffix;

var timer_units = /(?:h|hours|hrs|m|min|minutes)/.source;

var amount_group_impl = {
pattern: /\{[^{}]*\}/,
inside: {
'amount': {
pattern: /([\{|])[^{}|*%]+/,
lookbehind: true,
alias: 'number',
},
'unit': {
pattern: /(%)[^}]+/,
lookbehind: true,
alias: 'symbol',
},
'servings-scaler': {
pattern: /\*/,
alias: 'operator',
},
'servings-alternative-separator': {
pattern: /\|/,
alias: 'operator',
},
'unit-separator': {
pattern: /(?:%|(\*)%)/,
lookbehind: true,
alias: 'operator',
},
'punctuation': /[{}]/,
}
};


Prism.languages.cooklang = {
'comment': {
// [- comment -]
// -- comment
pattern: /\[-[\s\S]*?-\]|--.*/,
greedy: true,
},
'meta': { // >> key: value
pattern: />>.*:.*/,
inside: {
'property': { // key:
pattern: /(>>\s*)[^\s:](?:[^:]*[^\s:])?/,
lookbehind: true,
}
}
},
'cookware-group': { // #...{...}, #...
pattern: new RegExp('#(?:'
+ multi_token
+ '|'
+ single_token_suffix
+ ')'
),
inside: {
'cookware': {
pattern: new RegExp('(^#)(?:'
+ multi_token_infix
+ ')'
),
lookbehind: true,
alias: 'variable',
},
'cookware-keyword': {
pattern: /^#/,
alias: 'keyword',
},
'quantity-group': {
pattern: new RegExp(/\{[^{}@#]*\}/),
inside: {
'quantity': {
pattern: new RegExp(/(^\{)/.source + multi_token_infix),
lookbehind: true,
alias: 'number',
},
'punctuation': /[{}]/,
}
}
},
},
'ingredient-group': { // @...{...}, @...
pattern: new RegExp('@(?:'
+ multi_token
+ '|'
+ single_token_suffix
+ ')'),
inside: {
'ingredient': {
pattern: new RegExp('(^@)(?:'
+ multi_token_infix
+ ')'),
lookbehind: true,
alias: 'variable',
},
'ingredient-keyword': {
pattern: /^@/,
alias: 'keyword',
},
'amount-group': amount_group_impl,
}
},
'timer-group': { // ~timer{...}
// eslint-disable-next-line regexp/sort-alternatives
pattern: /~(?!\s)[^@#~{}]*\{[^{}]*\}/,
inside: {
'timer': {
pattern: /(^~)[^{]+/,
lookbehind: true,
alias: 'variable',
},
'duration-group': { // {...}
pattern: /\{[^{}]*\}/,
inside: {
'punctuation': /[{}]/,
'unit': {
pattern: new RegExp(/(%\s*)/.source + timer_units + /\b/.source),
lookbehind: true,
alias: 'symbol',
},
'operator': /%/,
'duration': {
pattern: /\d+/,
alias: 'number',
},
}
},
'timer-keyword': {
pattern: /^~/,
alias: 'keyword',
},
}
}
};
}(Prism));
1 change: 1 addition & 0 deletions components/prism-cooklang.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/prism-java.js
@@ -1,6 +1,6 @@
(function (Prism) {

var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;
var keywords = /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/;

// full package (optional) + parent classes (optional)
var classNamePrefix = /(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source;
Expand Down
2 changes: 1 addition & 1 deletion components/prism-java.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/prism-purebasic.js
Expand Up @@ -12,7 +12,7 @@ Prism.languages.purebasic = Prism.languages.extend('clike', {
'keyword': /\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,
'function': /\b\w+(?:\.\w+)?\s*(?=\()/,
'number': /(?:\$[\da-f]+|\b-?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)\b/i,
'operator': /(?:@\*?|\?|\*)\w+|-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*/@]/
'operator': /(?:@\*?|\?|\*)\w+\$?|-[>-]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|?\||[~^%?*/@]/
});

Prism.languages.insertBefore('purebasic', 'keyword', {
Expand Down
2 changes: 1 addition & 1 deletion components/prism-purebasic.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1a020d1

Please sign in to comment.