# Path: panflute/elements.py
# class Str(Inline):
#     """
#     Text (a string)
# 
#     :param text: a string of unformatted text
#     :type text: :class:`str`
#     :Base: :class:`Inline`
#      """
# 
#     __slots__ = ['text']
# 
#     def __init__(self, text):
#         self.text = check_type(text, str)
# 
#     def __repr__(self):
#         return 'Str({})'.format(self.text)
# 
#     def _slots_to_json(self):
#         return self.text
# 
# class Emph(Inline):
#     """Emphasized text
# 
#     :param args: elements that will be emphasized
#     :type args: :class:`Inline`
#     :Base: :class:`Inline`
#      """
#     __slots__ = ['_content']
#     _children = ['content']
# 
#     def __init__(self, *args):
#         self._set_content(args, Inline)
# 
#     def _slots_to_json(self):
#         return self.content.to_json()
# 
# Path: panflute/io.py
# def toJSONFilter(*args, **kwargs):
#     """
#     Wrapper for :func:`.run_filter`, which calls :func:`.run_filters`
# 
#     toJSONFilter(action, prepare=None, finalize=None, input_stream=None, output_stream=None, \*\*kwargs)
#     Receive a Pandoc document from stdin, apply the *action* function to each element, and write it back to stdout.
# 
#     See also :func:`.toJSONFilters`
#     """
#     return run_filter(*args, **kwargs)


from panflute import toJSONFilter, Emph, Str
from caps import caps
#!/usr/bin/env python

"""
Pandoc filter that causes emphasized text to be displayed
in ALL CAPS.
"""



def deemph(elem, doc):
    if type(elem) == Emph:
        # Make Str elements in Emph uppercase
        elem.walk(caps)

        # Append them to Emph's parent (after the emph)
        for i, item in enumerate(elem.content, elem.index + 1):
            elem.parent.content.insert(i, item)

        # Delete the emph
        return []


if __name__ == "__main__":

# Path: panflute/elements.py
# class Str(Inline):
#     """
#     Text (a string)
# 
#     :param text: a string of unformatted text
#     :type text: :class:`str`
#     :Base: :class:`Inline`
#      """
# 
#     __slots__ = ['text']
# 
#     def __init__(self, text):
#         self.text = check_type(text, str)
# 
#     def __repr__(self):
#         return 'Str({})'.format(self.text)
# 
#     def _slots_to_json(self):
#         return self.text
# 
# class Emph(Inline):
#     """Emphasized text
# 
#     :param args: elements that will be emphasized
#     :type args: :class:`Inline`
#     :Base: :class:`Inline`
#      """
#     __slots__ = ['_content']
#     _children = ['content']
# 
#     def __init__(self, *args):
#         self._set_content(args, Inline)
# 
#     def _slots_to_json(self):
#         return self.content.to_json()
# 
# Path: panflute/io.py
# def toJSONFilter(*args, **kwargs):
#     """
#     Wrapper for :func:`.run_filter`, which calls :func:`.run_filters`
# 
#     toJSONFilter(action, prepare=None, finalize=None, input_stream=None, output_stream=None, \*\*kwargs)
#     Receive a Pandoc document from stdin, apply the *action* function to each element, and write it back to stdout.
# 
#     See also :func:`.toJSONFilters`
#     """
#     return run_filter(*args, **kwargs)


# Path: examples/panflute/deemph.py
from panflute import toJSONFilter, Emph, Str
from caps import caps

#!/usr/bin/env python

"""
Pandoc filter that causes emphasized text to be displayed
in ALL CAPS.
"""



def deemph(elem, doc):
    if type(elem) == Emph:
        # Make Str elements in Emph uppercase
        elem.walk(caps)

        # Append them to Emph's parent (after the emph)
        for i, item in enumerate(elem.content, elem.index + 1):
            elem.parent.content.insert(i, item)

        # Delete the emph
        return []


if __name__ == "__main__":

    toJSONFilter(deemph)