examples/06-graph/03-template.py
def webpage(graph, head="", style="", body=("",""), **kwargs):
    """ The head, style and body parameters can be used to insert custom HTML in the template.
        You can pass any optional parameter that can also be passed to render().
    """
    s1 = render(graph, type=STYLE,  **kwargs)
    s2 = render(graph, type=CANVAS, **kwargs)
    # Fix HTML source indentation:
    # f1 = indent each line
    # f2 = indent first line
    f1 = lambda s, t="\t": s.replace("\n","\n"+t)
    f2 = lambda s, t="\t": ("\n%s%s" % (t,s.lstrip())).rstrip()
    return template % (
        f2(head), f1(s1), f2(style, "\t\t"), f1(body[0]), f1("\n"+s2), f2(body[1]))
 The head, style and body parameters can be used to insert custom HTML in the template.
        You can pass any optional parameter that can also be passed to render().
    
The head, style and body parameters can be used to insert custom HTML in the template.
You can pass any optional parameter that can also be passed to render().
The head style and body parameters can be used to insert custom HTML in the template . You can pass any optional parameter that can also be passed to render () .
def webpage(graph, head="", style="", body=("",""), **kwargs):
    s1 = render(graph, type=STYLE,  **kwargs)
    s2 = render(graph, type=CANVAS, **kwargs)
    f1 = lambda s, t="\t": s.replace("\n","\n"+t)
    f2 = lambda s, t="\t": ("\n%s%s" % (t,s.lstrip())).rstrip()
    return template % (
        f2(head), f1(s1), f2(style, "\t\t"), f1(body[0]), f1("\n"+s2), f2(body[1]))
def webpage ( graph , head = "" , style = "" , body = ( "" , "" ) , ** kwargs ) : s1 = render ( graph , type = STYLE , ** kwargs ) s2 = render ( graph , type = CANVAS , ** kwargs ) f1 = lambda s , t = "\t" : s . replace ( "\n" , "\n" + t ) f2 = lambda s , t = "\t" : ( "\n%s%s" % ( t , s . lstrip ( ) ) ) . rstrip ( ) return template % ( f2 ( head ) , f1 ( s1 ) , f2 ( style , "\t\t" ) , f1 ( body [ 0 ] ) , f1 ( "\n" + s2 ) , f2 ( body [ 1 ] ) )
The head, style and body parameters can be used to insert custom HTML in the template.
The head style and body parameters can be used to insert custom HTML in the template .
""" The head, style and body parameters can be used to insert custom HTML in the template.
        You can pass any optional parameter that can also be passed to render().
    """ # Fix HTML source indentation: # f1 = indent each line # f2 = indent first line
graph
head
style
body