[IPython-dev] Playing with cells in the notebook... and some problems.

Damián Avila damianavila at gmail.com
Wed Aug 7 01:23:48 EDT 2013


I began to play with javascript and jquery to make a "live" version of 
reveal slideshow...

And I found myself with some problem trying to do some things...

Essentially, all the javascript libraries available to do slideshows 
(reveal, deck, impress, flowtime, bespoke, jimpress, scrolldeck, etc...) 
needs a custom markup to make the slides... esentially adding html 
elements (ie. <section> ) or classes or IDs... So, I can modify the 
notebook cells on the fly to add the classes or IDs (I have done some of 
this things), but if I want to group some cells together in one slide, I 
need to "wrap" them inside a container (ie, a <div> or <section>) and 
there is where the problem arise... because I try to wrap a cell on the 
fly in the notebook, this cell is no longer responsive to the execution 
of code (neither focus it)...
Ah... if I "wrapinner", the cell is executed without problems, but I 
need to wrap outer, I mean add html elements enclosing the current cell...

Note: beware if you try the following inside the notebook because if you 
wrap a cell, it will be deleted after closing and reopen of the notebook...

An example:

```
%%javascript
var cells = IPython.notebook.get_cells();
for(var i in cells){
   var cell = cells[i];
     if (cell.metadata.slideshow.slide_type == 'fragment') {
       $('.cell:nth('+i+')').wrap('<div class="ft-page" />');
     }
}
```

With the current state, I mean, without grouping cells, I can build live 
slideshow... but each cell would be a slide, and I feel that sometimes 
is better to combine text and code cells in one slide (group cells)...

Probably I am missing some basic conceptual ideas behind js and 
jquery... or IPython internals... if this is the case, please if some of 
you can give me some pointers, it will be great.

Sorry for the long post...

Cheers.

Damián.




More information about the IPython-dev mailing list