Skip to content

Commit

Permalink
Fixed error reporting, isolated slide rendering method
Browse files Browse the repository at this point in the history
  • Loading branch information
jdan committed Oct 23, 2013
1 parent 4e2e93a commit 96fb8a5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
4 changes: 2 additions & 2 deletions examples/basic.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
title: Basic Example
author:
name: "Jordan Scales"
name: Jordan Scales
twitter: "@jdan"
url: "http://jordanscales.com"
url: http://jordanscales.com
output: basic.html

--
Expand Down
21 changes: 16 additions & 5 deletions lib/cleaver.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Cleaver.prototype.renderSlides = function () {
this.metadata = yaml.safeLoad(slices[0]) || {};

for (var i = 1; i < slices.length; i++)
this.slides.push(marked(slices[i]));
this.slides.push(this.renderSlide(slices[i]));

// insert an author slide (if necessary) at the end
if (this.metadata.author)
Expand Down Expand Up @@ -165,14 +165,25 @@ Cleaver.prototype.renderSlideshow = function () {
}


/**
* Renders a slide.
*
* @param {string} content Markdown content to be rendered as a slide
* @return {string} The formatted slide
*/
Cleaver.prototype.renderSlide = function (content) {
return marked(content);
}


/**
* Renders the author slide.
*
* @param {string} authorData The author field of the slideshow metadata
* @param {string} content The author field of the slideshow metadata
* @return {string} The formatted author slide
*/
Cleaver.prototype.renderAuthorSlide = function (authorData) {
return mustache.render(this.templates.loaded.author, authorData);
Cleaver.prototype.renderAuthorSlide = function (content) {
return mustache.render(this.templates.loaded.author, content);
}

/*
Expand Down Expand Up @@ -269,7 +280,7 @@ Cleaver.prototype.run = function () {
return Q.all([documentChain, assetChain])
.then(self.renderSlideshow.bind(self))
.fail(function (err) {
throw err;
console.log('!!', err.message);
});
}

Expand Down

0 comments on commit 96fb8a5

Please sign in to comment.