On Tue, May 26, 2009 at 6:46 PM, Jason Grout <[email protected]>wrote:

>
> William Stein wrote:
> > On Tue, May 26, 2009 at 3:21 PM, gerhard <[email protected]> wrote:
> >> Still trying to formulate this...
> >>
> >> Looking at the html source of a notebook,
> >> it looks like the output from a cell is in its own <div>,
> >> so folding and unfolding the output should be straight forward
> >> (e.g., using code from
> http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm
> >> )
> >>
> >> So a next step would be to get sections of a notebook
> >> into a <div>? If this can be made recursive,
> >> I believe I would want to be able to fold based on <hi>, i=1,2,...
> >> since headings using MCE have become easy to add!
> >
> > Oh, that would be really nice.  Just make each <hi> section have a
> > folding button.   That's great and very simple.
> > I tried that
> http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm
> > which feels cool.  Does it use jQuery?  Are there any folding examples
> > that just use jQuery?
>
>
> Relevant links:
>
> http://docs.jquery.com/Effects
>
> specifically:
>
> http://docs.jquery.com/Effects/slideToggle
>
> The structure of a notebook document looks something like:
>
>
> <div id="cell_text_2" class="text_cell" title="">
>   <h1>h1 heading</h1>
> </div>
> <script></script>
> <div id="cell_outer_1" class="cell_visible"></div>
> <div id="cell_outer_3" class="cell_visible"></div>
> <div id="cell_text_5" class="text_cell" title="">
>   <h1>another h1 heading</h1>
> </div>
>
> So (without restructuring the notebook html), you could use jquery to
> select the parent of the hi with class text_cell, then select all
> sibling divs until you got to the next div that had an h1 heading as a
> child.  Then just toggle all of those divs.  It's probably one line of
> jquery.
>
> Somehow, you'd have to tag each hi with the appropriate javascript code.
>  This is probably doable from the text cell creation code (see the code
> that creates the <script> tag above; it is generated on the fly when a
> text cell is rendered from cell.py).  It's also probably doable from
> both the html insertion code in the main javascript code, or also from
> tinymce.
>

Different people will have different needs, so I think we should have a
fairly flexible solution.  For example, I will use notebook worksheets to
illustrate concepts in aircraft performance data analysis.  The main portion
of the discussion will be via HTML text in between cells, with occasional
code in input cells that crunch data and produce an output plot or data
table.  The code to produce this output may be long, and not of interest to
most viewers.

For these worksheets, I'd like to have an option to not display input
cells.  There could be a "Display Input Cells" button at the toggle the
display (the button text would change to "Hide Input Cells" once it had been
selected).   And, for bonus marks, there could be some clear means to
display or hide individual cells.  I'd like to have all of the above
available on public worksheets too, as most of my viewers will not go to the
trouble to create an account so they can work with their own copy of the
worksheet.

--
Kevin Horton
Ottawa, Canada

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to