Commit 298dca59d2aaaf32fd12dc043c27ab2c015a499a

Chris Wells 2015-12-29T19:36:08

Remove the need for an "output" class.

diff --git a/plugins/command-line/prism-command-line.css b/plugins/command-line/prism-command-line.css
index 60ab996..153a870 100644
--- a/plugins/command-line/prism-command-line.css
+++ b/plugins/command-line/prism-command-line.css
@@ -15,11 +15,15 @@
 
 .command-line-prompt > span:before {
 	color: #999;
-	content: "[" attr(data-user) "@" attr(data-host) "] $";
+	content: ' ';
 	display: block;
 	padding-right: 0.8em;
 }
 
+.command-line-prompt > span[data-user]:before {
+	content: "[" attr(data-user) "@" attr(data-host) "] $";
+}
+
 .command-line-prompt > span[data-user="root"]:before {
 	content: "[" attr(data-user) "@" attr(data-host) "] #";
 }
@@ -27,7 +31,3 @@
 .command-line-prompt > span[data-prompt]:before {
 	content: attr(data-prompt);
 }
-
-.command-line-prompt > span.output:before {
-	content: ' ';
-}
diff --git a/plugins/command-line/prism-command-line.js b/plugins/command-line/prism-command-line.js
index cadc706..9799061 100644
--- a/plugins/command-line/prism-command-line.js
+++ b/plugins/command-line/prism-command-line.js
@@ -63,7 +63,10 @@ Prism.hooks.add('complete', function (env) {
 
 		if (!isNaN(outputStart) && !isNaN(outputEnd)) {
 			for (var j = outputStart; j <= outputEnd && j <= prompt.children.length; j++) {
-				prompt.children[j - 1].className = 'output';
+				var node = prompt.children[j - 1];
+				node.removeAttribute('data-user');
+				node.removeAttribute('data-host');
+				node.removeAttribute('data-prompt');
 			}
 		}
 	}
diff --git a/plugins/command-line/prism-command-line.min.js b/plugins/command-line/prism-command-line.min.js
index b7ec8c6..23c6bea 100644
--- a/plugins/command-line/prism-command-line.min.js
+++ b/plugins/command-line/prism-command-line.min.js
@@ -1 +1 @@
-!function(){"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("complete",function(e){if(e.code){var t=e.element.parentNode,a=/\s*\bcommand-line\b\s*/;if(t&&/pre/i.test(t.nodeName)&&(a.test(t.className)||a.test(e.element.className))&&!e.element.querySelector(".command-line-prompt")){a.test(e.element.className)&&(e.element.className=e.element.className.replace(a,"")),a.test(t.className)||(t.className+=" command-line");var n=new Array(1+e.code.split("\n").length),s=t.getAttribute("data-prompt")||"";if(""!==s)n=n.join('<span data-prompt="'+s+'"></span>');else{var l=t.getAttribute("data-user")||"user",r=t.getAttribute("data-host")||"localhost";n=n.join('<span data-user="'+l+'" data-host="'+r+'"></span>')}var m=document.createElement("span");m.className="command-line-prompt",m.innerHTML=n;var o=t.getAttribute("data-output")||"";o=o.split(",");for(var i=0;i<o.length;i++){var c=o[i].split("-"),p=parseInt(c[0]),d=p;if(2===c.length&&(d=parseInt(c[1])),!isNaN(p)&&!isNaN(d))for(var u=p;d>=u&&u<=m.children.length;u++)m.children[u-1].className="output"}e.element.innerHTML=m.outerHTML+e.element.innerHTML}}})}();
\ No newline at end of file
+!function(){"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("complete",function(e){if(e.code){var t=e.element.parentNode,a=/\s*\bcommand-line\b\s*/;if(t&&/pre/i.test(t.nodeName)&&(a.test(t.className)||a.test(e.element.className))&&!e.element.querySelector(".command-line-prompt")){a.test(e.element.className)&&(e.element.className=e.element.className.replace(a,"")),a.test(t.className)||(t.className+=" command-line");var n=new Array(1+e.code.split("\n").length),s=t.getAttribute("data-prompt")||"";if(""!==s)n=n.join('<span data-prompt="'+s+'"></span>');else{var r=t.getAttribute("data-user")||"user",l=t.getAttribute("data-host")||"localhost";n=n.join('<span data-user="'+r+'" data-host="'+l+'"></span>')}var m=document.createElement("span");m.className="command-line-prompt",m.innerHTML=n;var o=t.getAttribute("data-output")||"";o=o.split(",");for(var i=0;i<o.length;i++){var d=o[i].split("-"),p=parseInt(d[0]),c=p;if(2===d.length&&(c=parseInt(d[1])),!isNaN(p)&&!isNaN(c))for(var u=p;c>=u&&u<=m.children.length;u++){var N=m.children[u-1];N.removeAttribute("data-user"),N.removeAttribute("data-host"),N.removeAttribute("data-prompt")}}e.element.innerHTML=m.outerHTML+e.element.innerHTML}}})}();
\ No newline at end of file