Commit 6dc08f3d613a992230e8bd6b61a9d4883791787c

Lea Verou 2012-07-12T17:18:48

Renamed html to markup, since it’s also about XML

diff --git a/components/prism-html.js b/components/prism-html.js
deleted file mode 100644
index a4cf8eb..0000000
--- a/components/prism-html.js
+++ /dev/null
@@ -1,64 +0,0 @@
-Prism.languages.html = {
-	'comment': /<!--[\w\W]*?--(>|>)/g,
-	'script': null,
-	'style': null,
-	'tag': {
-		pattern: /(&lt;|<)\/?[\w\W]+?(>|&gt;)/gi,
-		inside: {
-			'tag': {
-				pattern: /^(&lt;|<)\/?[\w:-]+/i,
-				inside: {
-					'punctuation': /^(&lt;|<)\/?/,
-					'namespace': /^[\w-]+?:/
-				}
-			},
-			'attr-value': {
-				pattern: /=(('|").*?(\2)|[^\s>]+)/gi,
-				inside: {
-					'punctuation': /=/g
-				}
-			},
-			'punctuation': /\/?&gt;|\/?>/g,
-			'attr-name': {
-				pattern: /[\w:-]+/g,
-				inside: {
-					'namespace': /^[\w-]+?:/
-				}
-			}
-			
-		}
-	},
-	'entity': /&amp;#?[\da-z]{1,8};/gi
-};
-
-if (Prism.languages.javascript) {
-	Prism.languages.html.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.html.tag.inside
-			},
-			rest: Prism.languages.javascript
-		}
-	};
-}
-else {
-	delete Prism.languages.html.script;
-}
-
-if (Prism.languages.css) {
-	Prism.languages.html.style = {
-		pattern: /(&lt;|<)style[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/style(>|&gt;)/ig,
-		inside: {
-			'tag': {
-				pattern: /(&lt;|<)style[\w\W]*?(>|&gt;)|(&lt;|<)\/style(>|&gt;)/ig,
-				inside: Prism.languages.html.tag.inside
-			},
-			rest: Prism.languages.css
-		}
-	};
-}
-else {
-	delete Prism.languages.html.style;
-}
\ No newline at end of file
diff --git a/components/prism-markup.js b/components/prism-markup.js
new file mode 100644
index 0000000..79aa4d2
--- /dev/null
+++ b/components/prism-markup.js
@@ -0,0 +1,64 @@
+Prism.languages.markup = {
+	'comment': /&lt;!--[\w\W]*?--(>|&gt;)/g,
+	'script': null,
+	'style': null,
+	'tag': {
+		pattern: /(&lt;|<)\/?[\w\W]+?(>|&gt;)/gi,
+		inside: {
+			'tag': {
+				pattern: /^(&lt;|<)\/?[\w:-]+/i,
+				inside: {
+					'punctuation': /^(&lt;|<)\/?/,
+					'namespace': /^[\w-]+?:/
+				}
+			},
+			'attr-value': {
+				pattern: /=(('|").*?(\2)|[^\s>]+)/gi,
+				inside: {
+					'punctuation': /=/g
+				}
+			},
+			'punctuation': /\/?&gt;|\/?>/g,
+			'attr-name': {
+				pattern: /[\w:-]+/g,
+				inside: {
+					'namespace': /^[\w-]+?:/
+				}
+			}
+			
+		}
+	},
+	'entity': /&amp;#?[\da-z]{1,8};/gi
+};
+
+if (Prism.languages.javascript) {
+	Prism.languages.markup.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
+		}
+	};
+}
+else {
+	delete Prism.languages.markup.script;
+}
+
+if (Prism.languages.css) {
+	Prism.languages.markup.style = {
+		pattern: /(&lt;|<)style[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/style(>|&gt;)/ig,
+		inside: {
+			'tag': {
+				pattern: /(&lt;|<)style[\w\W]*?(>|&gt;)|(&lt;|<)\/style(>|&gt;)/ig,
+				inside: Prism.languages.markup.tag.inside
+			},
+			rest: Prism.languages.css
+		}
+	};
+}
+else {
+	delete Prism.languages.markup.style;
+}
\ No newline at end of file
diff --git a/examples.html b/examples.html
index 2701fc4..f85d5f3 100644
--- a/examples.html
+++ b/examples.html
@@ -26,23 +26,23 @@
 </div></header>
 
 <section>
-	<h1>HTML/XML</h1>
+	<h1>Markup</h1>
 	
 	<h2>Empty tag</h2>
-	<pre class="prism"><code class="language-html">&lt;p>&lt;/p></code></pre>
+	<pre class="prism"><code class="language-markup">&lt;p>&lt;/p></code></pre>
 	
 	<h2>Name-attribute pair</h2>
-	<pre class="prism"><code class="language-html">&lt;p class="prism">&lt;/p></code></pre>
+	<pre class="prism"><code class="language-markup">&lt;p class="prism">&lt;/p></code></pre>
 	
 	<h2>Name-attribute pair without quotes</h2>
-	<pre class="prism"><code class="language-html">&lt;p class=prism>&lt;/p></code></pre>
+	<pre class="prism"><code class="language-markup">&lt;p class=prism>&lt;/p></code></pre>
 	
 	<h2>Attribute without value</h2>
-	<pre class="prism"><code class="language-html">&lt;p data-foo>&lt;/p></code></pre>
-	<pre class="prism"><code class="language-html">&lt;p data-foo >&lt;/p></code></pre>
+	<pre class="prism"><code class="language-markup">&lt;p data-foo>&lt;/p></code></pre>
+	<pre class="prism"><code class="language-markup">&lt;p data-foo >&lt;/p></code></pre>
 	
 	<h2>Namespaces</h2>
-	<pre class="prism"><code class="language-html">&lt;html:p foo:bar="baz" foo:weee>&lt;/html:p></code></pre>
+	<pre class="prism"><code class="language-markup">&lt;html:p foo:bar="baz" foo:weee>&lt;/html:p></code></pre>
 </pre>
 </section>
 
diff --git a/index.html b/index.html
index 18f0d13..743898a 100644
--- a/index.html
+++ b/index.html
@@ -70,20 +70,20 @@
 	<iframe src="style.css"></iframe>
 	
 	<p>And this page’s innerHTML, highlighted with Prism:</p>
-	<pre id="innerHTML" class="prism"><code class="language-html"></code></pre>
+	<pre id="innerHTML" class="prism"><code class="language-markup"></code></pre>
 </section>
 
 <section id="how-to-use">
 	<h1>How to use</h1>
 	
 	<p>You will need to include the <code>prism.css</code> and <code>prism.js</code> files you downloaded in your page. Include the CSS file by putting this code on your <code>&lt;head></code> element:
-	<pre class="prism"><code class="language-html">&lt;link href="prism.css" rel="stylesheet" /></code></pre>
+	<pre class="prism"><code class="language-markup">&lt;link href="prism.css" rel="stylesheet" /></code></pre>
 	
 	<p>To include the JavaScript file add this code somewhere in your HTML document, preferably at the bottom, right before the closing <code>&lt;/body></code> tag:
-	<pre class="prism"><code class="language-html">&lt;script src="prism.js">&lt;/script></code></pre>
+	<pre class="prism"><code class="language-markup">&lt;script src="prism.js">&lt;/script></code></pre>
 	
 	<p>Then, you need to add two CSS classes to any element you want to be automatically processed by Prism: <code>prism</code> and <code>language-xxxx</code> where <code>xxxx</code> is the language of the code. For example:
-	<pre class="prism"><code class="language-html">&lt;code class="prism language-css">* { margin: 0; }&lt;/code></code></pre>
+	<pre class="prism"><code class="language-markup">&lt;code class="prism language-css">* { margin: 0; }&lt;/code></code></pre>
 	
 	<p>If you are following the recommended way of presenting code blocks and using a <code>&lt;pre></code> with a <code>&lt;code></code> inside it, it’s recommended that you apply the <code>.prism</code> class to the <code>&lt;pre></code>.
 	The class name <code>language-xxxx</code> is actually the W3C recommended way to <a href="http://www.w3.org/TR/html5/the-code-element.html#the-code-element">declare code languages</a>.</p>
diff --git a/prism.js b/prism.js
index 9deba58..1d18a83 100644
--- a/prism.js
+++ b/prism.js
@@ -214,10 +214,10 @@ Prism.languages.javascript = {
 };
 
 /*********************************************** 
-     Begin prism-html.js 
+     Begin prism-markup.js 
 ***********************************************/ 
 
-Prism.languages.html = {
+Prism.languages.markup = {
 	'comment': /&lt;!--[\w\W]*?--(>|&gt;)/g,
 	'script': null,
 	'style': null,
@@ -251,33 +251,33 @@ Prism.languages.html = {
 };
 
 if (Prism.languages.javascript) {
-	Prism.languages.html.script = {
+	Prism.languages.markup.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.html.tag.inside
+				inside: Prism.languages.markup.tag.inside
 			},
 			rest: Prism.languages.javascript
 		}
 	};
 }
 else {
-	delete Prism.languages.html.script;
+	delete Prism.languages.markup.script;
 }
 
 if (Prism.languages.css) {
-	Prism.languages.html.style = {
+	Prism.languages.markup.style = {
 		pattern: /(&lt;|<)style[\w\W]*?(>|&gt;)[\w\W]*?(&lt;|<)\/style(>|&gt;)/ig,
 		inside: {
 			'tag': {
 				pattern: /(&lt;|<)style[\w\W]*?(>|&gt;)|(&lt;|<)\/style(>|&gt;)/ig,
-				inside: Prism.languages.html.tag.inside
+				inside: Prism.languages.markup.tag.inside
 			},
 			rest: Prism.languages.css
 		}
 	};
 }
 else {
-	delete Prism.languages.html.style;
+	delete Prism.languages.markup.style;
 }
\ No newline at end of file