from viewdom import html, render, use_context, Context

expected = '<h1>My Todos</h1><ul><li>Item: first</li></ul>'

# start-after
title = 'My Todos'
todos = ['first']


def Todo(label):
    prefix = use_context('prefix')
    return html('<li>{prefix}{label}</li>')


def TodoList(todos):
    return html('<ul>{[Todo(label) for label in todos]}</ul>')


result = render(html('''
  <{Context} prefix="Item: ">
      <h1>{title}</h1>
      <{TodoList} todos={todos} />
  <//>    
'''))
# '<h1>My Todos</h1><ul><li>Item: first</li></ul>'

[((11, 13, 11, 34), 'viewdom.use_context', 'use_context', ({(11, 25, 11, 33): '"""prefix"""'}, {}), "('prefix')", False, 'from viewdom import html, render, use_context, Context\n'), ((12, 11, 12, 43), 'viewdom.html', 'html', ({(12, 16, 12, 42): '"""<li>{prefix}{label}</li>"""'}, {}), "('<li>{prefix}{label}</li>')", False, 'from viewdom import html, render, use_context, Context\n'), ((16, 11, 16, 62), 'viewdom.html', 'html', ({(16, 16, 16, 61): '"""<ul>{[Todo(label) for label in todos]}</ul>"""'}, {}), "('<ul>{[Todo(label) for label in todos]}</ul>')", False, 'from viewdom import html, render, use_context, Context\n'), ((19, 16, 24, 4), 'viewdom.html', 'html', ({(19, 21, 24, 3): '"""\n  <{Context} prefix="Item: ">\n      <h1>{title}</h1>\n      <{TodoList} todos={todos} />\n  <//>    \n"""'}, {}), '(\n    """\n  <{Context} prefix="Item: ">\n      <h1>{title}</h1>\n      <{TodoList} todos={todos} />\n  <//>    \n"""\n    )', False, 'from viewdom import html, render, use_context, Context\n')]