##// END OF EJS Templates
Fixed bug when cells do not have associated slideshow metadata. Fixed example_slide.ipynb to use metadata for slides building.
damianavila -
Show More
@@ -24,7 +24,10 b' class ConverterReveal(ConverterMarkdown):'
24 return m_list
24 return m_list
25
25
26 def meta2str(self, meta):
26 def meta2str(self, meta):
27 meta_tuple = meta[u'slideshow'].items()
27 try:
28 meta_tuple = meta[u'slideshow'].items()
29 except KeyError as e:
30 meta_tuple = ()
28 meta_list = [[x + ' = ' + unicode(y)] for x, y in meta_tuple]
31 meta_list = [[x + ' = ' + unicode(y)] for x, y in meta_tuple]
29 meta_list = self.switch_meta(meta_list)
32 meta_list = self.switch_meta(meta_list)
30 return u'\n'.join(list(itertools.chain(*meta_list)))
33 return u'\n'.join(list(itertools.chain(*meta_list)))
@@ -10,36 +10,46 b''
10 {
10 {
11 "cell_type": "heading",
11 "cell_type": "heading",
12 "level": 1,
12 "level": 1,
13 "metadata": {},
13 "metadata": {
14 "slideshow": {
15 "new_section": true
16 }
17 },
14 "source": [
18 "source": [
15 "Notebook Slide Example"
19 "Notebook Slide Example"
16 ]
20 ]
17 },
21 },
18 {
22 {
19 "cell_type": "markdown",
23 "cell_type": "markdown",
20 "metadata": {},
24 "metadata": {
21 "source": [
25 "slideshow": {
22 "Rendered by vIPer using [Reveal.js](http://lab.hakim.se/reveal-js)!"
26 "new_fragment": false
23 ]
27 }
24 },
28 },
25 {
26 "cell_type": "markdown",
27 "metadata": {},
28 "source": [
29 "source": [
29 "(also you can get a [pdf](http://www.slideviper.oquanta.info/reveal/slides.pdf) version with chrome!)"
30 "Rendered by nbconvert using [Reveal.js](http://lab.hakim.se/reveal-js)!"
30 ]
31 ]
31 },
32 },
32 {
33 {
33 "cell_type": "markdown",
34 "cell_type": "markdown",
34 "metadata": {},
35 "metadata": {
36 "slideshow": {
37 "new_fragment": true
38 }
39 },
35 "source": [
40 "source": [
36 "##<<<"
41 "by Dami\u00e1n Avila"
37 ]
42 ]
38 },
43 },
39 {
44 {
40 "cell_type": "heading",
45 "cell_type": "heading",
41 "level": 2,
46 "level": 2,
42 "metadata": {},
47 "metadata": {
48 "slideshow": {
49 "new_section": true,
50 "new_subsection": true
51 }
52 },
43 "source": [
53 "source": [
44 "NOTE: This notebook was modified from a Fernando's one"
54 "NOTE: This notebook was modified from a Fernando's one"
45 ]
55 ]
@@ -53,28 +63,22 b''
53 },
63 },
54 {
64 {
55 "cell_type": "markdown",
65 "cell_type": "markdown",
56 "metadata": {},
66 "metadata": {
57 "source": [
67 "slideshow": {
58 "##---"
68 "new_subsection": true
59 ]
69 }
60 },
70 },
61 {
62 "cell_type": "markdown",
63 "metadata": {},
64 "source": [
71 "source": [
65 "The combination of easy editing in markdown with the notebook's ability to contain code, figures and results, makes it an ideal platform for quick authoring of technical documents, so being able to post to a blog is a natural request."
72 "The combination of easy editing in markdown with the notebook's ability to contain code, figures and results, makes it an ideal platform for quick authoring of technical documents, so being able to post to a blog is a natural request."
66 ]
73 ]
67 },
74 },
68 {
75 {
69 "cell_type": "markdown",
76 "cell_type": "markdown",
70 "metadata": {},
77 "metadata": {
71 "source": [
78 "slideshow": {
72 "##---"
79 "new_subsection": true
73 ]
80 }
74 },
81 },
75 {
76 "cell_type": "markdown",
77 "metadata": {},
78 "source": [
82 "source": [
79 "Today, in answering a query about this from a colleague, I decided to try again the status of our conversion pipeline, and I'm happy to report that with a bit of elbow-grease, at least on Blogger things work pretty well! \n",
83 "Today, in answering a query about this from a colleague, I decided to try again the status of our conversion pipeline, and I'm happy to report that with a bit of elbow-grease, at least on Blogger things work pretty well! \n",
80 "\n",
84 "\n",
@@ -82,16 +86,14 b''
82 ]
86 ]
83 },
87 },
84 {
88 {
85 "cell_type": "markdown",
86 "metadata": {},
87 "source": [
88 "##>>><<<"
89 ]
90 },
91 {
92 "cell_type": "heading",
89 "cell_type": "heading",
93 "level": 2,
90 "level": 2,
94 "metadata": {},
91 "metadata": {
92 "slideshow": {
93 "new_section": true,
94 "new_subsection": true
95 }
96 },
95 "source": [
97 "source": [
96 "Converting your notebook to html with nbconvert"
98 "Converting your notebook to html with nbconvert"
97 ]
99 ]
@@ -109,28 +111,22 b''
109 },
111 },
110 {
112 {
111 "cell_type": "markdown",
113 "cell_type": "markdown",
112 "metadata": {},
114 "metadata": {
113 "source": [
115 "slideshow": {
114 "##---"
116 "new_subsection": true
115 ]
117 }
116 },
118 },
117 {
118 "cell_type": "markdown",
119 "metadata": {},
120 "source": [
119 "source": [
121 "This will leave two files in your computer, one named `your_notebook.html` and one named `your_noteboook_header.html`; it might also create a directory called `your_notebook_files` if needed for ancillary files. The first file will contain the body of your post and can be pasted wholesale into the Blogger editing area. The second file contains the CSS and Javascript material needed for the notebook to display correctly, you should only need to use this once to configure your blogger setup (see next):"
120 "This will leave two files in your computer, one named `your_notebook.html` and one named `your_noteboook_header.html`; it might also create a directory called `your_notebook_files` if needed for ancillary files. The first file will contain the body of your post and can be pasted wholesale into the Blogger editing area. The second file contains the CSS and Javascript material needed for the notebook to display correctly, you should only need to use this once to configure your blogger setup (see next):"
122 ]
121 ]
123 },
122 },
124 {
123 {
125 "cell_type": "markdown",
124 "cell_type": "markdown",
126 "metadata": {},
125 "metadata": {
127 "source": [
126 "slideshow": {
128 "##---"
127 "new_subsection": true
129 ]
128 }
130 },
129 },
131 {
132 "cell_type": "markdown",
133 "metadata": {},
134 "source": [
130 "source": [
135 " # Only one notebook so far\n",
131 " # Only one notebook so far\n",
136 " (master)longs[blog]> ls\n",
132 " (master)longs[blog]> ls\n",
@@ -147,16 +143,14 b''
147 ]
143 ]
148 },
144 },
149 {
145 {
150 "cell_type": "markdown",
151 "metadata": {},
152 "source": [
153 "##>>><<<"
154 ]
155 },
156 {
157 "cell_type": "heading",
146 "cell_type": "heading",
158 "level": 2,
147 "level": 2,
159 "metadata": {},
148 "metadata": {
149 "slideshow": {
150 "new_section": true,
151 "new_subsection": true
152 }
153 },
160 "source": [
154 "source": [
161 "Configuring your Blogger blog to accept notebooks"
155 "Configuring your Blogger blog to accept notebooks"
162 ]
156 ]
@@ -170,47 +164,71 b''
170 },
164 },
171 {
165 {
172 "cell_type": "markdown",
166 "cell_type": "markdown",
173 "metadata": {},
167 "metadata": {
168 "slideshow": {
169 "new_fragment": true,
170 "new_subsection": true
171 }
172 },
174 "source": [
173 "source": [
175 "##---"
174 "* Once authenticated, go to your blog's overview page by clicking on its title.\n",
175 "\n",
176 "\n"
176 ]
177 ]
177 },
178 },
178 {
179 {
179 "cell_type": "markdown",
180 "cell_type": "markdown",
180 "metadata": {},
181 "metadata": {
182 "slideshow": {
183 "new_fragment": true
184 }
185 },
181 "source": [
186 "source": [
182 "1. Once authenticated, go to your blog's overview page by clicking on its title.\n",
187 "* Click on templates (left column) and customize using the Advanced options."
183 "2. Click on templates (left column) and customize using the Advanced options.\n",
184 "3. Scroll down the middle column until you see an \"Add CSS\" option.\n",
185 "4. Copy entire the contents of the `_header` file into the CSS box."
186 ]
188 ]
187 },
189 },
188 {
190 {
189 "cell_type": "markdown",
191 "cell_type": "markdown",
190 "metadata": {},
192 "metadata": {
193 "slideshow": {
194 "new_fragment": true
195 }
196 },
191 "source": [
197 "source": [
192 "##---"
198 "* Scroll down the middle column until you see an \"Add CSS\" option."
193 ]
199 ]
194 },
200 },
195 {
201 {
196 "cell_type": "markdown",
202 "cell_type": "markdown",
197 "metadata": {},
203 "metadata": {
204 "slideshow": {
205 "new_fragment": true
206 }
207 },
198 "source": [
208 "source": [
199 "That's it, and you shouldn't need to do anything else as long as the CSS we use in the notebooks doesn't drastically change. This customization of your blog needs to be done only once.\n",
209 "* Copy entire the contents of the `_header` file into the CSS box."
200 "\n",
201 "While you are at it, I recommend you change the width of your blog so that cells have enough space for clean display; in experimenting I found out that the default template was too narrow to properly display code cells, producing a lot of text wrapping that impaired readability. I ended up using a layout with a single column for all blog contents, putting the blog archive at the bottom. Otherwise, if I kept the right sidebar, code cells got too squished in the post area."
202 ]
210 ]
203 },
211 },
204 {
212 {
205 "cell_type": "markdown",
213 "cell_type": "markdown",
206 "metadata": {},
214 "metadata": {
215 "slideshow": {
216 "new_subsection": true
217 }
218 },
207 "source": [
219 "source": [
208 "##---"
220 "That's it, and you shouldn't need to do anything else as long as the CSS we use in the notebooks doesn't drastically change. This customization of your blog needs to be done only once.\n",
221 "\n",
222 "While you are at it, I recommend you change the width of your blog so that cells have enough space for clean display; in experimenting I found out that the default template was too narrow to properly display code cells, producing a lot of text wrapping that impaired readability. I ended up using a layout with a single column for all blog contents, putting the blog archive at the bottom. Otherwise, if I kept the right sidebar, code cells got too squished in the post area."
209 ]
223 ]
210 },
224 },
211 {
225 {
212 "cell_type": "markdown",
226 "cell_type": "markdown",
213 "metadata": {},
227 "metadata": {
228 "slideshow": {
229 "new_subsection": true
230 }
231 },
214 "source": [
232 "source": [
215 "I also had problems using some of the fancier templates available from 'Dynamic Views', in that I could never get inline math to render. But sticking to those from the Simple or 'Picture Window' categories worked fine and they still allow for a lot of customization.\n",
233 "I also had problems using some of the fancier templates available from 'Dynamic Views', in that I could never get inline math to render. But sticking to those from the Simple or 'Picture Window' categories worked fine and they still allow for a lot of customization.\n",
216 "\n",
234 "\n",
@@ -218,16 +236,13 b''
218 ]
236 ]
219 },
237 },
220 {
238 {
221 "cell_type": "markdown",
222 "metadata": {},
223 "source": [
224 "##>>>"
225 ]
226 },
227 {
228 "cell_type": "heading",
239 "cell_type": "heading",
229 "level": 2,
240 "level": 2,
230 "metadata": {},
241 "metadata": {
242 "slideshow": {
243 "new_section": true
244 }
245 },
231 "source": [
246 "source": [
232 "Adding the actual posts"
247 "Adding the actual posts"
233 ]
248 ]
@@ -242,16 +257,13 b''
242 ]
257 ]
243 },
258 },
244 {
259 {
245 "cell_type": "markdown",
246 "metadata": {},
247 "source": [
248 "##---"
249 ]
250 },
251 {
252 "cell_type": "heading",
260 "cell_type": "heading",
253 "level": 2,
261 "level": 2,
254 "metadata": {},
262 "metadata": {
263 "slideshow": {
264 "new_section": true
265 }
266 },
255 "source": [
267 "source": [
256 "What can you put in?"
268 "What can you put in?"
257 ]
269 ]
@@ -287,14 +299,11 b''
287 },
299 },
288 {
300 {
289 "cell_type": "markdown",
301 "cell_type": "markdown",
290 "metadata": {},
302 "metadata": {
291 "source": [
303 "slideshow": {
292 "##---"
304 "new_section": true
293 ]
305 }
294 },
306 },
295 {
296 "cell_type": "markdown",
297 "metadata": {},
298 "source": [
307 "source": [
299 "With pylab loaded, the usual matplotlib operations work"
308 "With pylab loaded, the usual matplotlib operations work"
300 ]
309 ]
@@ -328,14 +337,11 b''
328 },
337 },
329 {
338 {
330 "cell_type": "markdown",
339 "cell_type": "markdown",
331 "metadata": {},
340 "metadata": {
332 "source": [
341 "slideshow": {
333 "##---"
342 "new_section": true
334 ]
343 }
335 },
344 },
336 {
337 "cell_type": "markdown",
338 "metadata": {},
339 "source": [
345 "source": [
340 "The notebook, thanks to MathJax, has great LaTeX support, so that you can type inline math $(1,\\gamma,\\ldots, \\infty)$ as well as displayed equations:\n",
346 "The notebook, thanks to MathJax, has great LaTeX support, so that you can type inline math $(1,\\gamma,\\ldots, \\infty)$ as well as displayed equations:\n",
341 "\n",
347 "\n",
@@ -347,16 +353,14 b''
347 ]
353 ]
348 },
354 },
349 {
355 {
350 "cell_type": "markdown",
351 "metadata": {},
352 "source": [
353 "##<<<"
354 ]
355 },
356 {
357 "cell_type": "heading",
356 "cell_type": "heading",
358 "level": 2,
357 "level": 2,
359 "metadata": {},
358 "metadata": {
359 "slideshow": {
360 "new_section": true,
361 "new_subsection": true
362 }
363 },
360 "source": [
364 "source": [
361 "You can easily include formatted text and code with markdown"
365 "You can easily include formatted text and code with markdown"
362 ]
366 ]
@@ -379,14 +383,11 b''
379 },
383 },
380 {
384 {
381 "cell_type": "markdown",
385 "cell_type": "markdown",
382 "metadata": {},
386 "metadata": {
383 "source": [
387 "slideshow": {
384 "##---"
388 "new_subsection": true
385 ]
389 }
386 },
390 },
387 {
388 "cell_type": "markdown",
389 "metadata": {},
390 "source": [
391 "source": [
391 "or other languages:\n",
392 "or other languages:\n",
392 "\n",
393 "\n",
@@ -405,14 +406,11 b''
405 },
406 },
406 {
407 {
407 "cell_type": "markdown",
408 "cell_type": "markdown",
408 "metadata": {},
409 "metadata": {
409 "source": [
410 "slideshow": {
410 "##>>>"
411 "new_section": true
411 ]
412 }
412 },
413 },
413 {
414 "cell_type": "markdown",
415 "metadata": {},
416 "source": [
414 "source": [
417 "And since the notebook can store displayed images in the file itself, you can show images which will be embedded in your post:"
415 "And since the notebook can store displayed images in the file itself, you can show images which will be embedded in your post:"
418 ]
416 ]
@@ -425,16 +423,13 b''
425 ]
423 ]
426 },
424 },
427 {
425 {
428 "cell_type": "markdown",
429 "metadata": {},
430 "source": [
431 "##---"
432 ]
433 },
434 {
435 "cell_type": "heading",
426 "cell_type": "heading",
436 "level": 1,
427 "level": 1,
437 "metadata": {},
428 "metadata": {
429 "slideshow": {
430 "new_section": true
431 }
432 },
438 "source": [
433 "source": [
439 "IPython rocks!"
434 "IPython rocks!"
440 ]
435 ]
General Comments 0
You need to be logged in to leave comments. Login now