#10652: Add support for uploading static html doc page as a worksheet in the
notebook
--------------------------------------+-------------------------------------
   Reporter:  nthiery                 |       Owner:  nthiery                   
                       
       Type:  enhancement             |      Status:  needs_review              
                       
   Priority:  critical                |   Milestone:  sage-4.7                  
                       
  Component:  notebook                |    Keywords:  days28, Sphinx, upload, 
static html documentation
     Author:  Nicolas M. ThiƩry, ...  |    Upstream:  N/A                       
                       
   Reviewer:                          |      Merged:                            
                       
Work_issues:                          |  
--------------------------------------+-------------------------------------

Comment(by jason):

 Replying to [comment:19 nthiery]:
 >       Hi!
 >
 > Thanks for your further comments.
 >
 > In the updated patch, the ``assert false`` is replaced by an
 > HTMLResponse; please check that the message is meaningful enough. The
 > extension guessins is now done with urlparse + splitext to get the
 > extension (though there are comments on the web that we should use the
 > Content-Type answer of the web server; but that was not very practical
 > here). The two lines after the ``return`` are removed; they were just
 > accidental residue of some former experimentation. Finally, I wrote
 > the missing doctest for _import_worksheet_html. I still have a problem
 > there, since the doctest does not pass (there is a single garbled
 > cell, instead of several), whereas running it by hand in the sage
 > interpreter just works fine. Help welcome!
 >

 This is what I got when I ran the doctest by hand:

 {{{
 sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
 sage: name = tmp_filename() + '.html'
 sage: fd = open(name,'w')
 sage: fd.write('\n'.join(
 ....: ['<html><head><title>Test Notebook</title></head>',
 ....: '<body>',
 ....: '<div class="highlight-python"><div class="highlight"><pre>',
 ....: '<span class="gp">sage: </span><span class="mi">1</span><span
 class="o">+</span><span class="mi">1</span>',
 ....: '<span class="go">2</span>',
 ....: '</pre></div></div>',
 ....: '</body></html>']))
 sage: fd.close()
 sage: W = nb._import_worksheet_html(name, 'admin')
 sage: W.name()
 u'Test Notebook'
 sage:
 sage: W.owner()
 'admin'
 sage: W.cell_list()
 [TextCell 1: Test Notebook
 system:sage

 <div class="highlight-python">, Cell 0; in=1+1, out=
 2
 , TextCell 2: </div]
 sage: cell = W.cell_list()[1]
 sage: cell.input_text()
 u'1+1'
 sage: cell.output_text()
 u'<pre class="shrunk">2</pre>'
 }}}



 > Cheers,
 >                 Nicolas

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10652#comment:20>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

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

Reply via email to