saturn_notebook/__main__.py
def show(fn: "input notebook",
         html: "save HTML to a file" = '',
         debug: "show debugging information" = False):
    """Show the contents of the notebook, without evaluating."""
    with open(fn) as f:
        cells = c.parse(f, show_only = True)

    output   = lambda cell: show_console(cell, rule = debug, verbose = debug)

    if html:
        f_html = open(html, 'w')
        output = lambda cell: show_html(cell, f_html)

        f_html.write('<html>\n')
        f_html.write('<head>\n')
        f_html.write('<style>\n')
        f_html.write(c.HtmlFormatter().get_style_defs('.highlight'))
        f_html.write('</style>\n')
        f_html.write('</head>\n')
        f_html.write('<body>\n')


    for i,cell in enumerate(cells):
        if not cell.display(): continue
        output(cell)

    if html:
        f_html.write('</body>\n')
        f_html.write('</html>\n')
Show the contents of the notebook, without evaluating.
Show the contents of the notebook, without evaluating.
Show the contents of the notebook without evaluating .
def show(fn: "input notebook",
         html: "save HTML to a file" = '',
         debug: "show debugging information" = False):
    with open(fn) as f:
        cells = c.parse(f, show_only = True)
    output   = lambda cell: show_console(cell, rule = debug, verbose = debug)
    if html:
        f_html = open(html, 'w')
        output = lambda cell: show_html(cell, f_html)
        f_html.write('<html>\n')
        f_html.write('<head>\n')
        f_html.write('<style>\n')
        f_html.write(c.HtmlFormatter().get_style_defs('.highlight'))
        f_html.write('</style>\n')
        f_html.write('</head>\n')
        f_html.write('<body>\n')
    for i,cell in enumerate(cells):
        if not cell.display(): continue
        output(cell)
    if html:
        f_html.write('</body>\n')
        f_html.write('</html>\n')
def show ( fn : "input notebook" , html : "save HTML to a file" = '' , debug : "show debugging information" = False ) : with open ( fn ) as f : cells = c . parse ( f , show_only = True ) output = lambda cell : show_console ( cell , rule = debug , verbose = debug ) if html : f_html = open ( html , 'w' ) output = lambda cell : show_html ( cell , f_html ) f_html . write ( '<html>\n' ) f_html . write ( '<head>\n' ) f_html . write ( '<style>\n' ) f_html . write ( c . HtmlFormatter ( ) . get_style_defs ( '.highlight' ) ) f_html . write ( '</style>\n' ) f_html . write ( '</head>\n' ) f_html . write ( '<body>\n' ) for i , cell in enumerate ( cells ) : if not cell . display ( ) : continue output ( cell ) if html : f_html . write ( '</body>\n' ) f_html . write ( '</html>\n' )
Show the contents of the notebook, without evaluating.
Show the contents of the notebook without evaluating .
"""Show the contents of the notebook, without evaluating."""
fn
"input notebook"
html
"save HTML to a file"
debug
"show debugging information"