ESLint: Added spacing rules (#2862)
This commit is contained in:
parent
cf7b0fd503
commit
fd20dbe4a3
24
.eslintrc.js
24
.eslintrc.js
|
@ -14,6 +14,30 @@ module.exports = {
|
|||
'semi': 'warn',
|
||||
'wrap-iife': 'warn',
|
||||
|
||||
// spaces
|
||||
'arrow-spacing': 'warn',
|
||||
'block-spacing': 'warn',
|
||||
'comma-spacing': 'warn',
|
||||
'computed-property-spacing': 'warn',
|
||||
'func-call-spacing': 'warn',
|
||||
'generator-star-spacing': 'warn',
|
||||
'key-spacing': 'warn',
|
||||
'keyword-spacing': 'warn',
|
||||
'no-multi-spaces': ['warn', { ignoreEOLComments: true }],
|
||||
'no-trailing-spaces': 'warn',
|
||||
'no-whitespace-before-property': 'warn',
|
||||
'object-curly-spacing': ['warn', 'always'],
|
||||
'rest-spread-spacing': 'warn',
|
||||
'semi-spacing': 'warn',
|
||||
'space-before-blocks': 'warn',
|
||||
'space-before-function-paren': ['warn', { named: 'never' }],
|
||||
'space-in-parens': 'warn',
|
||||
'space-infix-ops': ['warn', { int32Hint: true }],
|
||||
'space-unary-ops': 'warn',
|
||||
'switch-colon-spacing': 'warn',
|
||||
'template-curly-spacing': 'warn',
|
||||
'yield-star-spacing': 'warn',
|
||||
|
||||
// JSDoc
|
||||
'jsdoc/check-alignment': 'warn',
|
||||
'jsdoc/check-syntax': 'warn',
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
(function(){
|
||||
(function () {
|
||||
|
||||
if(!document.body.addEventListener) {
|
||||
if (!document.body.addEventListener) {
|
||||
return;
|
||||
}
|
||||
|
||||
$$('[data-plugin-header]').forEach(function (element) {
|
||||
var plugin = components.plugins[element.getAttribute('data-plugin-header')];
|
||||
element.innerHTML = '<div class="intro" data-src="assets/templates/header-plugins.html" data-type="text/html"></div>\n'
|
||||
+ '<h2>' + plugin.title + '</h2>\n<p>' + plugin.description + '</p>';
|
||||
+ '<h2>' + plugin.title + '</h2>\n<p>' + plugin.description + '</p>';
|
||||
});
|
||||
|
||||
$$('[data-src][data-type="text/html"]').forEach(function(element) {
|
||||
$$('[data-src][data-type="text/html"]').forEach(function (element) {
|
||||
var src = element.getAttribute('data-src');
|
||||
var html = element.getAttribute('data-type') === 'text/html';
|
||||
var contentProperty = html ? 'innerHTML' : 'textContent';
|
||||
|
||||
$u.xhr({
|
||||
url: src,
|
||||
callback: function(xhr) {
|
||||
callback: function (xhr) {
|
||||
try {
|
||||
element[contentProperty] = xhr.responseText;
|
||||
|
||||
|
@ -38,10 +38,10 @@ $$('[data-src][data-type="text/html"]').forEach(function(element) {
|
|||
/**
|
||||
* Table of contents
|
||||
*/
|
||||
(function(){
|
||||
(function () {
|
||||
var toc = document.createElement('ol');
|
||||
|
||||
$$('body > section > h1').forEach(function(h1) {
|
||||
$$('body > section > h1').forEach(function (h1) {
|
||||
var section = h1.parentNode;
|
||||
var text = h1.textContent;
|
||||
var id = h1.id || section.id;
|
||||
|
@ -118,21 +118,21 @@ if (toc.children.length > 0) {
|
|||
}());
|
||||
|
||||
// calc()
|
||||
(function(){
|
||||
if(!window.PrefixFree) return;
|
||||
(function () {
|
||||
if (!window.PrefixFree) return;
|
||||
|
||||
if (PrefixFree.functions.indexOf('calc') == -1) {
|
||||
var style = document.createElement('_').style;
|
||||
style.width = 'calc(1px + 1%)';
|
||||
|
||||
if(!style.width) {
|
||||
if (!style.width) {
|
||||
// calc not supported
|
||||
var header = $('header');
|
||||
var footer = $('footer');
|
||||
|
||||
function calculatePadding() {
|
||||
header.style.padding =
|
||||
footer.style.padding = '30px ' + (innerWidth/2 - 450) + 'px';
|
||||
footer.style.padding = '30px ' + (innerWidth / 2 - 450) + 'px';
|
||||
}
|
||||
|
||||
addEventListener('resize', calculatePadding);
|
||||
|
@ -144,7 +144,7 @@ if (toc.children.length > 0) {
|
|||
// setTheme is intentionally global,
|
||||
// so it can be accessed from download.js
|
||||
var setTheme;
|
||||
(function() {
|
||||
(function () {
|
||||
var p = $u.element.create('p', {
|
||||
properties: {
|
||||
id: 'theme'
|
||||
|
@ -166,7 +166,7 @@ if (!(current in themes)) {
|
|||
if (current === undefined) {
|
||||
var stored = localStorage.getItem('theme');
|
||||
|
||||
current = stored in themes? stored : 'prism';
|
||||
current = stored in themes ? stored : 'prism';
|
||||
}
|
||||
|
||||
setTheme = function (id) {
|
||||
|
@ -208,7 +208,7 @@ for (var id in themes) {
|
|||
setTheme(current);
|
||||
}());
|
||||
|
||||
(function(){
|
||||
(function () {
|
||||
|
||||
function listPlugins(ul) {
|
||||
for (var id in components.plugins) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Manage downloads
|
||||
*/
|
||||
|
||||
(function() {
|
||||
(function () {
|
||||
|
||||
var cache = {};
|
||||
var form = $('form');
|
||||
|
@ -11,10 +11,10 @@ var minified = true;
|
|||
var dependencies = {};
|
||||
|
||||
var treeURL = 'https://api.github.com/repos/PrismJS/prism/git/trees/master?recursive=1';
|
||||
var treePromise = new Promise(function(resolve) {
|
||||
var treePromise = new Promise(function (resolve) {
|
||||
$u.xhr({
|
||||
url: treeURL,
|
||||
callback: function(xhr) {
|
||||
callback: function (xhr) {
|
||||
if (xhr.status < 400) {
|
||||
resolve(JSON.parse(xhr.responseText).tree);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ function toArray(value) {
|
|||
|
||||
var hstr = window.location.hash.match(/(?:languages|plugins)=[-+\w]+|themes=[-\w]+/g);
|
||||
if (hstr) {
|
||||
hstr.forEach(function(str) {
|
||||
hstr.forEach(function (str) {
|
||||
var kv = str.split('=', 2);
|
||||
var category = kv[0];
|
||||
var ids = kv[1].split('+');
|
||||
|
@ -111,10 +111,10 @@ for (var category in components) {
|
|||
name: 'check-all-' + category,
|
||||
value: '',
|
||||
checked: false,
|
||||
onclick: (function(category, all){
|
||||
onclick: (function (category, all) {
|
||||
return function () {
|
||||
var checkAll = this;
|
||||
$$('input[name="download-' + category + '"]').forEach(function(input) {
|
||||
$$('input[name="download-' + category + '"]').forEach(function (input) {
|
||||
all[input.value].enabled = input.checked = checkAll.checked;
|
||||
});
|
||||
|
||||
|
@ -130,7 +130,7 @@ for (var category in components) {
|
|||
}
|
||||
|
||||
for (var id in all) {
|
||||
if(id === 'meta') {
|
||||
if (id === 'meta') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -205,19 +205,19 @@ for (var category in components) {
|
|||
{
|
||||
tag: 'input',
|
||||
properties: {
|
||||
type: all.meta.exclusive? 'radio' : 'checkbox',
|
||||
type: all.meta.exclusive ? 'radio' : 'checkbox',
|
||||
name: 'download-' + category,
|
||||
value: id,
|
||||
checked: checked,
|
||||
disabled: disabled,
|
||||
onclick: (function(id, category, all){
|
||||
onclick: (function (id, category, all) {
|
||||
return function () {
|
||||
$$('input[name="' + this.name + '"]').forEach(function(input) {
|
||||
$$('input[name="' + this.name + '"]').forEach(function (input) {
|
||||
all[input.value].enabled = input.checked;
|
||||
});
|
||||
|
||||
if (all[id].require && this.checked) {
|
||||
all[id].require.forEach(function(v) {
|
||||
all[id].require.forEach(function (v) {
|
||||
var input = $('label[data-id="' + v + '"] > input');
|
||||
input.checked = true;
|
||||
|
||||
|
@ -226,7 +226,7 @@ for (var category in components) {
|
|||
}
|
||||
|
||||
if (dependencies[id] && !this.checked) { // It’s required by others
|
||||
dependencies[id].forEach(function(dependent) {
|
||||
dependencies[id].forEach(function (dependent) {
|
||||
var input = $('label[data-id="' + dependent + '"] > input');
|
||||
input.checked = false;
|
||||
|
||||
|
@ -239,7 +239,7 @@ for (var category in components) {
|
|||
}(id, category, all))
|
||||
}
|
||||
},
|
||||
all.meta.link? {
|
||||
all.meta.link ? {
|
||||
tag: 'a',
|
||||
properties: {
|
||||
href: all.meta.link.replace(/\{id}/g, id),
|
||||
|
@ -254,7 +254,7 @@ for (var category in components) {
|
|||
contents: getLanguageTitle(info)
|
||||
},
|
||||
' ',
|
||||
all[id].owner? {
|
||||
all[id].owner ? {
|
||||
tag: 'a',
|
||||
properties: {
|
||||
href: 'https://github.com/' + all[id].owner,
|
||||
|
@ -290,16 +290,16 @@ for (var category in components) {
|
|||
}
|
||||
|
||||
form.elements.compression[0].onclick =
|
||||
form.elements.compression[1].onclick = function() {
|
||||
form.elements.compression[1].onclick = function () {
|
||||
minified = !!+this.value;
|
||||
|
||||
getFilesSizes();
|
||||
};
|
||||
|
||||
function getFileSize(filepath) {
|
||||
return treePromise.then(function(tree) {
|
||||
for(var i=0, l=tree.length; i<l; i++) {
|
||||
if(tree[i].path === filepath) {
|
||||
return treePromise.then(function (tree) {
|
||||
for (var i = 0, l = tree.length; i < l; i++) {
|
||||
if (tree[i].path === filepath) {
|
||||
return tree[i].size;
|
||||
}
|
||||
}
|
||||
|
@ -311,21 +311,21 @@ function getFilesSizes() {
|
|||
var all = components[category];
|
||||
|
||||
for (var id in all) {
|
||||
if(id === 'meta') {
|
||||
if (id === 'meta') {
|
||||
continue;
|
||||
}
|
||||
|
||||
var distro = all[id].files[minified? 'minified' : 'dev'];
|
||||
var distro = all[id].files[minified ? 'minified' : 'dev'];
|
||||
var files = distro.paths;
|
||||
|
||||
files.forEach(function (filepath) {
|
||||
var file = cache[filepath] = cache[filepath] || {};
|
||||
|
||||
if(!file.size) {
|
||||
if (!file.size) {
|
||||
|
||||
(function(category, id) {
|
||||
getFileSize(filepath).then(function(size) {
|
||||
if(size) {
|
||||
(function (category, id) {
|
||||
getFileSize(filepath).then(function (size) {
|
||||
if (size) {
|
||||
file.size = size;
|
||||
distro.size += file.size;
|
||||
|
||||
|
@ -344,10 +344,10 @@ function getFilesSizes() {
|
|||
getFilesSizes();
|
||||
|
||||
function getFileContents(filepath) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
$u.xhr({
|
||||
url: filepath,
|
||||
callback: function(xhr) {
|
||||
callback: function (xhr) {
|
||||
if (xhr.status < 400 && xhr.responseText) {
|
||||
resolve(xhr.responseText);
|
||||
} else {
|
||||
|
@ -359,12 +359,12 @@ function getFileContents(filepath) {
|
|||
}
|
||||
|
||||
function prettySize(size) {
|
||||
return Math.round(100 * size / 1024)/100 + 'KB';
|
||||
return Math.round(100 * size / 1024) / 100 + 'KB';
|
||||
}
|
||||
|
||||
function update(updatedCategory, updatedId){
|
||||
function update(updatedCategory, updatedId) {
|
||||
// Update total size
|
||||
var total = {js: 0, css: 0}, updated = {js: 0, css: 0};
|
||||
var total = { js: 0, css: 0 }, updated = { js: 0, css: 0 };
|
||||
|
||||
for (var category in components) {
|
||||
var all = components[category];
|
||||
|
@ -374,9 +374,9 @@ function update(updatedCategory, updatedId){
|
|||
var info = all[id];
|
||||
|
||||
if (info.enabled || id == updatedId) {
|
||||
var distro = info.files[minified? 'minified' : 'dev'];
|
||||
var distro = info.files[minified ? 'minified' : 'dev'];
|
||||
|
||||
distro.paths.forEach(function(path) {
|
||||
distro.paths.forEach(function (path) {
|
||||
if (cache[path]) {
|
||||
var file = cache[path];
|
||||
|
||||
|
@ -448,14 +448,14 @@ function update(updatedCategory, updatedId){
|
|||
|
||||
var timerId = 0;
|
||||
// "debounce" multiple rapid requests to generate and highlight code
|
||||
function delayedGenerateCode(){
|
||||
if ( timerId !== 0 ) {
|
||||
function delayedGenerateCode() {
|
||||
if (timerId !== 0) {
|
||||
clearTimeout(timerId);
|
||||
}
|
||||
timerId = setTimeout(generateCode, 500);
|
||||
}
|
||||
|
||||
function generateCode(){
|
||||
function generateCode() {
|
||||
/** @type {CodePromiseInfo[]} */
|
||||
var promises = [];
|
||||
var redownload = {};
|
||||
|
@ -493,7 +493,7 @@ function generateCode(){
|
|||
var error = $('#download .error');
|
||||
error.style.display = '';
|
||||
|
||||
Promise.all([buildCode(promises), getVersion()]).then(function(arr) {
|
||||
Promise.all([buildCode(promises), getVersion()]).then(function (arr) {
|
||||
var res = arr[0];
|
||||
var version = arr[1];
|
||||
var code = res.code;
|
||||
|
@ -509,7 +509,7 @@ function generateCode(){
|
|||
for (var category in redownload) {
|
||||
redownloadUrl += category + '=' + redownload[category].join('+') + '&';
|
||||
}
|
||||
redownloadUrl = redownloadUrl.replace(/&$/,'');
|
||||
redownloadUrl = redownloadUrl.replace(/&$/, '');
|
||||
window.location.replace(redownloadUrl);
|
||||
|
||||
var versionComment = '/* PrismJS ' + version + '\n' + redownloadUrl + ' */';
|
||||
|
@ -584,18 +584,18 @@ function buildCode(promises) {
|
|||
// build
|
||||
var i = 0;
|
||||
var l = promises.length;
|
||||
var code = {js: '', css: ''};
|
||||
var code = { js: '', css: '' };
|
||||
var errors = [];
|
||||
|
||||
var f = function(resolve) {
|
||||
if(i < l) {
|
||||
var f = function (resolve) {
|
||||
if (i < l) {
|
||||
var p = promises[i];
|
||||
p.contentsPromise.then(function(contents) {
|
||||
p.contentsPromise.then(function (contents) {
|
||||
code[p.type] += contents + (p.type === 'js' && !/;\s*$/.test(contents) ? ';' : '') + '\n';
|
||||
i++;
|
||||
f(resolve);
|
||||
});
|
||||
p.contentsPromise['catch'](function() {
|
||||
p.contentsPromise['catch'](function () {
|
||||
errors.push($u.element.create({
|
||||
tag: 'p',
|
||||
prop: {
|
||||
|
@ -606,7 +606,7 @@ function buildCode(promises) {
|
|||
f(resolve);
|
||||
});
|
||||
} else {
|
||||
resolve({code: code, errors: errors});
|
||||
resolve({ code: code, errors: errors });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Manage examples
|
||||
*/
|
||||
|
||||
(function() {
|
||||
(function () {
|
||||
|
||||
var examples = {};
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
|||
Prism.languages.actionscript = Prism.languages.extend('javascript', {
|
||||
Prism.languages.actionscript = Prism.languages.extend('javascript', {
|
||||
'keyword': /\b(?:as|break|case|catch|class|const|default|delete|do|else|extends|finally|for|function|if|implements|import|in|instanceof|interface|internal|is|native|new|null|package|private|protected|public|return|super|switch|this|throw|try|typeof|use|var|void|while|with|dynamic|each|final|get|include|namespace|native|override|set|static)\b/,
|
||||
'operator': /\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<<?|>>?>?|[!=]=?)=?|[~?@]/
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
// $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
|
||||
// + LC_ALL, RANDOM, REPLY, SECONDS.
|
||||
// + make sure PS1..4 are here as they are not always set,
|
||||
|
@ -219,7 +219,7 @@
|
|||
'number'
|
||||
];
|
||||
var inside = insideString.variable[1].inside;
|
||||
for(var i = 0; i < toBeCopied.length; i++) {
|
||||
for (var i = 0; i < toBeCopied.length; i++) {
|
||||
inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ Prism.languages.bro = {
|
|||
pattern: /(^|[^\\$])#.*/,
|
||||
lookbehind: true,
|
||||
inside: {
|
||||
'italic': /\b(?:TODO|FIXME|XXX)\b/
|
||||
'italic': /\b(?:TODO|FIXME|XXX)\b/
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
|
||||
// Ignore comments starting with { to privilege string interpolation highlighting
|
||||
var comment = /#(?!\{).+/;
|
||||
|
|
|
@ -16,7 +16,7 @@ var _self = (typeof window !== 'undefined')
|
|||
* @namespace
|
||||
* @public
|
||||
*/
|
||||
var Prism = (function (_self){
|
||||
var Prism = (function (_self) {
|
||||
|
||||
// Private helper vars
|
||||
var lang = /\blang(?:uage)?-([\w-]+)\b/i;
|
||||
|
@ -407,7 +407,7 @@ var _ = {
|
|||
root[inside] = ret;
|
||||
|
||||
// Update references in other language definitions
|
||||
_.languages.DFS(_.languages, function(key, value) {
|
||||
_.languages.DFS(_.languages, function (key, value) {
|
||||
if (value === old && key != inside) {
|
||||
this[key] = ret;
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ var _ = {
|
|||
* @memberof Prism
|
||||
* @public
|
||||
*/
|
||||
highlightAll: function(async, callback) {
|
||||
highlightAll: function (async, callback) {
|
||||
_.highlightAllUnder(document, async, callback);
|
||||
},
|
||||
|
||||
|
@ -474,7 +474,7 @@ var _ = {
|
|||
* @memberof Prism
|
||||
* @public
|
||||
*/
|
||||
highlightAllUnder: function(container, async, callback) {
|
||||
highlightAllUnder: function (container, async, callback) {
|
||||
var env = {
|
||||
callback: callback,
|
||||
container: container,
|
||||
|
@ -520,7 +520,7 @@ var _ = {
|
|||
* @memberof Prism
|
||||
* @public
|
||||
*/
|
||||
highlightElement: function(element, async, callback) {
|
||||
highlightElement: function (element, async, callback) {
|
||||
// Find language
|
||||
var language = _.util.getLanguage(element);
|
||||
var grammar = _.languages[language];
|
||||
|
@ -579,7 +579,7 @@ var _ = {
|
|||
if (async && _self.Worker) {
|
||||
var worker = new Worker(_.filename);
|
||||
|
||||
worker.onmessage = function(evt) {
|
||||
worker.onmessage = function (evt) {
|
||||
insertHighlightedCode(evt.data);
|
||||
};
|
||||
|
||||
|
@ -649,7 +649,7 @@ var _ = {
|
|||
* }
|
||||
* });
|
||||
*/
|
||||
tokenize: function(text, grammar) {
|
||||
tokenize: function (text, grammar) {
|
||||
var rest = grammar.rest;
|
||||
if (rest) {
|
||||
for (var token in rest) {
|
||||
|
@ -711,7 +711,7 @@ var _ = {
|
|||
return;
|
||||
}
|
||||
|
||||
for (var i=0, callback; (callback = callbacks[i++]);) {
|
||||
for (var i = 0, callback; (callback = callbacks[i++]);) {
|
||||
callback(env);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
Prism.languages.crystal = Prism.languages.extend('ruby', {
|
||||
keyword: [
|
||||
/\b(?:abstract|alias|as|asm|begin|break|case|class|def|do|else|elsif|end|ensure|enum|extend|for|fun|if|include|instance_sizeof|lib|macro|module|next|of|out|pointerof|private|protected|rescue|return|require|select|self|sizeof|struct|super|then|type|typeof|uninitialized|union|unless|until|when|while|with|yield|__DIR__|__END_LINE__|__FILE__|__LINE__)\b/,
|
||||
|
|
|
@ -46,14 +46,14 @@
|
|||
'operator': /\bis!|\b(?:as|is)\b|\+\+|--|&&|\|\||<<=?|>>=?|~(?:\/=?)?|[+\-*\/%&^|=!<>]=?|\?/
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('dart','function',{
|
||||
Prism.languages.insertBefore('dart', 'function', {
|
||||
'metadata': {
|
||||
pattern: /@\w+/,
|
||||
alias: 'symbol'
|
||||
}
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('dart','class-name',{
|
||||
Prism.languages.insertBefore('dart', 'class-name', {
|
||||
'generics': {
|
||||
pattern: /<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<(?:[\w\s,.&?]|<[\w\s,.&?]*>)*>)*>)*>/,
|
||||
inside: {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function (Prism) {
|
||||
(function (Prism) {
|
||||
Prism.languages.dataweave = {
|
||||
'url': /\b[A-Za-z]+:\/\/[\w/:.?=&-]+|\burn:[\w:.?=&-]+/,
|
||||
'property': {
|
||||
|
@ -9,7 +9,7 @@
|
|||
pattern: /(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1/,
|
||||
greedy: true
|
||||
},
|
||||
'mime-type': /\b(?:text|audio|video|application|multipart|image)\/[\w+-]+/,
|
||||
'mime-type': /\b(?:text|audio|video|application|multipart|image)\/[\w+-]+/,
|
||||
'date': {
|
||||
pattern: /\|[\w:+-]+\|/,
|
||||
greedy: true
|
||||
|
@ -32,10 +32,10 @@
|
|||
},
|
||||
'function': /\b[A-Za-z_]\w*(?=\s*\()/i,
|
||||
'number': /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
|
||||
'punctuation': /[{}[\];(),.:@]/,
|
||||
'punctuation': /[{}[\];(),.:@]/,
|
||||
'operator': /<<|>>|->|[<>~=]=?|!=|--?-?|\+\+?|\!|\?/,
|
||||
'boolean': /\b(?:true|false)\b/,
|
||||
'keyword': /\b(?:match|input|output|ns|type|update|null|if|else|using|unless|at|is|as|case|do|fun|var|not|and|or)\b/
|
||||
};
|
||||
|
||||
|
||||
}(Prism));
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
}
|
||||
};
|
||||
|
||||
Prism.hooks.add('before-tokenize', function(env) {
|
||||
Prism.hooks.add('before-tokenize', function (env) {
|
||||
var ejsPattern = /<%(?!%)[\s\S]+?%>/g;
|
||||
Prism.languages['markup-templating'].buildPlaceholders(env, 'ejs', ejsPattern);
|
||||
});
|
||||
|
||||
Prism.hooks.add('after-tokenize', function(env) {
|
||||
Prism.hooks.add('after-tokenize', function (env) {
|
||||
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'ejs');
|
||||
});
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ Prism.languages.elixir = {
|
|||
'punctuation': /<<|>>|[.,%\[\]{}()]/
|
||||
};
|
||||
|
||||
Prism.languages.elixir.string.forEach(function(o) {
|
||||
Prism.languages.elixir.string.forEach(function (o) {
|
||||
o.inside = {
|
||||
'interpolation': {
|
||||
pattern: /#\{[^}]+\}/,
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
}
|
||||
});
|
||||
|
||||
Prism.hooks.add('before-tokenize', function(env) {
|
||||
Prism.hooks.add('before-tokenize', function (env) {
|
||||
var erbPattern = /<%=?(?:[^\r\n]|[\r\n](?!=begin)|[\r\n]=begin\s[\s\S]*?^=end)+?%>/gm;
|
||||
Prism.languages['markup-templating'].buildPlaceholders(env, 'erb', erbPattern);
|
||||
});
|
||||
|
||||
Prism.hooks.add('after-tokenize', function(env) {
|
||||
Prism.hooks.add('after-tokenize', function (env) {
|
||||
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'erb');
|
||||
});
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@
|
|||
};
|
||||
|
||||
var escape = function (str) {
|
||||
return (str+'').replace(/([.?*+\^$\[\]\\(){}|\-])/g, '\\$1');
|
||||
return (str + '').replace(/([.?*+\^$\[\]\\(){}|\-])/g, '\\$1');
|
||||
};
|
||||
|
||||
var arrToWordsRegExp = function (arr) {
|
||||
|
@ -375,7 +375,7 @@
|
|||
};
|
||||
|
||||
Object.keys(builtins).forEach(function (k) {
|
||||
factor[k].pattern = arrToWordsRegExp( builtins[k] );
|
||||
factor[k].pattern = arrToWordsRegExp(builtins[k]);
|
||||
});
|
||||
|
||||
var combinators = [
|
||||
|
|
|
@ -41,7 +41,7 @@ Prism.languages.insertBefore('groovy', 'function', {
|
|||
});
|
||||
|
||||
// Handle string interpolation
|
||||
Prism.hooks.add('wrap', function(env) {
|
||||
Prism.hooks.add('wrap', function (env) {
|
||||
if (env.language === 'groovy' && env.type === 'string') {
|
||||
var delimiter = env.content[0];
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
code |
|
||||
*/
|
||||
|
||||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
|
||||
Prism.languages.haml = {
|
||||
// Multiline stuff should appear before the rest
|
||||
|
@ -109,7 +109,7 @@
|
|||
// Non exhaustive list of available filters and associated languages
|
||||
var filters = [
|
||||
'css',
|
||||
{filter:'coffee',language:'coffeescript'},
|
||||
{ filter: 'coffee', language: 'coffeescript' },
|
||||
'erb',
|
||||
'javascript',
|
||||
'less',
|
||||
|
@ -121,7 +121,7 @@
|
|||
var all_filters = {};
|
||||
for (var i = 0, l = filters.length; i < l; i++) {
|
||||
var filter = filters[i];
|
||||
filter = typeof filter === 'string' ? {filter: filter, language: filter} : filter;
|
||||
filter = typeof filter === 'string' ? { filter: filter, language: filter } : filter;
|
||||
if (Prism.languages[filter.language]) {
|
||||
all_filters['filter-' + filter.filter] = {
|
||||
pattern: RegExp(filter_pattern.replace('{{filter_name}}', function () { return filter.filter; })),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
|
||||
Prism.languages.handlebars = {
|
||||
'comment': /\{\{![\s\S]*?\}\}/,
|
||||
|
@ -25,12 +25,12 @@
|
|||
'variable': /[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/
|
||||
};
|
||||
|
||||
Prism.hooks.add('before-tokenize', function(env) {
|
||||
Prism.hooks.add('before-tokenize', function (env) {
|
||||
var handlebarsPattern = /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g;
|
||||
Prism.languages['markup-templating'].buildPlaceholders(env, 'handlebars', handlebarsPattern);
|
||||
});
|
||||
|
||||
Prism.hooks.add('after-tokenize', function(env) {
|
||||
Prism.hooks.add('after-tokenize', function (env) {
|
||||
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'handlebars');
|
||||
});
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ Prism.languages.inform7 = {
|
|||
pattern: /\[[^\]]+\]/,
|
||||
inside: {
|
||||
'delimiter': {
|
||||
pattern:/\[|\]/,
|
||||
pattern: /\[|\]/,
|
||||
alias: 'punctuation'
|
||||
}
|
||||
// See rest below
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Prism.languages.ini= {
|
||||
Prism.languages.ini = {
|
||||
|
||||
/**
|
||||
* The component mimics the behavior of the Win32 API parser.
|
||||
|
|
|
@ -23,7 +23,7 @@ Prism.languages.io = {
|
|||
greedy: true
|
||||
},
|
||||
'keyword': /\b(?:activate|activeCoroCount|asString|block|break|catch|clone|collectGarbage|compileString|continue|do|doFile|doMessage|doString|else|elseif|exit|for|foreach|forward|getSlot|getEnvironmentVariable|hasSlot|if|ifFalse|ifNil|ifNilEval|ifTrue|isActive|isNil|isResumable|list|message|method|parent|pass|pause|perform|performWithArgList|print|println|proto|raise|raiseResumable|removeSlot|resend|resume|schedulerSleepSeconds|self|sender|setSchedulerSleepSeconds|setSlot|shallowCopy|slotNames|super|system|then|thisBlock|thisContext|call|try|type|uniqueId|updateSlot|wait|while|write|yield)\b/,
|
||||
'builtin':/\b(?:Array|AudioDevice|AudioMixer|Block|Box|Buffer|CFunction|CGI|Color|Curses|DBM|DNSResolver|DOConnection|DOProxy|DOServer|Date|Directory|Duration|DynLib|Error|Exception|FFT|File|Fnmatch|Font|Future|GL|GLE|GLScissor|GLU|GLUCylinder|GLUQuadric|GLUSphere|GLUT|Host|Image|Importer|LinkList|List|Lobby|Locals|MD5|MP3Decoder|MP3Encoder|Map|Message|Movie|Notification|Number|Object|OpenGL|Point|Protos|Regex|SGML|SGMLElement|SGMLParser|SQLite|Server|Sequence|ShowMessage|SleepyCat|SleepyCatCursor|Socket|SocketManager|Sound|Soup|Store|String|Tree|UDPSender|UPDReceiver|URL|User|Warning|WeakLink|Random|BigNum)\b/,
|
||||
'builtin': /\b(?:Array|AudioDevice|AudioMixer|Block|Box|Buffer|CFunction|CGI|Color|Curses|DBM|DNSResolver|DOConnection|DOProxy|DOServer|Date|Directory|Duration|DynLib|Error|Exception|FFT|File|Fnmatch|Font|Future|GL|GLE|GLScissor|GLU|GLUCylinder|GLUQuadric|GLUSphere|GLUT|Host|Image|Importer|LinkList|List|Lobby|Locals|MD5|MP3Decoder|MP3Encoder|Map|Message|Movie|Notification|Number|Object|OpenGL|Point|Protos|Regex|SGML|SGMLElement|SGMLParser|SQLite|Server|Sequence|ShowMessage|SleepyCat|SleepyCatCursor|Socket|SocketManager|Sound|Soup|Store|String|Tree|UDPSender|UPDReceiver|URL|User|Warning|WeakLink|Random|BigNum)\b/,
|
||||
'boolean': /\b(?:true|false|nil)\b/,
|
||||
'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e-?\d+)?/i,
|
||||
'operator': /[=!*/%+\-^&|]=|>>?=?|<<?=?|:?:?=|\+\+?|--?|\*\*?|\/\/?|%|\|\|?|&&?|\b(?:return|and|or|not)\b|@@?|\?\??|\.\./,
|
||||
|
|
|
@ -13,7 +13,7 @@ Prism.languages.jolie = Prism.languages.extend('clike', {
|
|||
|
||||
delete Prism.languages.jolie['class-name'];
|
||||
|
||||
Prism.languages.insertBefore( 'jolie', 'keyword', {
|
||||
Prism.languages.insertBefore('jolie', 'keyword', {
|
||||
'function':
|
||||
{
|
||||
pattern: /((?:\b(?:outputPort|inputPort|in|service|courier)\b|@)\s*)\w+/,
|
||||
|
@ -26,7 +26,7 @@ Prism.languages.insertBefore( 'jolie', 'keyword', {
|
|||
'with-extension': {
|
||||
pattern: /\bwith\s+\w+/,
|
||||
inside: {
|
||||
'keyword' : /\bwith\b/
|
||||
'keyword': /\bwith\b/
|
||||
}
|
||||
},
|
||||
'function': {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
|
||||
var javascript = Prism.util.clone(Prism.languages.javascript);
|
||||
|
||||
|
@ -38,7 +38,7 @@ Prism.languages.insertBefore('inside', 'attr-name', {
|
|||
}
|
||||
}, Prism.languages.jsx.tag);
|
||||
|
||||
Prism.languages.insertBefore('inside', 'special-attr',{
|
||||
Prism.languages.insertBefore('inside', 'special-attr', {
|
||||
'script': {
|
||||
// Allow for two levels of nesting
|
||||
pattern: re(/=<BRACES>/.source),
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
},
|
||||
}, markupLatte.tag);
|
||||
|
||||
Prism.hooks.add('before-tokenize', function(env) {
|
||||
Prism.hooks.add('before-tokenize', function (env) {
|
||||
if (env.language !== 'latte') {
|
||||
return;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@
|
|||
env.grammar = markupLatte;
|
||||
});
|
||||
|
||||
Prism.hooks.add('after-tokenize', function(env) {
|
||||
Prism.hooks.add('after-tokenize', function (env) {
|
||||
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'latte');
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
Prism.languages.llvm = {
|
||||
'comment': /;.*/,
|
||||
'string': {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
// aggregation pipeline stages
|
||||
'$addFields', '$bucket', '$bucketAuto', '$collStats', '$count', '$currentOp', '$facet', '$geoNear',
|
||||
'$graphLookup', '$group','$indexStats', '$limit', '$listLocalSessions', '$listSessions', '$lookup',
|
||||
'$graphLookup', '$group', '$indexStats', '$limit', '$listLocalSessions', '$listSessions', '$lookup',
|
||||
'$match', '$merge', '$out', '$planCacheStats', '$project', '$redact', '$replaceRoot', '$replaceWith',
|
||||
'$sample', '$set', '$skip', '$sort', '$sortByCount', '$unionWith', '$unset', '$unwind',
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
|||
'UUID',
|
||||
];
|
||||
|
||||
operators = operators.map(function(operator) {
|
||||
operators = operators.map(function (operator) {
|
||||
return operator.replace('$', '\\$');
|
||||
});
|
||||
|
||||
|
|
|
@ -11,4 +11,4 @@ Prism.languages.insertBefore('n4js', 'constant', {
|
|||
}
|
||||
});
|
||||
|
||||
Prism.languages.n4jsd=Prism.languages.n4js;
|
||||
Prism.languages.n4jsd = Prism.languages.n4js;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
// TODO:
|
||||
// - Add CSS highlighting inside <style> tags
|
||||
// - Add support for multi-line code blocks
|
||||
|
@ -149,20 +149,20 @@
|
|||
|
||||
// Non exhaustive list of available filters and associated languages
|
||||
var filters = [
|
||||
{filter:'atpl',language:'twig'},
|
||||
{filter:'coffee',language:'coffeescript'},
|
||||
{ filter: 'atpl', language: 'twig' },
|
||||
{ filter: 'coffee', language: 'coffeescript' },
|
||||
'ejs',
|
||||
'handlebars',
|
||||
'less',
|
||||
'livescript',
|
||||
'markdown',
|
||||
{filter:'sass',language:'scss'},
|
||||
{ filter: 'sass', language: 'scss' },
|
||||
'stylus'
|
||||
];
|
||||
var all_filters = {};
|
||||
for (var i = 0, l = filters.length; i < l; i++) {
|
||||
var filter = filters[i];
|
||||
filter = typeof filter === 'string' ? {filter: filter, language: filter} : filter;
|
||||
filter = typeof filter === 'string' ? { filter: filter, language: filter } : filter;
|
||||
if (Prism.languages[filter.language]) {
|
||||
all_filters['filter-' + filter.filter] = {
|
||||
pattern: RegExp(filter_pattern.replace('{{filter_name}}', function () { return filter.filter; }), 'm'),
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
if (Prism.languages[alias]) {
|
||||
var o = {};
|
||||
o['inline-lang-' + alias] = {
|
||||
pattern: RegExp(inlineLanguageRe.replace('{lang}', lang.replace(/([.+*?\/\\(){}\[\]])/g,'\\$1')), 'i'),
|
||||
pattern: RegExp(inlineLanguageRe.replace('{lang}', lang.replace(/([.+*?\/\\(){}\[\]])/g, '\\$1')), 'i'),
|
||||
inside: Prism.util.clone(Prism.languages.pure['inline-lang'].inside)
|
||||
};
|
||||
o['inline-lang-' + alias].inside.rest = Prism.util.clone(Prism.languages[alias]);
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
type: 'Adj BigInt Bool Ctl Double false Int One Pauli PauliI PauliX PauliY PauliZ Qubit Range Result String true Unit Zero',
|
||||
// all other keywords
|
||||
other: 'Adjoint adjoint apply as auto body borrow borrowing Controlled controlled distribute elif else fail fixup for function if in internal intrinsic invert is let mutable namespace new newtype open operation repeat return self set until use using while within'
|
||||
};
|
||||
};
|
||||
// keywords
|
||||
function keywordsToPattern(words) {
|
||||
return '\\b(?:' + words.trim().replace(/ /g, '|') + ')\\b';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Prism.languages.renpy= {
|
||||
Prism.languages.renpy = {
|
||||
// TODO Write tests.
|
||||
|
||||
'comment': {
|
||||
|
@ -11,21 +11,21 @@ Prism.languages.renpy= {
|
|||
greedy: true
|
||||
},
|
||||
|
||||
'function' : /[a-z_]\w*(?=\()/i,
|
||||
'function': /[a-z_]\w*(?=\()/i,
|
||||
|
||||
'property': /\b(?:insensitive|idle|hover|selected_idle|selected_hover|background|position|alt|xpos|ypos|pos|xanchor|yanchor|anchor|xalign|yalign|align|xcenter|ycenter|xofsset|yoffset|ymaximum|maximum|xmaximum|xminimum|yminimum|minimum|xsize|ysizexysize|xfill|yfill|area|antialias|black_color|bold|caret|color|first_indent|font|size|italic|justify|kerning|language|layout|line_leading|line_overlap_split|line_spacing|min_width|newline_indent|outlines|rest_indent|ruby_style|slow_cps|slow_cps_multiplier|strikethrough|text_align|underline|hyperlink_functions|vertical|hinting|foreground|left_margin|xmargin|top_margin|bottom_margin|ymargin|left_padding|right_padding|xpadding|top_padding|bottom_padding|ypadding|size_group|child|hover_sound|activate_sound|mouse|focus_mask|keyboard_focus|bar_vertical|bar_invert|bar_resizing|left_gutter|right_gutter|top_gutter|bottom_gutter|left_bar|right_bar|top_bar|bottom_bar|thumb|thumb_shadow|thumb_offset|unscrollable|spacing|first_spacing|box_reverse|box_wrap|order_reverse|fit_first|ysize|thumbnail_width|thumbnail_height|help|text_ypos|text_xpos|idle_color|hover_color|selected_idle_color|selected_hover_color|insensitive_color|alpha|insensitive_background|hover_background|zorder|value|width|xadjustment|xanchoraround|xaround|xinitial|xoffset|xzoom|yadjustment|yanchoraround|yaround|yinitial|yzoom|zoom|ground|height|text_style|text_y_fudge|selected_insensitive|has_sound|has_music|has_voice|focus|hovered|image_style|length|minwidth|mousewheel|offset|prefix|radius|range|right_margin|rotate|rotate_pad|developer|screen_width|screen_height|window_title|name|version|windows_icon|default_fullscreen|default_text_cps|default_afm_time|main_menu_music|sample_sound|enter_sound|exit_sound|save_directory|enter_transition|exit_transition|intra_transition|main_game_transition|game_main_transition|end_splash_transition|end_game_transition|after_load_transition|window_show_transition|window_hide_transition|adv_nvl_transition|nvl_adv_transition|enter_yesno_transition|exit_yesno_transition|enter_replay_transition|exit_replay_transition|say_attribute_transition|directory_name|executable_name|include_update|window_icon|modal|google_play_key|google_play_salt|drag_name|drag_handle|draggable|dragged|droppable|dropped|narrator_menu|action|default_afm_enable|version_name|version_tuple|inside|fadeout|fadein|layers|layer_clipping|linear|scrollbars|side_xpos|side_ypos|side_spacing|edgescroll|drag_joined|drag_raise|drop_shadow|drop_shadow_color|subpixel|easein|easeout|time|crop|auto|update|get_installed_packages|can_update|UpdateVersion|Update|overlay_functions|translations|window_left_padding|show_side_image|show_two_window)\b/,
|
||||
|
||||
'tag': /\b(?:label|image|menu|[hv]box|frame|text|imagemap|imagebutton|bar|vbar|screen|textbutton|buttoscreenn|fixed|grid|input|key|mousearea|side|timer|viewport|window|hotspot|hotbar|self|button|drag|draggroup|tag|mm_menu_frame|nvl|block|parallel)\b|\$/,
|
||||
|
||||
'keyword' : /\b(?:as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|yield|adjustment|alignaround|allow|angle|around|box_layout|cache|changed|child_size|clicked|clipping|corner1|corner2|default|delay|exclude|scope|slow|slow_abortable|slow_done|sound|style_group|substitute|suffix|transform_anchor|transpose|unhovered|config|theme|mm_root|gm_root|rounded_window|build|disabled_text|disabled|widget_selected|widget_text|widget_hover|widget|updater|behind|call|expression|hide|init|jump|onlayer|python|renpy|scene|set|show|transform|play|queue|stop|pause|define|window|repeat|contains|choice|on|function|event|animation|clockwise|counterclockwise|circles|knot|null|None|random|has|add|use|fade|dissolve|style|store|id|voice|center|left|right|less_rounded|music|movie|clear|persistent|ui)\b/,
|
||||
'keyword': /\b(?:as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|yield|adjustment|alignaround|allow|angle|around|box_layout|cache|changed|child_size|clicked|clipping|corner1|corner2|default|delay|exclude|scope|slow|slow_abortable|slow_done|sound|style_group|substitute|suffix|transform_anchor|transpose|unhovered|config|theme|mm_root|gm_root|rounded_window|build|disabled_text|disabled|widget_selected|widget_text|widget_hover|widget|updater|behind|call|expression|hide|init|jump|onlayer|python|renpy|scene|set|show|transform|play|queue|stop|pause|define|window|repeat|contains|choice|on|function|event|animation|clockwise|counterclockwise|circles|knot|null|None|random|has|add|use|fade|dissolve|style|store|id|voice|center|left|right|less_rounded|music|movie|clear|persistent|ui)\b/,
|
||||
|
||||
'boolean' : /\b(?:[Tt]rue|[Ff]alse)\b/,
|
||||
'boolean': /\b(?:[Tt]rue|[Ff]alse)\b/,
|
||||
|
||||
'number' : /(?:\b(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*(?:\.\d*)?)|\B\.\d+)(?:e[+-]?\d+)?j?/i,
|
||||
'number': /(?:\b(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*(?:\.\d*)?)|\B\.\d+)(?:e[+-]?\d+)?j?/i,
|
||||
|
||||
'operator' : /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not|with|at)\b/,
|
||||
'operator': /[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not|with|at)\b/,
|
||||
|
||||
'punctuation' : /[{}[\];(),.:]/
|
||||
'punctuation': /[{}[\];(),.:]/
|
||||
};
|
||||
|
||||
Prism.languages.rpy = Prism.languages.renpy;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
Prism.languages.sass = Prism.languages.extend('css', {
|
||||
// Sass comments don't need to be closed, only indented
|
||||
'comment': {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
Add support for {php}
|
||||
*/
|
||||
|
||||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
|
||||
Prism.languages.smarty = {
|
||||
'comment': /\{\*[\s\S]*?\*\}/,
|
||||
|
@ -56,7 +56,7 @@
|
|||
};
|
||||
|
||||
// Tokenize all inline Smarty expressions
|
||||
Prism.hooks.add('before-tokenize', function(env) {
|
||||
Prism.hooks.add('before-tokenize', function (env) {
|
||||
var smartyPattern = /\{\*[\s\S]*?\*\}|\{[\s\S]+?\}/g;
|
||||
var smartyLitteralStart = '{literal}';
|
||||
var smartyLitteralEnd = '{/literal}';
|
||||
|
@ -64,12 +64,12 @@
|
|||
|
||||
Prism.languages['markup-templating'].buildPlaceholders(env, 'smarty', smartyPattern, function (match) {
|
||||
// Smarty tags inside {literal} block are ignored
|
||||
if(match === smartyLitteralEnd) {
|
||||
if (match === smartyLitteralEnd) {
|
||||
smartyLitteralMode = false;
|
||||
}
|
||||
|
||||
if(!smartyLitteralMode) {
|
||||
if(match === smartyLitteralStart) {
|
||||
if (!smartyLitteralMode) {
|
||||
if (match === smartyLitteralStart) {
|
||||
smartyLitteralMode = true;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
|||
});
|
||||
|
||||
// Re-insert the tokens after tokenizing
|
||||
Prism.hooks.add('after-tokenize', function(env) {
|
||||
Prism.hooks.add('after-tokenize', function (env) {
|
||||
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'smarty');
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function (Prism){
|
||||
(function (Prism) {
|
||||
|
||||
var guid = {
|
||||
// https://en.wikipedia.org/wiki/Universally_unique_identifier#Format
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
|
||||
Prism.languages.tt2 = Prism.languages.extend('clike', {
|
||||
'comment': /#.*|\[%#[\s\S]*?%\]/,
|
||||
|
@ -41,12 +41,12 @@
|
|||
// The different types of TT2 strings "replace" the C-like standard string
|
||||
delete Prism.languages.tt2.string;
|
||||
|
||||
Prism.hooks.add('before-tokenize', function(env) {
|
||||
Prism.hooks.add('before-tokenize', function (env) {
|
||||
var tt2Pattern = /\[%[\s\S]+?%\]/g;
|
||||
Prism.languages['markup-templating'].buildPlaceholders(env, 'tt2', tt2Pattern);
|
||||
});
|
||||
|
||||
Prism.hooks.add('after-tokenize', function(env) {
|
||||
Prism.hooks.add('after-tokenize', function (env) {
|
||||
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'tt2');
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
|
||||
var keywords = /\b(?:ACT|ACTIFSUB|CARRAY|CASE|CLEARGIF|COA|COA_INT|CONSTANTS|CONTENT|CUR|EDITPANEL|EFFECT|EXT|FILE|FLUIDTEMPLATE|FORM|FRAME|FRAMESET|GIFBUILDER|GMENU|GMENU_FOLDOUT|GMENU_LAYERS|GP|HMENU|HRULER|HTML|IENV|IFSUB|IMAGE|IMGMENU|IMGMENUITEM|IMGTEXT|IMG_RESOURCE|INCLUDE_TYPOSCRIPT|JSMENU|JSMENUITEM|LLL|LOAD_REGISTER|NO|PAGE|RECORDS|RESTORE_REGISTER|TEMPLATE|TEXT|TMENU|TMENUITEM|TMENU_LAYERS|USER|USER_INT|_GIFBUILDER|global|globalString|globalVar)\b/;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
var interpolationExpr = {
|
||||
pattern: /[\s\S]+/,
|
||||
inside: null
|
||||
|
@ -44,7 +44,7 @@
|
|||
});
|
||||
|
||||
interpolationExpr.inside = Prism.languages.v;
|
||||
|
||||
|
||||
Prism.languages.insertBefore('v', 'operator', {
|
||||
'attribute': {
|
||||
pattern: /^\s*\[(?:deprecated|unsafe_fn|typedef|live|inline|flag|ref_only|windows_stdcall|direct_array_access)\]/m,
|
||||
|
@ -62,7 +62,7 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Prism.languages.insertBefore('v', 'function', {
|
||||
'generic-function': {
|
||||
// e.g. foo<T>( ...
|
||||
|
|
|
@ -41,7 +41,7 @@ Prism.languages.vala = Prism.languages.extend('clike', {
|
|||
'constant': /\b[A-Z0-9_]+\b/
|
||||
});
|
||||
|
||||
Prism.languages.insertBefore('vala','string', {
|
||||
Prism.languages.insertBefore('vala', 'string', {
|
||||
'raw-string': {
|
||||
pattern: /"""[\s\S]*?"""/,
|
||||
greedy: true,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(Prism) {
|
||||
(function (Prism) {
|
||||
Prism.languages.xeora = Prism.languages.extend('markup', {
|
||||
'constant': {
|
||||
pattern: /\$(?:DomainContents|PageRenderDuration)\$/,
|
||||
|
|
|
@ -69,7 +69,7 @@ var _self = (typeof window !== 'undefined')
|
|||
* @namespace
|
||||
* @public
|
||||
*/
|
||||
var Prism = (function (_self){
|
||||
var Prism = (function (_self) {
|
||||
|
||||
// Private helper vars
|
||||
var lang = /\blang(?:uage)?-([\w-]+)\b/i;
|
||||
|
@ -460,7 +460,7 @@ var _ = {
|
|||
root[inside] = ret;
|
||||
|
||||
// Update references in other language definitions
|
||||
_.languages.DFS(_.languages, function(key, value) {
|
||||
_.languages.DFS(_.languages, function (key, value) {
|
||||
if (value === old && key != inside) {
|
||||
this[key] = ret;
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ var _ = {
|
|||
* @memberof Prism
|
||||
* @public
|
||||
*/
|
||||
highlightAll: function(async, callback) {
|
||||
highlightAll: function (async, callback) {
|
||||
_.highlightAllUnder(document, async, callback);
|
||||
},
|
||||
|
||||
|
@ -527,7 +527,7 @@ var _ = {
|
|||
* @memberof Prism
|
||||
* @public
|
||||
*/
|
||||
highlightAllUnder: function(container, async, callback) {
|
||||
highlightAllUnder: function (container, async, callback) {
|
||||
var env = {
|
||||
callback: callback,
|
||||
container: container,
|
||||
|
@ -573,7 +573,7 @@ var _ = {
|
|||
* @memberof Prism
|
||||
* @public
|
||||
*/
|
||||
highlightElement: function(element, async, callback) {
|
||||
highlightElement: function (element, async, callback) {
|
||||
// Find language
|
||||
var language = _.util.getLanguage(element);
|
||||
var grammar = _.languages[language];
|
||||
|
@ -632,7 +632,7 @@ var _ = {
|
|||
if (async && _self.Worker) {
|
||||
var worker = new Worker(_.filename);
|
||||
|
||||
worker.onmessage = function(evt) {
|
||||
worker.onmessage = function (evt) {
|
||||
insertHighlightedCode(evt.data);
|
||||
};
|
||||
|
||||
|
@ -702,7 +702,7 @@ var _ = {
|
|||
* }
|
||||
* });
|
||||
*/
|
||||
tokenize: function(text, grammar) {
|
||||
tokenize: function (text, grammar) {
|
||||
var rest = grammar.rest;
|
||||
if (rest) {
|
||||
for (var token in rest) {
|
||||
|
@ -764,7 +764,7 @@ var _ = {
|
|||
return;
|
||||
}
|
||||
|
||||
for (var i=0, callback; (callback = callbacks[i++]);) {
|
||||
for (var i = 0, callback; (callback = callbacks[i++]);) {
|
||||
callback(env);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(){
|
||||
(function () {
|
||||
|
||||
if (typeof Prism === 'undefined') {
|
||||
return;
|
||||
|
@ -44,11 +44,11 @@ Prism.plugins.autolinker = {
|
|||
}
|
||||
};
|
||||
|
||||
Prism.hooks.add('before-highlight', function(env) {
|
||||
Prism.hooks.add('before-highlight', function (env) {
|
||||
Prism.plugins.autolinker.processGrammar(env.grammar);
|
||||
});
|
||||
|
||||
Prism.hooks.add('wrap', function(env) {
|
||||
Prism.hooks.add('wrap', function (env) {
|
||||
if (/-link$/.test(env.type)) {
|
||||
env.tag = 'a';
|
||||
|
||||
|
@ -69,7 +69,7 @@ Prism.hooks.add('wrap', function(env) {
|
|||
// Silently catch any error thrown by decodeURIComponent (#1186)
|
||||
try {
|
||||
env.content = decodeURIComponent(env.content);
|
||||
} catch(e) { /* noop */ }
|
||||
} catch (e) { /* noop */ }
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
/** @param {CopyInfo} copyInfo */
|
||||
function copyTextToClipboard(copyInfo) {
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(copyInfo.getText()).then(copyInfo.success, function() {
|
||||
navigator.clipboard.writeText(copyInfo.getText()).then(copyInfo.success, function () {
|
||||
// try the fallback in case `writeText` didn't work
|
||||
fallbackCopyTextToClipboard(copyInfo);
|
||||
});
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
(function(){
|
||||
(function () {
|
||||
|
||||
if (typeof Prism === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
Prism.hooks.add('wrap', function(env) {
|
||||
Prism.hooks.add('wrap', function (env) {
|
||||
if (env.type !== 'keyword') {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
var child = elt.childNodes[i];
|
||||
if (child.nodeType === 1) { // element
|
||||
f(child);
|
||||
} else if(child.nodeType === 3) { // text
|
||||
} else if (child.nodeType === 3) { // text
|
||||
pos += child.data.length;
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@
|
|||
});
|
||||
|
||||
Prism.hooks.add('after-highlight', function (env) {
|
||||
if(env.keepMarkup && env.keepMarkup.length) {
|
||||
if (env.keepMarkup && env.keepMarkup.length) {
|
||||
|
||||
var walk = function (elt, nodeState) {
|
||||
for (var i = 0, l = elt.childNodes.length; i < l; i++) {
|
||||
|
@ -59,12 +59,12 @@
|
|||
}
|
||||
|
||||
} else if (child.nodeType === 3) { // text
|
||||
if(!nodeState.nodeStart && nodeState.pos + child.data.length > nodeState.node.posOpen) {
|
||||
if (!nodeState.nodeStart && nodeState.pos + child.data.length > nodeState.node.posOpen) {
|
||||
// We found the start position
|
||||
nodeState.nodeStart = child;
|
||||
nodeState.nodeStartPos = nodeState.node.posOpen - nodeState.pos;
|
||||
}
|
||||
if(nodeState.nodeStart && nodeState.pos + child.data.length >= nodeState.node.posClose) {
|
||||
if (nodeState.nodeStart && nodeState.pos + child.data.length >= nodeState.node.posClose) {
|
||||
// We found the end position
|
||||
nodeState.nodeEnd = child;
|
||||
nodeState.nodeEndPos = nodeState.node.posClose - nodeState.pos;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function() {
|
||||
(function () {
|
||||
|
||||
if (typeof Prism === 'undefined' || typeof document === 'undefined') {
|
||||
return;
|
||||
|
@ -17,7 +17,7 @@ function NormalizeWhitespace(defaults) {
|
|||
}
|
||||
|
||||
function toCamelCase(value) {
|
||||
return value.replace(/-(\w)/g, function(match, firstChar) {
|
||||
return value.replace(/-(\w)/g, function (match, firstChar) {
|
||||
return firstChar.toUpperCase();
|
||||
});
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ NormalizeWhitespace.prototype = {
|
|||
if (!indents || !indents[0].length)
|
||||
return input;
|
||||
|
||||
indents.sort(function(a, b){return a.length - b.length; });
|
||||
indents.sort(function (a, b) { return a.length - b.length; });
|
||||
|
||||
if (!indents[0].length)
|
||||
return input;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function() {
|
||||
(function () {
|
||||
|
||||
if (typeof Prism === 'undefined' || typeof document === 'undefined' || !Function.prototype.bind) {
|
||||
return;
|
||||
|
@ -20,7 +20,7 @@
|
|||
* @param {string} func Gradient function name ("linear-gradient")
|
||||
* @param {string[]} values Array of the gradient function parameters (["0deg", "red 0%", "blue 100%"])
|
||||
*/
|
||||
var convertToW3CLinearGradient = function(prefix, func, values) {
|
||||
var convertToW3CLinearGradient = function (prefix, func, values) {
|
||||
// Default value for angle
|
||||
var angle = '180deg';
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
|||
* @param {string} func Gradient function name ("linear-gradient")
|
||||
* @param {string[]} values Array of the gradient function parameters (["0deg", "red 0%", "blue 100%"])
|
||||
*/
|
||||
var convertToW3CRadialGradient = function(prefix, func, values) {
|
||||
var convertToW3CRadialGradient = function (prefix, func, values) {
|
||||
if (values[0].indexOf('at') < 0) {
|
||||
// Looks like old syntax
|
||||
|
||||
|
@ -113,7 +113,7 @@
|
|||
*
|
||||
* @param {string} gradient The CSS gradient
|
||||
*/
|
||||
var convertToW3CGradient = function(gradient) {
|
||||
var convertToW3CGradient = function (gradient) {
|
||||
if (cache[gradient]) {
|
||||
return cache[gradient];
|
||||
}
|
||||
|
@ -134,7 +134,7 @@
|
|||
};
|
||||
|
||||
return function () {
|
||||
new Prism.plugins.Previewer('gradient', function(value) {
|
||||
new Prism.plugins.Previewer('gradient', function (value) {
|
||||
this.firstChild.style.backgroundImage = '';
|
||||
this.firstChild.style.backgroundImage = convertToW3CGradient(value);
|
||||
return !!this.firstChild.style.backgroundImage;
|
||||
|
@ -188,7 +188,7 @@
|
|||
},
|
||||
'angle': {
|
||||
create: function () {
|
||||
new Prism.plugins.Previewer('angle', function(value) {
|
||||
new Prism.plugins.Previewer('angle', function (value) {
|
||||
var num = parseFloat(value);
|
||||
var unit = value.match(/[a-z]+$/i);
|
||||
var max, percentage;
|
||||
|
@ -197,7 +197,7 @@
|
|||
}
|
||||
unit = unit[0];
|
||||
|
||||
switch(unit) {
|
||||
switch (unit) {
|
||||
case 'deg':
|
||||
max = 360;
|
||||
break;
|
||||
|
@ -211,10 +211,10 @@
|
|||
max = 1;
|
||||
}
|
||||
|
||||
percentage = 100 * num/max;
|
||||
percentage = 100 * num / max;
|
||||
percentage %= 100;
|
||||
|
||||
this[(num < 0? 'set' : 'remove') + 'Attribute']('data-negative', '');
|
||||
this[(num < 0 ? 'set' : 'remove') + 'Attribute']('data-negative', '');
|
||||
this.querySelector('circle').style.strokeDasharray = Math.abs(percentage) + ',500';
|
||||
return true;
|
||||
}, '*', function () {
|
||||
|
@ -267,7 +267,7 @@
|
|||
},
|
||||
'color': {
|
||||
create: function () {
|
||||
new Prism.plugins.Previewer('color', function(value) {
|
||||
new Prism.plugins.Previewer('color', function (value) {
|
||||
this.style.backgroundColor = '';
|
||||
this.style.backgroundColor = value;
|
||||
return !!this.style.backgroundColor;
|
||||
|
@ -325,13 +325,13 @@
|
|||
'ease': '.25,.1,.25,1',
|
||||
'ease-in': '.42,0,1,1',
|
||||
'ease-out': '0,0,.58,1',
|
||||
'ease-in-out':'.42,0,.58,1'
|
||||
'ease-in-out': '.42,0,.58,1'
|
||||
}[value] || value;
|
||||
|
||||
var p = value.match(/-?(?:\d+(?:\.\d+)?|\.\d+)/g);
|
||||
|
||||
if(p.length === 4) {
|
||||
p = p.map(function(p, i) { return (i % 2? 1 - p : p) * 100; });
|
||||
if (p.length === 4) {
|
||||
p = p.map(function (p, i) { return (i % 2 ? 1 - p : p) * 100; });
|
||||
|
||||
this.querySelector('path').setAttribute('d', 'M0,100 C' + p[0] + ',' + p[1] + ', ' + p[2] + ',' + p[3] + ', 100,0');
|
||||
|
||||
|
@ -403,7 +403,7 @@
|
|||
|
||||
'time': {
|
||||
create: function () {
|
||||
new Prism.plugins.Previewer('time', function(value) {
|
||||
new Prism.plugins.Previewer('time', function (value) {
|
||||
var num = parseFloat(value);
|
||||
var unit = value.match(/[a-z]+$/i);
|
||||
if (!num || !unit) {
|
||||
|
@ -539,7 +539,7 @@
|
|||
this._elt = document.createElement('div');
|
||||
this._elt.className = 'prism-previewer prism-previewer-' + this._type;
|
||||
document.body.appendChild(this._elt);
|
||||
if(this.initializer) {
|
||||
if (this.initializer) {
|
||||
this.initializer();
|
||||
}
|
||||
};
|
||||
|
@ -554,7 +554,7 @@
|
|||
var previewers = token.getAttribute('data-previewers');
|
||||
return (previewers || '').split(/\s+/).indexOf(this._type) === -1;
|
||||
}
|
||||
} while((token = token.parentNode));
|
||||
} while ((token = token.parentNode));
|
||||
return false;
|
||||
};
|
||||
|
||||
|
@ -571,7 +571,7 @@
|
|||
if (token.classList && token.classList.contains(TOKEN_CLASS) && token.classList.contains(this._type)) {
|
||||
break;
|
||||
}
|
||||
} while((token = token.parentNode));
|
||||
} while ((token = token.parentNode));
|
||||
|
||||
if (token && token !== this._token) {
|
||||
this._token = token;
|
||||
|
@ -582,7 +582,7 @@
|
|||
/**
|
||||
* Called on mouseout
|
||||
*/
|
||||
Previewer.prototype.mouseout = function() {
|
||||
Previewer.prototype.mouseout = function () {
|
||||
this._token.removeEventListener('mouseout', this._mouseout, false);
|
||||
this._token = null;
|
||||
this.hide();
|
||||
|
@ -691,7 +691,7 @@
|
|||
Prism.languages.insertBefore(inside, before, previewers[previewer].tokens, root);
|
||||
env.grammar = Prism.languages[lang];
|
||||
|
||||
languages[env.language] = {initialized: true};
|
||||
languages[env.language] = { initialized: true };
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -700,7 +700,7 @@
|
|||
|
||||
// Initialize the previewers only when needed
|
||||
Prism.hooks.add('after-highlight', function (env) {
|
||||
if(Previewer.byLanguages['*'] || Previewer.byLanguages[env.language]) {
|
||||
if (Previewer.byLanguages['*'] || Previewer.byLanguages[env.language]) {
|
||||
Previewer.initEvents(env.element, env.language);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function() {
|
||||
(function () {
|
||||
|
||||
if (typeof Prism === 'undefined' || typeof document === 'undefined') {
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(){
|
||||
(function () {
|
||||
|
||||
if (typeof Prism === 'undefined' || typeof document === 'undefined') {
|
||||
return;
|
||||
|
@ -6,7 +6,7 @@
|
|||
|
||||
var callbacks = [];
|
||||
var map = {};
|
||||
var noop = function() {};
|
||||
var noop = function () {};
|
||||
|
||||
Prism.plugins.toolbar = {};
|
||||
|
||||
|
@ -121,7 +121,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
elementCallbacks.forEach(function(callback) {
|
||||
elementCallbacks.forEach(function (callback) {
|
||||
var element = callback(env);
|
||||
|
||||
if (!element) {
|
||||
|
@ -139,7 +139,7 @@
|
|||
wrapper.appendChild(toolbar);
|
||||
};
|
||||
|
||||
registerButton('label', function(env) {
|
||||
registerButton('label', function (env) {
|
||||
var pre = env.element.parentNode;
|
||||
if (!pre || !/pre/i.test(pre.nodeName)) {
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(function(){
|
||||
(function () {
|
||||
|
||||
if (typeof Prism === 'undefined') {
|
||||
return;
|
||||
|
@ -25,8 +25,8 @@ if (Prism.languages.markup) {
|
|||
|
||||
var Tags = {
|
||||
HTML: {
|
||||
'a': 1, 'abbr': 1, 'acronym': 1, 'b': 1, 'basefont': 1, 'bdo': 1, 'big': 1, 'blink': 1, 'cite': 1, 'code': 1, 'dfn': 1, 'em': 1, 'kbd': 1, 'i': 1,
|
||||
'rp': 1, 'rt': 1, 'ruby': 1, 's': 1, 'samp': 1, 'small': 1, 'spacer': 1, 'strike': 1, 'strong': 1, 'sub': 1, 'sup': 1, 'time': 1, 'tt': 1, 'u': 1,
|
||||
'a': 1, 'abbr': 1, 'acronym': 1, 'b': 1, 'basefont': 1, 'bdo': 1, 'big': 1, 'blink': 1, 'cite': 1, 'code': 1, 'dfn': 1, 'em': 1, 'kbd': 1, 'i': 1,
|
||||
'rp': 1, 'rt': 1, 'ruby': 1, 's': 1, 'samp': 1, 'small': 1, 'spacer': 1, 'strike': 1, 'strong': 1, 'sub': 1, 'sup': 1, 'time': 1, 'tt': 1, 'u': 1,
|
||||
'var': 1, 'wbr': 1, 'noframes': 1, 'summary': 1, 'command': 1, 'dt': 1, 'dd': 1, 'figure': 1, 'figcaption': 1, 'center': 1, 'section': 1, 'nav': 1,
|
||||
'article': 1, 'aside': 1, 'hgroup': 1, 'header': 1, 'footer': 1, 'address': 1, 'noscript': 1, 'isIndex': 1, 'main': 1, 'mark': 1, 'marquee': 1,
|
||||
'meter': 1, 'menu': 1
|
||||
|
@ -46,12 +46,12 @@ if (Prism.languages.markup) {
|
|||
|
||||
var language;
|
||||
|
||||
Prism.hooks.add('wrap', function(env) {
|
||||
Prism.hooks.add('wrap', function (env) {
|
||||
if ((env.type == 'tag-id'
|
||||
|| (env.type == 'property' && env.content.indexOf('-') != 0)
|
||||
|| (env.type == 'rule'&& env.content.indexOf('@-') != 0)
|
||||
|| (env.type == 'pseudo-class'&& env.content.indexOf(':-') != 0)
|
||||
|| (env.type == 'pseudo-element'&& env.content.indexOf('::-') != 0)
|
||||
|| (env.type == 'rule' && env.content.indexOf('@-') != 0)
|
||||
|| (env.type == 'pseudo-class' && env.content.indexOf(':-') != 0)
|
||||
|| (env.type == 'pseudo-element' && env.content.indexOf('::-') != 0)
|
||||
|| (env.type == 'attr-name' && env.content.indexOf('data-') != 0)
|
||||
) && env.content.indexOf('<') === -1
|
||||
) {
|
||||
|
|
16
prism.js
16
prism.js
|
@ -21,7 +21,7 @@ var _self = (typeof window !== 'undefined')
|
|||
* @namespace
|
||||
* @public
|
||||
*/
|
||||
var Prism = (function (_self){
|
||||
var Prism = (function (_self) {
|
||||
|
||||
// Private helper vars
|
||||
var lang = /\blang(?:uage)?-([\w-]+)\b/i;
|
||||
|
@ -412,7 +412,7 @@ var _ = {
|
|||
root[inside] = ret;
|
||||
|
||||
// Update references in other language definitions
|
||||
_.languages.DFS(_.languages, function(key, value) {
|
||||
_.languages.DFS(_.languages, function (key, value) {
|
||||
if (value === old && key != inside) {
|
||||
this[key] = ret;
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ var _ = {
|
|||
* @memberof Prism
|
||||
* @public
|
||||
*/
|
||||
highlightAll: function(async, callback) {
|
||||
highlightAll: function (async, callback) {
|
||||
_.highlightAllUnder(document, async, callback);
|
||||
},
|
||||
|
||||
|
@ -479,7 +479,7 @@ var _ = {
|
|||
* @memberof Prism
|
||||
* @public
|
||||
*/
|
||||
highlightAllUnder: function(container, async, callback) {
|
||||
highlightAllUnder: function (container, async, callback) {
|
||||
var env = {
|
||||
callback: callback,
|
||||
container: container,
|
||||
|
@ -525,7 +525,7 @@ var _ = {
|
|||
* @memberof Prism
|
||||
* @public
|
||||
*/
|
||||
highlightElement: function(element, async, callback) {
|
||||
highlightElement: function (element, async, callback) {
|
||||
// Find language
|
||||
var language = _.util.getLanguage(element);
|
||||
var grammar = _.languages[language];
|
||||
|
@ -584,7 +584,7 @@ var _ = {
|
|||
if (async && _self.Worker) {
|
||||
var worker = new Worker(_.filename);
|
||||
|
||||
worker.onmessage = function(evt) {
|
||||
worker.onmessage = function (evt) {
|
||||
insertHighlightedCode(evt.data);
|
||||
};
|
||||
|
||||
|
@ -654,7 +654,7 @@ var _ = {
|
|||
* }
|
||||
* });
|
||||
*/
|
||||
tokenize: function(text, grammar) {
|
||||
tokenize: function (text, grammar) {
|
||||
var rest = grammar.rest;
|
||||
if (rest) {
|
||||
for (var token in rest) {
|
||||
|
@ -716,7 +716,7 @@ var _ = {
|
|||
return;
|
||||
}
|
||||
|
||||
for (var i=0, callback; (callback = callbacks[i++]);) {
|
||||
for (var i = 0, callback; (callback = callbacks[i++]);) {
|
||||
callback(env);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -564,7 +564,7 @@ function testPatterns(Prism) {
|
|||
case 'Self': {
|
||||
rangeOffset = report.parentQuant.start + 1;
|
||||
rangeStr = patternStr.substring(report.parentQuant.start + 1, report.parentQuant.end + 1);
|
||||
rangeHighlight = highlight([{...report.quant, label: 'self'}], -report.parentQuant.start);
|
||||
rangeHighlight = highlight([{ ...report.quant, label: 'self' }], -report.parentQuant.start);
|
||||
break;
|
||||
}
|
||||
case 'Move': {
|
||||
|
|
|
@ -16,7 +16,7 @@ require('../../../plugins/keep-markup/prism-keep-markup');
|
|||
|
||||
describe('Prism Keep Markup Plugin', function () {
|
||||
|
||||
function execute (code) {
|
||||
function execute(code) {
|
||||
const start = [];
|
||||
const end = [];
|
||||
const nodes = [];
|
||||
|
|
Loading…
Reference in New Issue