#!/usr/bin/env python
import warnings as _warnings
_warnings.resetwarnings()
_warnings.filterwarnings('error')

from tdi import html

template = html.from_string("""
<node tdi="item">
    <znode tdi="nested">
        <ynode tdi="subnested"></ynode>
    </znode>
    <xnode tdi="a"></xnode>
</node>
""".lstrip())

class Model(object):
    def render_item(self, node):
        node.replace(self.replace_nested, node.nested)
        return True

    def replace_nested(self, node):
        node.replace(self.replace_subnested, node.subnested)
        return True

    def replace_subnested(self, node):
        node.content = "yay..."

model = Model()
template.render(model)

c841d40c237cf36d9595f5f5b1d2eccdb9a99b0e
<mask token>


class Model(object):

    def render_item(self, node):
        node.replace(self.replace_nested, node.nested)
        return True

    def replace_nested(self, node):
        node.replace(self.replace_subnested, node.subnested)
        return True

    def replace_subnested(self, node):
        node.content = 'yay...'


<mask token>

<mask token>
_warnings.resetwarnings()
_warnings.filterwarnings('error')
<mask token>


class Model(object):

    def render_item(self, node):
        node.replace(self.replace_nested, node.nested)
        return True

    def replace_nested(self, node):
        node.replace(self.replace_subnested, node.subnested)
        return True

    def replace_subnested(self, node):
        node.content = 'yay...'


<mask token>
template.render(model)

<mask token>
_warnings.resetwarnings()
_warnings.filterwarnings('error')
<mask token>
template = html.from_string(
    """
<node tdi="item">
    <znode tdi="nested">
        <ynode tdi="subnested"></ynode>
    </znode>
    <xnode tdi="a"></xnode>
</node>
"""
    .lstrip())


class Model(object):

    def render_item(self, node):
        node.replace(self.replace_nested, node.nested)
        return True

    def replace_nested(self, node):
        node.replace(self.replace_subnested, node.subnested)
        return True

    def replace_subnested(self, node):
        node.content = 'yay...'


model = Model()
template.render(model)

import warnings as _warnings
_warnings.resetwarnings()
_warnings.filterwarnings('error')
from tdi import html
template = html.from_string(
    """
<node tdi="item">
    <znode tdi="nested">
        <ynode tdi="subnested"></ynode>
    </znode>
    <xnode tdi="a"></xnode>
</node>
"""
    .lstrip())


class Model(object):

    def render_item(self, node):
        node.replace(self.replace_nested, node.nested)
        return True

    def replace_nested(self, node):
        node.replace(self.replace_subnested, node.subnested)
        return True

    def replace_subnested(self, node):
        node.content = 'yay...'


model = Model()
template.render(model)

#!/usr/bin/env python
import warnings as _warnings
_warnings.resetwarnings()
_warnings.filterwarnings('error')

from tdi import html

template = html.from_string("""
<node tdi="item">
    <znode tdi="nested">
        <ynode tdi="subnested"></ynode>
    </znode>
    <xnode tdi="a"></xnode>
</node>
""".lstrip())

class Model(object):
    def render_item(self, node):
        node.replace(self.replace_nested, node.nested)
        return True

    def replace_nested(self, node):
        node.replace(self.replace_subnested, node.subnested)
        return True

    def replace_subnested(self, node):
        node.content = "yay..."

model = Model()
template.render(model)
