Commit e95a85c02ed270347cce34079eaeaaa57b91e8d1

Lea Verou 2012-07-31T16:17:53

Merged the comment and line-comment tokens

diff --git a/components/prism-javascript.js b/components/prism-javascript.js
index 79ed187..f33fd11 100644
--- a/components/prism-javascript.js
+++ b/components/prism-javascript.js
@@ -1,7 +1,6 @@
 Prism.languages.javascript = {
-	'comment': /\/\*[\w\W]*?\*\//g,
-	'line-comment': {
-		pattern: /(^|[^\\])\/\/.*?(\r?\n|$)/g,
+	'comment': {
+		pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,
 		lookbehind: true
 	},
 	'string': /("|')(\\?.)*?\1/g,
diff --git a/components/prism-javascript.min.js b/components/prism-javascript.min.js
index 1d1f569..1e6ea08 100644
--- a/components/prism-javascript.min.js
+++ b/components/prism-javascript.min.js
@@ -1 +1 @@
-Prism.languages.javascript={comment:/\/\*[\w\W]*?\*\//g,"line-comment":{pattern:/(^|[^\\])\/\/.*?(\r?\n|$)/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0},keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,number:/\b-?(0x)?\d*\.?\d+\b/g,operator:/[-+]{1,2}|!|=?&lt;|=?&gt;|={1,2}|(&amp;){1,2}|\|?\||\?|\*|\//g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(&lt;|<)script[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/script(>|&gt;)/ig,inside:{tag:{pattern:/(&lt;|<)script[\w\W]*?(>|&gt;)|(&lt;|<)\/script(>|&gt;)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});
\ No newline at end of file
+Prism.languages.javascript={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0},keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,number:/\b-?(0x)?\d*\.?\d+\b/g,operator:/[-+]{1,2}|!|=?&lt;|=?&gt;|={1,2}|(&amp;){1,2}|\|?\||\?|\*|\//g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(&lt;|<)script[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/script(>|&gt;)/ig,inside:{tag:{pattern:/(&lt;|<)script[\w\W]*?(>|&gt;)|(&lt;|<)\/script(>|&gt;)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});
\ No newline at end of file
diff --git a/extending.html b/extending.html
index d1e0ce8..f68f069 100644
--- a/extending.html
+++ b/extending.html
@@ -42,7 +42,7 @@
 		<dt>lookbehind</dt>
 		<dd>This option mitigates JavaScript’s lack of lookbehind. When set to <code>true</code>, 
 		the first capturing group in the regex <code>pattern</code> is discarded when matching this token, so it effectively behaves 
-		as if it was lookbehind. For an example of this, check out the JavaScript language definition, in particular the regex and line-comment tokens:
+		as if it was lookbehind. For an example of this, check out the JavaScript language definition, in particular the regex and comment tokens:
 		<pre data-src="components/prism-javascript.js"></pre></dd>
 		
 		<dt>rest</dt>
diff --git a/plugins/index.html b/plugins/index.html
new file mode 100644
index 0000000..9d65944
--- /dev/null
+++ b/plugins/index.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+
+<meta charset="utf-8" />
+<title>Plugins ▲ Prism</title>
+<base href=".." />
+<link rel="stylesheet" href="style.css" />
+<link rel="stylesheet" href="prism.css" data-noprefix />
+<link rel="stylesheet" href="plugins/line-highlight/prism-line-highlight.css" data-noprefix />
+<script src="../prefixfree/prefixfree.min.js"></script>
+
+</head>
+<body>
+
+<header>
+	<div class="intro" data-src="templates/header-plugins.html" data-type="text/html"></div>
+</header>
+
+<section>
+	<h1>Available plugins</h1>
+	<ul class="plugin-list"></ul>
+</section>
+
+<section>
+	<h1>Contribute</h1>
+	<p>Writing Prism plugins is easy! Read how at the “<a href="extending.html#writing-plugins">Extending Prism</a>” section.
+</section>
+
+<footer data-src="templates/footer.html" data-type="text/html"></footer>
+
+<script src="prism.js"></script>
+<script src="plugins/line-highlight/prism-line-highlight.js"></script>
+<script src="utopia.js"></script>
+<script src="code.js"></script>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/prism-dark.css b/prism-dark.css
index 7a8854d..d8869db 100644
--- a/prism-dark.css
+++ b/prism-dark.css
@@ -49,7 +49,6 @@ pre[class*="language-"] {
 }
 
 .token.comment,
-.token.line-comment,
 .token.prolog,
 .token.doctype,
 .token.cdata {
diff --git a/prism-funky.css b/prism-funky.css
index 693d663..259c382 100644
--- a/prism-funky.css
+++ b/prism-funky.css
@@ -46,7 +46,6 @@ code[class*="language-"] {
 }
 
 .token.comment,
-.token.line-comment,
 .token.prolog,
 .token.doctype,
 .token.cdata {
diff --git a/prism.css b/prism.css
index fb0e356..6ff9b19 100644
--- a/prism.css
+++ b/prism.css
@@ -44,7 +44,6 @@ pre[class*="language-"] {
 }
 
 .token.comment,
-.token.line-comment,
 .token.prolog,
 .token.doctype,
 .token.cdata {
diff --git a/prism.js b/prism.js
index 74bc30f..a2e62f7 100644
--- a/prism.js
+++ b/prism.js
@@ -386,9 +386,8 @@ if (Prism.languages.markup) {
 ***********************************************/ 
 
 Prism.languages.javascript = {
-	'comment': /\/\*[\w\W]*?\*\//g,
-	'line-comment': {
-		pattern: /(^|[^\\])\/\/.*?(\r?\n|$)/g,
+	'comment': {
+		pattern: /(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,
 		lookbehind: true
 	},
 	'string': /("|')(\\?.)*?\1/g,