Metadata-Version: 1.0
Name: python-frontmatter
Version: 0.1.4
Summary: Parse and manage posts with YAML frontmatter
Home-page: https://github.com/eyeseast/python-frontmatter
Author: Chris Amico
Author-email: eyeseast@gmail.com
License: MIT
Description: Python Frontmatter
        ==================
        
        [Jekyll](http://jekyllrb.com/)-style YAML front matter offers a useful way to add arbitrary, structured metadata to text documents, regardless of type.
        
        This is a small package to load and parse files (or just text) with YAML front matter.
        
        [![Build Status](https://travis-ci.org/eyeseast/python-frontmatter.svg?branch=master)](https://travis-ci.org/eyeseast/python-frontmatter)
        
        Usage:
        ------
        
            >>> import frontmatter
        
        Load a post from a filename:
        
            >>> post = frontmatter.load('tests/hello-world.markdown')
        
        Or a file (or file-like object):
        
            >>> with open('tests/hello-world.markdown') as f:
            ...     post = frontmatter.load(f)
        
        Or load from text:
        
            >>> with open('tests/hello-world.markdown') as f:
            ...     post = frontmatter.loads(f.read())
        
        Access content:
        
            >>> print(post.content)
            Well, hello there, world.
        
        Use metadata (metadata gets proxied as post keys):
        
            >>> print(post['title'])
            Hello, world!
        
        Metadata is a dictionary, with some handy proxies:
        
            >>> sorted(post.keys())
            ['layout', 'title']
        
            >>> from pprint import pprint
            >>> post['excerpt'] = 'tl;dr'
            >>> pprint(post.metadata)
            {'excerpt': 'tl;dr', 'layout': 'post', 'title': 'Hello, world!'}
        
        If you don't need the whole post object, just parse:
        
            >>> with open('tests/hello-world.markdown') as f:
            ...     metadata, content = frontmatter.parse(f.read())
            >>> print(metadata['title'])
            Hello, world!
        
        Write back to plain text, too:
        
            >>> print(frontmatter.dumps(post)) # doctest: +NORMALIZE_WHITESPACE
            ---
            excerpt: tl;dr
            layout: post
            title: Hello, world!
            ---
            Well, hello there, world.
        
        Or write to a file (or file-like object):
        
            >>> from io import StringIO
            >>> f = StringIO()
            >>> frontmatter.dump(post, f)
            >>> print(f.getvalue()) # doctest: +NORMALIZE_WHITESPACE
            ---
            excerpt: tl;dr
            layout: post
            title: Hello, world!
            ---
            Well, hello there, world.
        
        
        
Keywords: frontmatter
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
