# Path: flatland/out/generic.py
# class Context(object):
#     """A stacked key/value mapping."""
# 
#     def __init__(self):
#         self._frames = [dict(_default_context)]
# 
#     def push(self, **options):
#         # for this size dict & usage pattern, copying turns out to be cheaper
#         # than directing __getitem__ down through a stack of sparse frames.
#         self._frames.append(self._frames[-1].copy())
#         try:
#             self.update(**options)
#         except KeyError:
#             self.pop()
#             raise
# 
#     def pop(self):
#         if len(self._frames) == 1:
#             raise RuntimeError("Can not pop() the base context frame.")
#         self._frames.pop()
# 
#     def __getitem__(self, key):
#         return self._frames[-1][key]
# 
#     def __setitem__(self, key, value):
#         if key not in self:
#             raise KeyError("%r not permitted in this %s" % (
#                 key, self.__class__.__name__))
#         self._frames[-1][key] = value
# 
#     def __contains__(self, key):
#         return key in self._frames[-1]
# 
#     def update(self, *iterable, **kwargs):
#         if len(iterable):
#             if len(iterable) > 1:
#                 raise TypeError(
#                     "update expected at most 1 arguments, got %s" % (
#                     len(iterable)))
#             source = to_pairs(iterable[0])
#             for key, value in source:
#                 self[key] = value
#         for key, value in kwargs.iteritems():
#             self[key.decode('ascii')] = value
# 
#     def __repr__(self):
#         return "%s(%r)" % (self.__class__.__name__, self._frames[-1])
# 
# def transform(tagname, attributes, contents, context, bind):
#     """Transform tag *attributes* in-place & return transformed *contents*"""
#     for fn in _transforms:
#         contents = fn(tagname, attributes, contents, context, bind)
#     return contents


from collections import defaultdict
from flatland.out.generic import Context, transform
from flatland.out.util import parse_trool



_default_options = {u'ordered_attributes': True}
_static_attribute_order = [u'type', u'name', u'value']


class Generator(Context):

    def __init__(self, markup='xhtml', **options):

# Path: flatland/out/generic.py
# class Context(object):
#     """A stacked key/value mapping."""
# 
#     def __init__(self):
#         self._frames = [dict(_default_context)]
# 
#     def push(self, **options):
#         # for this size dict & usage pattern, copying turns out to be cheaper
#         # than directing __getitem__ down through a stack of sparse frames.
#         self._frames.append(self._frames[-1].copy())
#         try:
#             self.update(**options)
#         except KeyError:
#             self.pop()
#             raise
# 
#     def pop(self):
#         if len(self._frames) == 1:
#             raise RuntimeError("Can not pop() the base context frame.")
#         self._frames.pop()
# 
#     def __getitem__(self, key):
#         return self._frames[-1][key]
# 
#     def __setitem__(self, key, value):
#         if key not in self:
#             raise KeyError("%r not permitted in this %s" % (
#                 key, self.__class__.__name__))
#         self._frames[-1][key] = value
# 
#     def __contains__(self, key):
#         return key in self._frames[-1]
# 
#     def update(self, *iterable, **kwargs):
#         if len(iterable):
#             if len(iterable) > 1:
#                 raise TypeError(
#                     "update expected at most 1 arguments, got %s" % (
#                     len(iterable)))
#             source = to_pairs(iterable[0])
#             for key, value in source:
#                 self[key] = value
#         for key, value in kwargs.iteritems():
#             self[key.decode('ascii')] = value
# 
#     def __repr__(self):
#         return "%s(%r)" % (self.__class__.__name__, self._frames[-1])
# 
# def transform(tagname, attributes, contents, context, bind):
#     """Transform tag *attributes* in-place & return transformed *contents*"""
#     for fn in _transforms:
#         contents = fn(tagname, attributes, contents, context, bind)
#     return contents


# Path: flatland/out/markup.py
from collections import defaultdict
from flatland.out.generic import Context, transform
from flatland.out.util import parse_trool




_default_options = {u'ordered_attributes': True}
_static_attribute_order = [u'type', u'name', u'value']


class Generator(Context):

    def __init__(self, markup='xhtml', **options):

        Context.__init__(self)