William Stein wrote:
> On Thu, Apr 9, 2009 at 5:32 AM, Pat LeSmithe <qed...@gmail.com> wrote:
>> Please see the attached snapshots.  The top and bottom bars also have a
>> search box and source link.
>>
>> If there's interest, I can try to get the toggle working in live
>> documentation.  I'd greatly appreciate a critique of the JavaScript code
>> for the toggle, as I'm not sure it always cooperates with jsMath.
> 
> That looks very nice to me!

The following patch seems to fix the toggle in the live documentation.
Should double-clicking on a live doc text cell bring up TinyMCE?

--- a/sage/server/notebook/twist.py     Sun Apr 05 16:50:38 2009 -0700
+++ b/sage/server/notebook/twist.py     Sun Apr 12 09:16:33 2009 -0700
@@ -170,6 +170,18 @@
         cells = W.cell_list()
         cells.pop()

+        # The first cell, if it's a text cell, may contain useful
+        # JavaScript code.  For example, the sidebar toggle uses
+        # jQuery's $() to change a few CSS attributes.  When the cell
+        # is rendered as HTML, however, sage.misc.html.math_parse()
+        # converts $ pairs to <span class='math'> elements.  This
+        # breaks the toggle.  We use a simple test to check for and
+        # escape the $'s.
+        c = cells[0]
+        c_text = c.plain_text()
+        if not c.is_interactive_cell() and '$(' in c_text and '.css('
in c_text:
+            c.set_input_text(c_text.replace('$(','\$('))
+
         s = notebook.html(worksheet_filename = W.filename(),
                           username = self.username)




--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to