MCPcopy Index your code
hub / github.com/clips/pattern / webpage

Function webpage

examples/06-graph/03-template.py:28–40  ·  view source on GitHub ↗

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

(graph, head="", style="", body=("",""), **kwargs)

Source from the content-addressed store, hash-verified

26'''.strip()
27
28def webpage(graph, head="", style="", body=("",""), **kwargs):
29 """ The head, style and body parameters can be used to insert custom HTML in the template.
30 You can pass any optional parameter that can also be passed to render().
31 """
32 s1 = render(graph, type=STYLE, **kwargs)
33 s2 = render(graph, type=CANVAS, **kwargs)
34 # Fix HTML source indentation:
35 # f1 = indent each line
36 # f2 = indent first line
37 f1 = lambda s, t="\t": s.replace("\n","\n"+t)
38 f2 = lambda s, t="\t": ("\n%s%s" % (t,s.lstrip())).rstrip()
39 return template % (
40 f2(head), f1(s1), f2(style, "\t\t"), f1(body[0]), f1("\n"+s2), f2(body[1]))
41
42# Create a graph:
43g = Graph()

Callers 1

03-template.pyFile · 0.85

Calls 1

renderFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…