com web/pres2: Add code class support: pres2reveal

[email protected] (Rasmus Lerdorf)
Newsgroups php.pres
Message-ID <[email protected]>
Commit:    1ccda1ef00fb9655ef2938b0237ec06b54380223
Author:    Rasmus Lerdorf <[email protected]>         Tue, 23 Sep 2014 21:14:03 -0700
Parents:   947beb7f513869698f5adac50e47c16f9392dad1
Branches:  master

Link:       http://git.php.net/?p=web/pres2.git;a=commitdiff;h=1ccda1ef00fb9655ef2938b0237ec06b54380223

Log:
Add code class support

Changed paths:
  M  pres2reveal


Diff:
diff --git a/pres2reveal b/pres2reveal
index d55ab09..e175321 100755
--- a/pres2reveal
+++ b/pres2reveal
@@ -144,7 +144,9 @@ function render_example($e) {
 		$code = trim(substr($code,5));
 	}
 	$code = htmlspecialchars($code);
-	if(empty($e['hide'])) $ret .= "\t\t<pre><code>$code</code></pre>\n";
+	$class = ''; 
+	if(!empty($e['type'])) $class = ' class="'.$e['type'].'"';
+	if(empty($e['hide'])) $ret .= "\t\t<pre><code$class>$code</code></pre>\n";
 	if(!empty($e['result'])) {
 		$ret .= "\t\t<pre><code>";
 		ob_start();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.