John H Palmieri wrote:
>   matrix?  SHIFT-RETURN
> still doesn't behave well, while

It seems that Cell.html_out() wraps this output in
div.cell_output_html_wrap.  Referring to css.py, I think this accounts
for the different font.  Adding font properties to div.docstring may
help.  Then, something like

--- a/sage/server/notebook/js.py        Wed Apr 01 15:48:21 2009 -0700
+++ b/sage/server/notebook/js.py        Thu Apr 02 23:48:03 2009 -0700
@@ -3003,6 +3003,7 @@
         cell_output.innerHTML = '';
         cell_output_nowrap.innerHTML = '';
         cell_output_html.innerHTML = introspect_html;
+        jsMath.ProcessBeforeShowing(cell_output_html);
     }
 }

typesets the output.  It's probably better to use a try/catch block, as
done earlier in the ambient function.  Note: I haven't explored the
consequences of these changes for other sorts of output.

A few more thoughts:

* The i = -1 "worst case" in SPHINX_set_instrospect_html() could instead
call the DOCUTILS version or the original, to degrade gracefully.

* It may help to "cp -r" SAGE_ROOT/devel/sage/doc/common to
SAGE_ROOT/devel/sage/doc/introspect and modify the new conf.py and
layout.html.  This should simplify and speed up
SPHINX_set_introspect_html().

* If anyone's interested, here's a way to render an input cell as
syntax-highlighted HTML output:

from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import HtmlFormatter
from pygments.styles import STYLE_MAP
from pygments.styles import get_style_by_name
from sphinx.highlighting import SphinxStyle

class colorize:
    def __init__(self, style=SphinxStyle):
        self.lexer = PythonLexer(encoding='chardet')
        self.formatter = HtmlFormatter(noclasses=True, style=style)
    def eval(self, s, globals, locals):
        return html(highlight(s, self.lexer, self.formatter))

Then put %colorize('colorful'), say, at the beginning of a cell and
evaluate it, e.g.,

%colorize('colorful')
def f(x):
  return x * x
f(3.0)

STYLE_MAP.keys() gives a list of styles.  This is adapted from
http://groups.google.com/group/sage-devel/msg/e53caae140cef7df .








--~--~---------~--~----~------------~-------~--~----~
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