Skip to content

Commit

Permalink
Updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
emeryberger committed Aug 22, 2024
1 parent c73aa46 commit 11d79d9
Show file tree
Hide file tree
Showing 4 changed files with 266 additions and 154 deletions.
6 changes: 3 additions & 3 deletions example-profile.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const example_profile = {
elapsed_time_sec: 12.696948051452637,
memory: true,
memory: true,
files: {
"./test/testme.py": {
imports: [],
"./test/testme.py": {
imports: [],
functions: [
{
line: "doit1",
Expand Down
47 changes: 23 additions & 24 deletions prism.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ var _self =
typeof window !== "undefined"
? window // if in browser
: typeof WorkerGlobalScope !== "undefined" &&
self instanceof WorkerGlobalScope
? self // if in worker
: {}; // if in node js
self instanceof WorkerGlobalScope
? self // if in worker
: {}; // if in node js

/**
* Prism: Lightweight, robust, elegant syntax highlighting
Expand Down Expand Up @@ -169,12 +169,11 @@ var Prism = (function (_self) {
clone = [];
visited[id] = clone;

/** @type {Array} */ (/** @type {any} */ (o)).forEach(function (
v,
i
) {
clone[i] = deepClone(v, visited);
});
/** @type {Array} */ (/** @type {any} */ (o)).forEach(
function (v, i) {
clone[i] = deepClone(v, visited);
},
);

return /** @type {any} */ (clone);

Expand Down Expand Up @@ -535,7 +534,7 @@ var Prism = (function (_self) {
_.hooks.run("before-highlightall", env);

env.elements = Array.prototype.slice.apply(
env.container.querySelectorAll(env.selector)
env.container.querySelectorAll(env.selector),
);

_.hooks.run("before-all-elements-highlight", env);
Expand Down Expand Up @@ -645,7 +644,7 @@ var Prism = (function (_self) {
language: env.language,
code: env.code,
immediateClose: true,
})
}),
);
} else {
insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
Expand Down Expand Up @@ -952,7 +951,7 @@ var Prism = (function (_self) {
grammar,
startNode,
startPos,
rematch
rematch,
) {
for (var token in grammar) {
if (!grammar.hasOwnProperty(token) || !grammar[token]) {
Expand Down Expand Up @@ -1076,7 +1075,7 @@ var Prism = (function (_self) {
token,
inside ? _.tokenize(matchStr, inside) : matchStr,
alias,
matchStr
matchStr,
);
currentNode = addAfter(tokenList, removeFrom, wrapped);

Expand All @@ -1099,7 +1098,7 @@ var Prism = (function (_self) {
grammar,
currentNode.prev,
pos,
nestedRematch
nestedRematch,
);

// the reach might have been extended because of the rematching
Expand Down Expand Up @@ -1212,7 +1211,7 @@ var Prism = (function (_self) {
_self.close();
}
},
false
false,
);
}

Expand Down Expand Up @@ -1250,7 +1249,7 @@ var Prism = (function (_self) {
) {
document.addEventListener(
"DOMContentLoaded",
highlightAutomaticallyCallback
highlightAutomaticallyCallback,
);
} else {
if (window.requestAnimationFrame) {
Expand Down Expand Up @@ -1449,9 +1448,9 @@ Object.defineProperty(Prism.languages.markup.tag, "addInlined", {
/__/g,
function () {
return tagName;
}
},
),
"i"
"i",
),
lookbehind: true,
greedy: true,
Expand Down Expand Up @@ -1481,7 +1480,7 @@ Object.defineProperty(Prism.languages.markup.tag, "addAttribute", {
attrName +
")" +
/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
"i"
"i",
),
lookbehind: true,
inside: {
Expand Down Expand Up @@ -1549,7 +1548,7 @@ Prism.languages.rss = Prism.languages.xml;
"|" +
/(?:[^\\\r\n()"']|\\[\s\S])*/.source +
")\\)",
"i"
"i",
),
greedy: true,
inside: {
Expand All @@ -1565,7 +1564,7 @@ Prism.languages.rss = Prism.languages.xml;
pattern: RegExp(
"(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|" +
string.source +
")*(?=\\s*\\{)"
")*(?=\\s*\\{)",
),
lookbehind: true,
},
Expand Down Expand Up @@ -1675,7 +1674,7 @@ Prism.languages.javascript = Prism.languages.extend("clike", {
/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/
.source) +
")" +
/(?![\w$])/.source
/(?![\w$])/.source,
),
lookbehind: true,
},
Expand Down Expand Up @@ -1795,7 +1794,7 @@ if (Prism.languages.markup) {
Prism.languages.markup.tag.addAttribute(
/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/
.source,
"javascript"
"javascript",
);
}

Expand Down Expand Up @@ -1976,7 +1975,7 @@ Prism.languages.py = Prism.languages.python;
indent: function (input, tabs) {
return input.replace(
/^[^\S\n\r]*(?=\S)/gm,
new Array(++tabs).join("\t") + "$&"
new Array(++tabs).join("\t") + "$&",
);
},
breakLines: function (input, characters) {
Expand Down
Loading

0 comments on commit 11d79d9

Please sign in to comment.