# Path: panflute/elements.py
# class Div(Block):
#     """Generic block container with attributes
# 
#     :param args: contents of the div
#     :type args: :class:`Block`
#     :param identifier: element identifier (usually unique)
#     :type identifier: :class:`str`
#     :param classes: class names of the element
#     :type classes: :class:`list` of :class:`str`
#     :param attributes: additional attributes
#     :type attributes: :class:`dict`
#     :Base: :class:`Block`
#      """
# 
#     __slots__ = ['_content', 'identifier', 'classes', 'attributes']
#     _children = ['content']
# 
#     def __init__(self, *args, identifier='', classes=[], attributes={}):
#         self._set_ica(identifier, classes, attributes)
#         self._set_content(args, Block)
# 
#     def _slots_to_json(self):
#         return [self._ica_to_json(), self.content.to_json()]
# 
# class RawBlock(Block):
#     """
#     Raw block
# 
#     :param text: a string of raw text with another underlying format
#     :type text: :class:`str`
#     :param format: Format of the raw text ('html', 'tex', 'latex', 'context', etc.)
#     :type format: ``str``
#     :Base: :class:`Block`
#      """
# 
#     __slots__ = ['text', 'format']
# 
#     def __init__(self, text, format='html'):
#         self.text = check_type(text, str)
#         self.format = check_group(format, RAW_FORMATS)
# 
#     def _slots_to_json(self):
#         return [self.format, self.text]
# 
# 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 Div, RawBlock, toJSONFilter
#!/usr/bin/env python

"""
Pandoc filter to convert divs with class="theorem" to LaTeX
theorem environments in LaTeX output, and to numbered theorems
in HTML output.
"""


def prepare(doc):
    doc.theoremcount = 0

def theorems(e, doc):

# Path: panflute/elements.py
# class Div(Block):
#     """Generic block container with attributes
# 
#     :param args: contents of the div
#     :type args: :class:`Block`
#     :param identifier: element identifier (usually unique)
#     :type identifier: :class:`str`
#     :param classes: class names of the element
#     :type classes: :class:`list` of :class:`str`
#     :param attributes: additional attributes
#     :type attributes: :class:`dict`
#     :Base: :class:`Block`
#      """
# 
#     __slots__ = ['_content', 'identifier', 'classes', 'attributes']
#     _children = ['content']
# 
#     def __init__(self, *args, identifier='', classes=[], attributes={}):
#         self._set_ica(identifier, classes, attributes)
#         self._set_content(args, Block)
# 
#     def _slots_to_json(self):
#         return [self._ica_to_json(), self.content.to_json()]
# 
# class RawBlock(Block):
#     """
#     Raw block
# 
#     :param text: a string of raw text with another underlying format
#     :type text: :class:`str`
#     :param format: Format of the raw text ('html', 'tex', 'latex', 'context', etc.)
#     :type format: ``str``
#     :Base: :class:`Block`
#      """
# 
#     __slots__ = ['text', 'format']
# 
#     def __init__(self, text, format='html'):
#         self.text = check_type(text, str)
#         self.format = check_group(format, RAW_FORMATS)
# 
#     def _slots_to_json(self):
#         return [self.format, self.text]
# 
# 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/theorem.py
from panflute import Div, RawBlock, toJSONFilter

#!/usr/bin/env python

"""
Pandoc filter to convert divs with class="theorem" to LaTeX
theorem environments in LaTeX output, and to numbered theorems
in HTML output.
"""


def prepare(doc):
    doc.theoremcount = 0

def theorems(e, doc):

    if type(e) == Div and 'theorem' in e.classes: