Skip to content

Commit 4061211

Browse files
committed
Merge pull request #72 from jdan/full-bleed
New (full-bleed) slide markup and styling improvements
2 parents 57f469f + 14e2548 commit 4061211

File tree

9 files changed

+141
-189
lines changed

9 files changed

+141
-189
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,43 @@ Template files will automatically override the default templates.
161161
For more information on themes, check out
162162
[our documentation](https://github.com/jdan/cleaver/blob/master/docs/themes.md).
163163

164+
## Markup
165+
166+
Cleaver slides are rendered using the following template:
167+
168+
```handlebars
169+
{{#slides}}
170+
<div class="slide{{#hidden}} hidden{{/hidden}}" id="slide-{{id}}">
171+
<section class="slide-content">{{{content}}}</section>
172+
</div>
173+
{{/slides}}
174+
```
175+
176+
And produce the following markup:
177+
178+
```
179+
+-------------------------------+
180+
| #slide-N |
181+
| +-------------------+ |
182+
| | .slide-content | |
183+
| | | |
184+
| | | |
185+
| | | |
186+
| | | |
187+
| +-------------------+ |
188+
| |
189+
| |
190+
| (navigation) |
191+
+-------------------------------+
192+
```
193+
194+
**#slide-N** (for example, *#slide-3*) allows you to identify a particular
195+
full-bleed slide by its position in the slideshow. It extends to the bounds of
196+
the page.
197+
198+
**.slide-content** is a smaller window which holds the actual content of the
199+
slide.
200+
164201
## Slide Types
165202

166203
### Title slide

docs/options.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,6 @@ Displays a small progress bar at the top of your document.
7777

7878
**Default**: true
7979

80-
### agenda
81-
82-
Inserts an agenda (table of contents) slide at the beginning of your
83-
presentation, based on the titles of your individual slides.
84-
85-
**Default**: false
86-
8780
### encoding
8881

8982
Content encoding to use on the rendered document.

examples/basic.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ Content can be written in **Markdown!** New lines no longer need two angle brack
1818

1919
This will be in a separate paragraph.
2020

21-
<img src="http://whatismarkdown.com/workspace/img/logo.gif" alt="Drawing" style="width: 150px;"/>
22-
23-
![markdown-logo](logo.gif)
24-
<img src="logo.gif" />
21+
<img src="https://github.global.ssl.fastly.net/images/modules/logos_page/GitHub-Logo.png" width="50%">
2522

2623
[Here's a link](http://google.com).
2724

lib/cleaver.js

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -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 () {
6766
Cleaver.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
*

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cleaver",
33
"preferGlobal": true,
4-
"version": "0.5.5",
4+
"version": "0.6.0",
55
"author": "Jordan Scales <scalesjordan@gmail.com>",
66
"description": "30-second slideshows for hackers",
77
"keywords": [

resources/default.css

Lines changed: 49 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@ body {
55
font-size: 100%;
66
}
77

8-
#wrapper {
9-
width: 850px;
8+
.slide {
9+
position: absolute;
10+
top: 0; bottom: 0;
11+
left: 0; right: 0;
12+
}
13+
14+
.slide-content {
15+
width: 800px;
1016
height: 600px;
1117
overflow: hidden;
1218
margin: 80px auto 0 auto;
13-
}
14-
15-
.slide {
16-
width: auto;
17-
height: 540px;
1819
padding: 30px;
20+
1921
font-weight: 200;
2022
font-size: 200%;
2123
line-height: 1.375;
@@ -27,7 +29,7 @@ body {
2729
left: 20px;
2830
}
2931

30-
.controls .arrow {
32+
.arrow {
3133
width: 0; height: 0;
3234
border: 30px solid #333;
3335
float: left;
@@ -41,7 +43,7 @@ body {
4143
user-select: none;
4244
}
4345

44-
.controls .prev {
46+
.prev {
4547
border-top-color: transparent;
4648
border-bottom-color: transparent;
4749
border-left-color: transparent;
@@ -50,7 +52,7 @@ body {
5052
border-right-width: 50px;
5153
}
5254

53-
.controls .next {
55+
.next {
5456
border-top-color: transparent;
5557
border-bottom-color: transparent;
5658
border-right-color: transparent;
@@ -59,53 +61,53 @@ body {
5961
border-right-width: 0;
6062
}
6163

62-
.controls .prev:hover {
64+
.prev:hover {
6365
border-right-color: #888;
6466
cursor: pointer;
6567
}
6668

67-
.controls .next:hover {
69+
.next:hover {
6870
border-left-color: #888;
6971
cursor: pointer;
7072
}
7173

72-
.slide h1 {
74+
h1 {
7375
font-size: 300%;
7476
line-height: 1.2;
7577
text-align: center;
7678
margin: 170px 0 0;
7779
}
7880

79-
.slide h2 {
81+
h2 {
8082
font-size: 100%;
8183
line-height: 1.2;
8284
margin: 5px 0;
8385
text-align: center;
8486
font-weight: 200;
8587
}
8688

87-
.slide h3 {
89+
h3 {
8890
font-size: 140%;
8991
line-height: 1.2;
9092
border-bottom: 1px solid #aaa;
9193
margin: 0;
9294
padding-bottom: 15px;
9395
}
9496

95-
.slide ul {
97+
ul {
9698
padding: 20px 0 0 60px;
9799
font-weight: 200;
98100
line-height: 1.375;
99101
}
100102

101-
.slide .author h1.name {
103+
.author h1 {
102104
font-size: 170%;
103105
font-weight: 200;
104106
text-align: center;
105107
margin-bottom: 30px;
106108
}
107109

108-
.slide .author h3 {
110+
.author h3 {
109111
font-weight: 100;
110112
text-align: center;
111113
font-size: 95%;
@@ -137,34 +139,39 @@ pre {
137139
height: 3px;
138140
background-color: #b4b4b4;
139141

140-
-webkit-transition: width 0.1s ease-out;
141-
-moz-transition: width 0.1s ease-out;
142-
-o-transition: width 0.1s ease-out;
143-
transition: width 0.1s ease-out;
142+
-webkit-transition: width 0.05s ease-out;
143+
-moz-transition: width 0.05s ease-out;
144+
-o-transition: width 0.05s ease-out;
145+
transition: width 0.05s ease-out;
146+
}
147+
148+
.hidden {
149+
display: none;
144150
}
145151

146152
@media (max-width: 850px) {
147-
#wrapper {
148-
width: auto;
149-
}
150153

151154
body {
152155
font-size: 70%;
153156
}
154157

158+
.slide-content {
159+
width: auto;
160+
}
161+
155162
img {
156163
width: 100%;
157164
}
158165

159-
.slide h1 {
166+
h1 {
160167
margin-top: 120px;
161168
}
162169

163-
.controls .prev, .controls .prev:hover {
170+
.prev, .prev:hover {
164171
border-right-color: rgba(135, 135, 135, 0.5);
165172
}
166173

167-
.controls .next, .controls .next:hover {
174+
.next, .next:hover {
168175
border-left-color: rgba(135, 135, 135, 0.5);
169176
}
170177
}
@@ -175,21 +182,17 @@ pre {
175182
overflow: hidden;
176183
}
177184

178-
#wrapper {
179-
margin-top: 10px;
180-
height: 340px;
181-
}
182-
183-
.slide {
185+
.slide-content {
184186
padding: 10px;
187+
margin-top: 10px;
185188
height: 340px;
186189
}
187190

188-
.slide h1 {
191+
h1 {
189192
margin-top: 50px;
190193
}
191194

192-
.slide ul {
195+
ul {
193196
padding-left: 25px;
194197
}
195198
}
@@ -203,6 +206,10 @@ pre {
203206
size: letter;
204207
}
205208

209+
.hidden {
210+
display: inline;
211+
}
212+
206213
html {
207214
width: 100%;
208215
height: 100%;
@@ -223,19 +230,19 @@ pre {
223230
display: none;
224231
}
225232

226-
#wrapper {
227-
overflow: visible;
228-
height: 100%;
229-
margin-top: 0;
233+
.slide {
234+
position: static;
230235
}
231236

232-
.slide {
237+
.slide-content {
233238
border: 1px solid #222;
239+
margin-top: 0;
234240
margin-bottom: 40px;
235241
height: 3.5in;
242+
overflow: visible;
236243
}
237244

238-
.slide:nth-child(odd) {
245+
.slide:nth-child(even) {
239246
/* 2 slides per page */
240247
page-break-before: always;
241248
}

0 commit comments

Comments
 (0)