#4575: [with patch, needs work] Option to show nested lists as html tables
-------------------------+--------------------------------------------------
Reporter: whuss | Owner: whuss
Type: enhancement | Status: reopened
Priority: major | Milestone: sage-3.2.2
Component: notebook | Resolution:
Keywords: |
-------------------------+--------------------------------------------------
Comment (by whuss):
Replying to [comment:4 mhansen]:
> I don't agree with William's positive review on this for some design
reasons. First off, it is only useful from the notebook as it just spits
out HTML while all other cases of show work fine from the command-line.
I agree, It should also do something useful on the command-line.
> Tacking random things and keywords onto show is not a maintainable
solution especially since the new functionality is completely orthogonal
to what's already there.
> Instead this should be some function in a module for creating HTML
output of objects.
This is probably cleaner implementation wise, but I don't think
html.nested_list()
is a good userinterface. Why should the user of the notebook need to know
the
implementation detail that the output is produced using HTML? And the
output of the
function is not really html anyway, but html + latex.
It is also inconsistent, since
sage: html(sin(x)/x)
produces acii art, and not html + jsmath.
There are already at least five functions that produce jsmath output in
the notebook,
which all behave differently:
'''show():'''
Produces latex in display mode.
And works with graphic objects of course.
'''view():'''
Produces latex in inline mode (which is hard to read in the notebook).
This has many options that only work on the commandline and with xdvi.
For graphic objects it returns a string representation.
'''typeset():'''
Same behaviour as view() but has no options.
'''pretty_print():'''
produces latex in inline mode.
If used on the graphics objects, it shows it like show().
But it doesn't accept any options, as show() does.
'''jsmath():'''
produces latex in display mode.
For graphic objects it returns a string representation,
but inside latex math-mode.
The docstring says that there is a option mode
which changes between display and inline mode.
Unfortunately this only works in doctest mode.
In the notebook I get:
{{{
sage: jsmath(x^2, 'inline')
Traceback (click to the left for traceback)
...
TypeError: __call__() takes exactly 2 arguments (3 given)
}}}
Is there a deeper reason why Sage has all these functions? Or have
they just accumulated over the years? A few of these should probably
be deprecated.
In my opinion show() is the best of these, because also x.show() works,
so it is consistent. It's short and easy to remember.
It just needs better documentation.
Would a mode flag for show() like the one for jsmath() be okay? Then
it could be extended in the future without adding additional keywords.
Grettings,
Wilfried
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4575#comment:11>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
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-trac?hl=en
-~----------~----~----~----~------~----~------~--~---