@@ -19,7 +19,6 @@ function Cleaver(file) {
1919 this . templates = {
2020 layout : 'templates/layout.mustache' ,
2121 author : 'templates/author.mustache' ,
22- agenda : 'templates/agenda.mustache' ,
2322 slides : 'templates/default.mustache'
2423 } ;
2524
@@ -67,10 +66,16 @@ Cleaver.prototype.loadDocument = function () {
6766Cleaver . prototype . renderSlides = function ( ) {
6867 var self = this ;
6968 var slices = this . slice ( self . external . loaded . document ) ;
69+ var i ;
70+
7071 this . metadata = yaml . safeLoad ( slices [ 0 ] ) || { } ;
7172
72- for ( var i = 1 ; i < slices . length ; i ++ ) {
73- this . slides . push ( this . renderSlide ( slices [ i ] ) ) ;
73+ for ( i = 1 ; i < slices . length ; i ++ ) {
74+ this . slides . push ( {
75+ id : i ,
76+ hidden : i !== 1 , // first slide is visible
77+ content : this . renderSlide ( slices [ i ] )
78+ } ) ;
7479 }
7580
7681 // insert an author slide (if necessary) at the end
@@ -79,12 +84,12 @@ Cleaver.prototype.renderSlides = function () {
7984 ! this . metadata . author . twitter . match ( / ^ @ / ) ) {
8085 this . metadata . author . twitter = '@' + this . metadata . author . twitter ;
8186 }
82- this . slides . push ( this . renderAuthorSlide ( this . metadata . author ) ) ;
83- }
8487
85- // insert an agenda slide (if necessary) as our second slide
86- if ( this . metadata . agenda ) {
87- this . slides . splice ( 1 , 0 , this . renderAgendaSlide ( slices ) ) ;
88+ this . slides . push ( {
89+ id : i ,
90+ hidden : true ,
91+ content : this . renderAuthorSlide ( this . metadata . author )
92+ } ) ;
8893 }
8994
9095 return Q . resolve ( true ) ;
@@ -223,35 +228,6 @@ Cleaver.prototype.renderAuthorSlide = function (content) {
223228} ;
224229
225230
226- /**
227- * Renders the agenda slide.
228- *
229- * @param {string } slices The set of slices that had been loaded from the input file
230- * @return {string } The formatted agenda slide
231- */
232- Cleaver . prototype . renderAgendaSlide = function ( slices ) {
233- var titles = [ ] ;
234- var firstLine , lastTitle , matches ;
235-
236- for ( var i = 1 ; i < slices . length ; i ++ ) {
237- firstLine = slices [ i ] . split ( / ( \n | \r ) + / ) [ 0 ] ;
238- matches = / ^ ( # { 3 , } ) \s + ( .+ ) $ / . exec ( firstLine ) ;
239-
240- // Only index non-title slides (begins with 3 ###)
241- if ( ! matches ) {
242- continue ;
243- }
244-
245- if ( lastTitle !== matches [ 2 ] ) {
246- lastTitle = matches [ 2 ] ;
247- titles . push ( lastTitle ) ;
248- }
249- }
250-
251- return mustache . render ( this . templates . loaded . agenda , titles ) ;
252- } ;
253-
254-
255231/**
256232 * Returns a chopped up document that's easy to parse.
257233 *
0 commit comments