summaryrefslogtreecommitdiff
path: root/themes/elenq
diff options
context:
space:
mode:
authorEkaitz Zárraga <ekaitz.zarraga@protonmail.com>2019-05-30 20:54:57 +0200
committerEkaitz Zárraga <ekaitz.zarraga@protonmail.com>2019-05-30 20:54:57 +0200
commit5e231609ddfe91f0874f8ec1dd61f1b02abc534e (patch)
tree2a3d9da20b4ba233878134df4e349a13767ed48f /themes/elenq
parent6e804b87cc145ac0269b7a85dc667b803e9dbaaa (diff)
add prism for clike languages
Diffstat (limited to 'themes/elenq')
-rw-r--r--themes/elenq/static/js/prism.js54
1 files changed, 44 insertions, 10 deletions
diff --git a/themes/elenq/static/js/prism.js b/themes/elenq/static/js/prism.js
index c7c897f..b28c749 100644
--- a/themes/elenq/static/js/prism.js
+++ b/themes/elenq/static/js/prism.js
@@ -1,5 +1,5 @@
/* PrismJS 1.16.0
-https://prismjs.com/download.html#themes=prism&languages=bash+clojure+latex+lisp+lua+makefile+perl+sql+python+scheme+yaml */
+https://prismjs.com/download.html#themes=prism&languages=clike+bash+clojure+latex+lisp+lua+makefile+perl+sql+python+scheme+yaml */
var _self = (typeof window !== 'undefined')
? window // if in browser
: (
@@ -552,6 +552,37 @@ if (typeof global !== 'undefined') {
global.Prism = Prism;
}
;
+Prism.languages.clike = {
+ 'comment': [
+ {
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
+ lookbehind: true
+ },
+ {
+ pattern: /(^|[^\\:])\/\/.*/,
+ lookbehind: true,
+ greedy: true
+ }
+ ],
+ 'string': {
+ pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
+ greedy: true
+ },
+ 'class-name': {
+ pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,
+ lookbehind: true,
+ inside: {
+ punctuation: /[.\\]/
+ }
+ },
+ 'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
+ 'boolean': /\b(?:true|false)\b/,
+ 'function': /\w+(?=\()/,
+ 'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,
+ 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
+ 'punctuation': /[{}[\];(),.:]/
+};
+
(function(Prism) {
var insideString = {
variable: [
@@ -651,19 +682,19 @@ Prism.languages.clojure = {
punctuation: /[{}\[\](),]/
};
-(function(Prism) {
- var funcPattern = /\\(?:[^a-z()[\]]|[a-z*]+)/i,
- insideEqu = {
- 'equation-command': {
- pattern: funcPattern,
- alias: 'regex'
- }
- };
+(function (Prism) {
+ var funcPattern = /\\(?:[^a-z()[\]]|[a-z*]+)/i;
+ var insideEqu = {
+ 'equation-command': {
+ pattern: funcPattern,
+ alias: 'regex'
+ }
+ };
Prism.languages.latex = {
'comment': /%.*/m,
// the verbatim environment prints whitespace to the document
- 'cdata': {
+ 'cdata': {
pattern: /(\\begin\{((?:verbatim|lstlisting)\*?)\})[\s\S]*?(?=\\end\{\2\})/,
lookbehind: true
},
@@ -711,6 +742,9 @@ Prism.languages.clojure = {
},
'punctuation': /[[\]{}&]/
};
+
+ Prism.languages.tex = Prism.languages.latex;
+ Prism.languages.context = Prism.languages.latex;
})(Prism);
(function (Prism) {