##// 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 24 return m_list
25 25
26 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 31 meta_list = [[x + ' = ' + unicode(y)] for x, y in meta_tuple]
29 32 meta_list = self.switch_meta(meta_list)
30 33 return u'\n'.join(list(itertools.chain(*meta_list)))
@@ -10,36 +10,46 b''
10 10 {
11 11 "cell_type": "heading",
12 12 "level": 1,
13 "metadata": {},
13 "metadata": {
14 "slideshow": {
15 "new_section": true
16 }
17 },
14 18 "source": [
15 19 "Notebook Slide Example"
16 20 ]
17 21 },
18 22 {
19 23 "cell_type": "markdown",
20 "metadata": {},
21 "source": [
22 "Rendered by vIPer using [Reveal.js](http://lab.hakim.se/reveal-js)!"
23 ]
24 },
25 {
26 "cell_type": "markdown",
27 "metadata": {},
24 "metadata": {
25 "slideshow": {
26 "new_fragment": false
27 }
28 },
28 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 34 "cell_type": "markdown",
34 "metadata": {},
35 "metadata": {
36 "slideshow": {
37 "new_fragment": true
38 }
39 },
35 40 "source": [
36 "##<<<"
41 "by Dami\u00e1n Avila"
37 42 ]
38 43 },
39 44 {
40 45 "cell_type": "heading",
41 46 "level": 2,
42 "metadata": {},
47 "metadata": {
48 "slideshow": {
49 "new_section": true,
50 "new_subsection": true
51 }
52 },
43 53 "source": [
44 54 "NOTE: This notebook was modified from a Fernando's one"
45 55 ]
@@ -53,28 +63,22 b''
53 63 },
54 64 {
55 65 "cell_type": "markdown",
56 "metadata": {},
57 "source": [
58 "##---"
59 ]
60 },
61 {
62 "cell_type": "markdown",
63 "metadata": {},
66 "metadata": {
67 "slideshow": {
68 "new_subsection": true
69 }
70 },
64 71 "source": [
65 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 76 "cell_type": "markdown",
70 "metadata": {},
71 "source": [
72 "##---"
73 ]
74 },
75 {
76 "cell_type": "markdown",
77 "metadata": {},
77 "metadata": {
78 "slideshow": {
79 "new_subsection": true
80 }
81 },
78 82 "source": [
79 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 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 89 "cell_type": "heading",
93 90 "level": 2,
94 "metadata": {},
91 "metadata": {
92 "slideshow": {
93 "new_section": true,
94 "new_subsection": true
95 }
96 },
95 97 "source": [
96 98 "Converting your notebook to html with nbconvert"
97 99 ]
@@ -109,28 +111,22 b''
109 111 },
110 112 {
111 113 "cell_type": "markdown",
112 "metadata": {},
113 "source": [
114 "##---"
115 ]
116 },
117 {
118 "cell_type": "markdown",
119 "metadata": {},
114 "metadata": {
115 "slideshow": {
116 "new_subsection": true
117 }
118 },
120 119 "source": [
121 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 124 "cell_type": "markdown",
126 "metadata": {},
127 "source": [
128 "##---"
129 ]
130 },
131 {
132 "cell_type": "markdown",
133 "metadata": {},
125 "metadata": {
126 "slideshow": {
127 "new_subsection": true
128 }
129 },
134 130 "source": [
135 131 " # Only one notebook so far\n",
136 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 146 "cell_type": "heading",
158 147 "level": 2,
159 "metadata": {},
148 "metadata": {
149 "slideshow": {
150 "new_section": true,
151 "new_subsection": true
152 }
153 },
160 154 "source": [
161 155 "Configuring your Blogger blog to accept notebooks"
162 156 ]
@@ -170,47 +164,71 b''
170 164 },
171 165 {
172 166 "cell_type": "markdown",
173 "metadata": {},
167 "metadata": {
168 "slideshow": {
169 "new_fragment": true,
170 "new_subsection": true
171 }
172 },
174 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 180 "cell_type": "markdown",
180 "metadata": {},
181 "metadata": {
182 "slideshow": {
183 "new_fragment": true
184 }
185 },
181 186 "source": [
182 "1. Once authenticated, go to your blog's overview page by clicking on its title.\n",
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."
187 "* Click on templates (left column) and customize using the Advanced options."
186 188 ]
187 189 },
188 190 {
189 191 "cell_type": "markdown",
190 "metadata": {},
192 "metadata": {
193 "slideshow": {
194 "new_fragment": true
195 }
196 },
191 197 "source": [
192 "##---"
198 "* Scroll down the middle column until you see an \"Add CSS\" option."
193 199 ]
194 200 },
195 201 {
196 202 "cell_type": "markdown",
197 "metadata": {},
203 "metadata": {
204 "slideshow": {
205 "new_fragment": true
206 }
207 },
198 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",
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."
209 "* Copy entire the contents of the `_header` file into the CSS box."
202 210 ]
203 211 },
204 212 {
205 213 "cell_type": "markdown",
206 "metadata": {},
214 "metadata": {
215 "slideshow": {
216 "new_subsection": true
217 }
218 },
207 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 226 "cell_type": "markdown",
213 "metadata": {},
227 "metadata": {
228 "slideshow": {
229 "new_subsection": true
230 }
231 },
214 232 "source": [
215 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 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 239 "cell_type": "heading",
229 240 "level": 2,
230 "metadata": {},
241 "metadata": {
242 "slideshow": {
243 "new_section": true
244 }
245 },
231 246 "source": [
232 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 260 "cell_type": "heading",
253 261 "level": 2,
254 "metadata": {},
262 "metadata": {
263 "slideshow": {
264 "new_section": true
265 }
266 },
255 267 "source": [
256 268 "What can you put in?"
257 269 ]
@@ -287,14 +299,11 b''
287 299 },
288 300 {
289 301 "cell_type": "markdown",
290 "metadata": {},
291 "source": [
292 "##---"
293 ]
294 },
295 {
296 "cell_type": "markdown",
297 "metadata": {},
302 "metadata": {
303 "slideshow": {
304 "new_section": true
305 }
306 },
298 307 "source": [
299 308 "With pylab loaded, the usual matplotlib operations work"
300 309 ]
@@ -328,14 +337,11 b''
328 337 },
329 338 {
330 339 "cell_type": "markdown",
331 "metadata": {},
332 "source": [
333 "##---"
334 ]
335 },
336 {
337 "cell_type": "markdown",
338 "metadata": {},
340 "metadata": {
341 "slideshow": {
342 "new_section": true
343 }
344 },
339 345 "source": [
340 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 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 356 "cell_type": "heading",
358 357 "level": 2,
359 "metadata": {},
358 "metadata": {
359 "slideshow": {
360 "new_section": true,
361 "new_subsection": true
362 }
363 },
360 364 "source": [
361 365 "You can easily include formatted text and code with markdown"
362 366 ]
@@ -379,14 +383,11 b''
379 383 },
380 384 {
381 385 "cell_type": "markdown",
382 "metadata": {},
383 "source": [
384 "##---"
385 ]
386 },
387 {
388 "cell_type": "markdown",
389 "metadata": {},
386 "metadata": {
387 "slideshow": {
388 "new_subsection": true
389 }
390 },
390 391 "source": [
391 392 "or other languages:\n",
392 393 "\n",
@@ -405,14 +406,11 b''
405 406 },
406 407 {
407 408 "cell_type": "markdown",
408 "metadata": {},
409 "source": [
410 "##>>>"
411 ]
412 },
413 {
414 "cell_type": "markdown",
415 "metadata": {},
409 "metadata": {
410 "slideshow": {
411 "new_section": true
412 }
413 },
416 414 "source": [
417 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 426 "cell_type": "heading",
436 427 "level": 1,
437 "metadata": {},
428 "metadata": {
429 "slideshow": {
430 "new_section": true
431 }
432 },
438 433 "source": [
439 434 "IPython rocks!"
440 435 ]
General Comments 0
You need to be logged in to leave comments. Login now