frontmatter/__init__.py
def load(fd, encoding='utf-8', handler=None, **defaults):
    """
    Load and parse a file-like object or filename, 
    return a :py:class:`post <frontmatter.Post>`.

    ::

        >>> post = frontmatter.load('tests/hello-world.markdown')
        >>> with open('tests/hello-world.markdown') as f:
        ...     post = frontmatter.load(f)

    """
    if hasattr(fd, 'read'):
        text = fd.read()

    else:
        with codecs.open(fd, 'r', encoding) as f:
            text = f.read()

    handler = handler or detect_format(text, handlers)
    return loads(text, encoding, handler, **defaults)
def load(fd, encoding='utf-8', handler=None, **defaults):
    """
    Load and parse a file-like object or filename, 
    return a :py:class:`post <frontmatter.Post>`.

    ::

        >>> post = frontmatter.load('tests/hello-world.markdown')
        >>> with open('tests/hello-world.markdown') as f:
        ...     post = frontmatter.load(f)

    """
    if hasattr(fd, 'read'):
        text = fd.read()

    else:
        with codecs.open(fd, 'r', encoding) as f:
            text = f.read()

    handler = handler or detect_format(text, handlers)
    return loads(text, encoding, handler, **defaults)
Load and parse a file-like object or filename, 
    return a :py:class:`post <frontmatter.Post>`.

    ::

        >>> post = frontmatter.load('tests/hello-world.markdown')
        >>> with open('tests/hello-world.markdown') as f:
        ...     post = frontmatter.load(f)