Skip to content

Commit

Permalink
Introduce title option
Browse files Browse the repository at this point in the history
  • Loading branch information
chikathreesix committed Dec 31, 2014
1 parent 9fc65b7 commit 19af835
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,18 @@ align: middle

## Options

### title
Type: `string`

Title for the slide HTML. Only available in global option.

### layout
Type: `string`

Default: `default`

Name of layout file in `layouts` directory. The file name will be `layouts/layout.html.erb`. Only available in global option.

### backgroundColor
Type: `string`

Expand All @@ -110,12 +122,6 @@ Type: `string`

Spefies the type of the slide. Can be `title`.

### layout
Type: `string`
Default: `default`

Name of layout file in `layouts` directory. The file name will be `layouts/layout.html.erb`. Only available in global option.


## Development

Expand Down
5 changes: 4 additions & 1 deletion build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.2/styles/default.min.css">
<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.2/highlight.min.js"></script>

<title>Harmonide - HTML slide for JS Hackers</title>

</head>
<body>
<div id="presentation" class="slide_container">
Expand All @@ -14,7 +17,7 @@
<div class="slide">
<div class="slide_content">
<h1 id="harmonide">Harmonide</h1>
<h2 id="slideshows-for-js-hackers">Slideshows for JS hackers</h2>
<h2 id="html-slide-for-js-hackers">HTML slide for JS hackers</h2>
<p><iframe src="http://ghbtns.com/github-btn.html?user=chikathreesix&repo=harmonide&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="80" height="20" style="display: inline-block"></iframe>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://harmonide.com" data-text="HTML slide for JS Hackers" data-via="chikathreesix">Tweet</a></p>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
Expand Down
4 changes: 3 additions & 1 deletion drafts/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
title: Harmonide - HTML slide for JS Hackers

-----
align: middle
type: title
-----

# Harmonide
## Slideshows for JS hackers
## HTML slide for JS hackers

<iframe src="http://ghbtns.com/github-btn.html?user=chikathreesix&repo=harmonide&type=watch&count=true" allowtransparency="true" frameborder="0" scrolling="0" width="80" height="20" style="display: inline-block"></iframe>
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://harmonide.com" data-text="HTML slide for JS Hackers" data-via="chikathreesix">Tweet</a>
Expand Down
3 changes: 3 additions & 0 deletions layouts/default.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.2/styles/default.min.css">
<script src="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.2/highlight.min.js"></script>
<% if(title){ %>
<title><%= title %></title>
<% } %>
</head>
<body>
<div id="presentation" class="slide_container">
Expand Down
3 changes: 2 additions & 1 deletion lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ HarmonideParser.prototype = {
}

var layoutName = this._globalOption.layout || 'default';
var title = this._globalOption.title;
var template = fs.readFileSync(path.resolve(rootDir, 'layouts/' + layoutName + '.html.ejs'), 'utf8');
var buildFilename = 'build/' + path.basename(this._fileName).replace('.md', '.html');

fs.writeFileSync(buildFilename, ejs.render(template, {slides: this._slides}));
fs.writeFileSync(buildFilename, ejs.render(template, {title: title, slides: this._slides}));

console.log('build completed: "' + buildFilename + '"');
},
Expand Down

0 comments on commit 19af835

Please sign in to comment.