com web/pres2: Support for line numbers in example code: pres2reveal reveal.js reveal_template.php
| From: | Rasmus Lerdorf | Date: | Wed, 08 Feb 2017 07:21:47 +0000 |
| Subject: | com web/pres2: Support for line numbers in example code: pres2reveal reveal.js reveal_template.php | ||
| Groups: | php.pres | ||
| Request: | Send a blank email to pres+get-2217@lists.php.net to get a copy of this message | ||
Commit: f1139644a4cfd7bbfaafb7675a3c01945458951a
Author: Rasmus Lerdorf <rasmus@php.net> Tue, 7 Feb 2017 23:21:47 -0800
Parents: 0a5c1d0a661a2fcb99babcd9c056ee7cde50221b
Branches: master
Link: http://git.php.net/?p=web/pres2.git;a=commitdiff;h=f1139644a4cfd7bbfaafb7675a3c01945458951a
Log:
Support for line numbers in example code
Changed paths:
M pres2reveal
M reveal.js
M reveal_template.php
Diff:
diff --git a/pres2reveal b/pres2reveal
index 0cc6d6d..12cf41c 100755
--- a/pres2reveal
+++ b/pres2reveal
@@ -127,6 +127,7 @@ function render_blurb($e) {
}
if(!empty($e['align'])) $style .=
'text-align:'.$e['align'].';';
+ if(!empty($e['style'])) $style .= $e['style'];
if(!empty($style)) $style = " style=\"$style\"";
$text = markup_text((string)$e);
@@ -172,18 +173,19 @@ function render_list($e) {
}
function render_example($e) {
- $ret = $style = '';
+ $ret = $extra = $style = '';
if(!empty($e['title'])) $ret .= '<p
class="example">'.markup_text($e['title'])."</p>\n";
if(!empty($e['fontsize'])) $style = '
style="font-size:'.$e['fontsize'].';"';
$code = trim((string)$e);
$orig_code = $code;
- if(substr($code,0,5)=="<?php") {
+ if(empty($e['nostrip']) && substr($code,0,5)=="<?php") {
$code = trim(substr($code,5));
}
$code = htmlspecialchars($code);
$class = '';
if(!empty($e['type'])) $class = '
class="'.$e['type'].'"';
- if(empty($e['hide'])) $ret .= "\t\t<pre><code$class
data-trim$style>$code</code></pre>\n";
+ if(!empty($e['extra'])) $extra = $e['extra'];
+ if(empty($e['hide'])) $ret .= "\t\t<pre><code$class data-trim$style
$extra>$code</code></pre>\n";
if(!empty($e['result'])) {
$ret .= "\t\t<pre class=\"output\"$style>";
ob_start();
diff --git a/reveal.js b/reveal.js
index 539e774..1413cbc 160000
--- a/reveal.js
+++ b/reveal.js
@@ -1 +1 @@
-Subproject commit 539e774d31f91676bcc3f75e28168921cd27d819
+Subproject commit 1413cbc1a9344a6366c30fb0e83d5b6afc18f6d3
diff --git a/reveal_template.php b/reveal_template.php
index 8ff3340..f2f9851 100644
--- a/reveal_template.php
+++ b/reveal_template.php
@@ -122,7 +122,7 @@
<small><a href="http://twitter.com/<?=$twitter?>"><?=$twitter?></a></small>
</p>
<aside class="notes">
- <?=nl2br(trim($notes))?>
+ <?php if(!empty($notes)) echo nl2br(trim($notes)); ?>
</aside>
</section>
<?=$slides?>
@@ -151,7 +151,8 @@
{ src: '/reveal.js/lib/js/classList.js', condition: function() { return
!document.body.classList; } },
{ src: '/highlight.min.js', async: true, condition: function() { return
!!document.querySelector( 'pre code' ); }, callback: function() {
hljs.initHighlightingOnLoad(); } },
{ src: '/reveal.js/plugin/zoom-js/zoom.js', async: true },
- { src: '/reveal.js/plugin/notes/notes.js', async: true }
+ { src: '/reveal.js/plugin/notes/notes.js', async: true },
+ { src: '/reveal.js/plugin/line-numbers/line-numbers.js' }
]
});
/* This draws the graph on the slide on a slidechanged event */