python-frontmatter 0.4.1__tar.gz → 0.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python-frontmatter-0.4.1 → Library/Python/2.7/site-packages}/frontmatter/__init__.py +9 -5
- Library/Python/2.7/site-packages/frontmatter/__init__.pyc +0 -0
- Library/Python/2.7/site-packages/frontmatter/default_handlers.pyc +0 -0
- Library/Python/2.7/site-packages/frontmatter/util.pyc +0 -0
- {python-frontmatter-0.4.1/python_frontmatter.egg-info → Library/Python/2.7/site-packages/python_frontmatter-0.4.3-py2.7.egg-info}/PKG-INFO +3 -2
- python-frontmatter-0.4.1/LICENSE +0 -21
- python-frontmatter-0.4.1/MANIFEST.in +0 -6
- python-frontmatter-0.4.1/PKG-INFO +0 -111
- python-frontmatter-0.4.1/README.md +0 -90
- python-frontmatter-0.4.1/setup.cfg +0 -5
- python-frontmatter-0.4.1/setup.py +0 -50
- python-frontmatter-0.4.1/tests/chinese.txt +0 -5
- python-frontmatter-0.4.1/tests/empty-frontmatter.txt +0 -4
- python-frontmatter-0.4.1/tests/extra-dash.txt +0 -6
- python-frontmatter-0.4.1/tests/hello-json.markdown +0 -18
- python-frontmatter-0.4.1/tests/hello-markdown.markdown +0 -18
- python-frontmatter-0.4.1/tests/hello-toml.markdown +0 -18
- python-frontmatter-0.4.1/tests/hello-world.markdown +0 -6
- python-frontmatter-0.4.1/tests/network-diagrams.markdown +0 -12
- python-frontmatter-0.4.1/tests/no-frontmatter.txt +0 -1
- python-frontmatter-0.4.1/tests/unpretty.md +0 -21
- {python-frontmatter-0.4.1 → Library/Python/2.7/site-packages}/frontmatter/default_handlers.py +0 -0
- {python-frontmatter-0.4.1 → Library/Python/2.7/site-packages}/frontmatter/util.py +0 -0
- {python-frontmatter-0.4.1/python_frontmatter.egg-info → Library/Python/2.7/site-packages/python_frontmatter-0.4.3-py2.7.egg-info}/SOURCES.txt +0 -0
- {python-frontmatter-0.4.1/python_frontmatter.egg-info → Library/Python/2.7/site-packages/python_frontmatter-0.4.3-py2.7.egg-info}/dependency_links.txt +0 -0
- {python-frontmatter-0.4.1/python_frontmatter.egg-info → Library/Python/2.7/site-packages/python_frontmatter-0.4.3-py2.7.egg-info}/not-zip-safe +0 -0
- {python-frontmatter-0.4.1/python_frontmatter.egg-info → Library/Python/2.7/site-packages/python_frontmatter-0.4.3-py2.7.egg-info}/requires.txt +0 -0
- {python-frontmatter-0.4.1/python_frontmatter.egg-info → Library/Python/2.7/site-packages/python_frontmatter-0.4.3-py2.7.egg-info}/top_level.txt +0 -0
|
@@ -137,8 +137,8 @@ def dump(post, fd, encoding='utf-8', handler=None, **kwargs):
|
|
|
137
137
|
|
|
138
138
|
::
|
|
139
139
|
|
|
140
|
-
>>> from io import
|
|
141
|
-
>>> f =
|
|
140
|
+
>>> from io import BytesIO
|
|
141
|
+
>>> f = BytesIO()
|
|
142
142
|
>>> frontmatter.dump(post, f)
|
|
143
143
|
>>> print(f.getvalue())
|
|
144
144
|
---
|
|
@@ -150,9 +150,9 @@ def dump(post, fd, encoding='utf-8', handler=None, **kwargs):
|
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
"""
|
|
153
|
-
content = dumps(post, handler, **kwargs)
|
|
153
|
+
content = dumps(post, handler, **kwargs)
|
|
154
154
|
if hasattr(fd, 'write'):
|
|
155
|
-
fd.write(content)
|
|
155
|
+
fd.write(content.encode(encoding))
|
|
156
156
|
|
|
157
157
|
else:
|
|
158
158
|
with codecs.open(fd, 'w', encoding) as f:
|
|
@@ -209,7 +209,11 @@ class Post(object):
|
|
|
209
209
|
|
|
210
210
|
def __getitem__(self, name):
|
|
211
211
|
"Get metadata key"
|
|
212
|
-
return self.metadata[name]
|
|
212
|
+
return self.metadata[name]
|
|
213
|
+
|
|
214
|
+
def __contains__(self, item):
|
|
215
|
+
"Check metadata contains key"
|
|
216
|
+
return item in self.metadata
|
|
213
217
|
|
|
214
218
|
def __setitem__(self, name, value):
|
|
215
219
|
"Set a metadata key"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.1
|
|
2
2
|
Name: python-frontmatter
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: Parse and manage posts with YAML frontmatter
|
|
5
5
|
Home-page: https://github.com/eyeseast/python-frontmatter
|
|
6
6
|
Author: Chris Amico
|
|
@@ -104,8 +104,9 @@ Classifier: Intended Audience :: Developers
|
|
|
104
104
|
Classifier: License :: OSI Approved :: MIT License
|
|
105
105
|
Classifier: Natural Language :: English
|
|
106
106
|
Classifier: Programming Language :: Python :: 2
|
|
107
|
-
Classifier: Programming Language :: Python :: 2.6
|
|
108
107
|
Classifier: Programming Language :: Python :: 2.7
|
|
109
108
|
Classifier: Programming Language :: Python :: 3
|
|
110
109
|
Classifier: Programming Language :: Python :: 3.3
|
|
111
110
|
Classifier: Programming Language :: Python :: 3.4
|
|
111
|
+
Classifier: Programming Language :: Python :: 3.5
|
|
112
|
+
Classifier: Programming Language :: Python :: 3.6
|
python-frontmatter-0.4.1/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2016 Chris Amico, Glass Eye Media LLC
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 1.1
|
|
2
|
-
Name: python-frontmatter
|
|
3
|
-
Version: 0.4.1
|
|
4
|
-
Summary: Parse and manage posts with YAML frontmatter
|
|
5
|
-
Home-page: https://github.com/eyeseast/python-frontmatter
|
|
6
|
-
Author: Chris Amico
|
|
7
|
-
Author-email: eyeseast@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Description: Python Frontmatter
|
|
10
|
-
==================
|
|
11
|
-
|
|
12
|
-
[Jekyll](http://jekyllrb.com/)-style YAML front matter offers a useful way to add arbitrary, structured metadata to text documents, regardless of type.
|
|
13
|
-
|
|
14
|
-
This is a small package to load and parse files (or just text) with YAML front matter.
|
|
15
|
-
|
|
16
|
-
[](https://travis-ci.org/eyeseast/python-frontmatter)
|
|
17
|
-
|
|
18
|
-
Install:
|
|
19
|
-
--------
|
|
20
|
-
|
|
21
|
-
pip install python-frontmatter
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Usage:
|
|
25
|
-
------
|
|
26
|
-
|
|
27
|
-
>>> import frontmatter
|
|
28
|
-
|
|
29
|
-
Load a post from a filename:
|
|
30
|
-
|
|
31
|
-
>>> post = frontmatter.load('tests/hello-world.markdown')
|
|
32
|
-
|
|
33
|
-
Or a file (or file-like object):
|
|
34
|
-
|
|
35
|
-
>>> with open('tests/hello-world.markdown') as f:
|
|
36
|
-
... post = frontmatter.load(f)
|
|
37
|
-
|
|
38
|
-
Or load from text:
|
|
39
|
-
|
|
40
|
-
>>> with open('tests/hello-world.markdown') as f:
|
|
41
|
-
... post = frontmatter.loads(f.read())
|
|
42
|
-
|
|
43
|
-
Access content:
|
|
44
|
-
|
|
45
|
-
>>> print(post.content)
|
|
46
|
-
Well, hello there, world.
|
|
47
|
-
|
|
48
|
-
# this works, too
|
|
49
|
-
>>> print(post)
|
|
50
|
-
Well, hello there, world.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
Use metadata (metadata gets proxied as post keys):
|
|
54
|
-
|
|
55
|
-
>>> print(post['title'])
|
|
56
|
-
Hello, world!
|
|
57
|
-
|
|
58
|
-
Metadata is a dictionary, with some handy proxies:
|
|
59
|
-
|
|
60
|
-
>>> sorted(post.keys())
|
|
61
|
-
['layout', 'title']
|
|
62
|
-
|
|
63
|
-
>>> from pprint import pprint
|
|
64
|
-
>>> post['excerpt'] = 'tl;dr'
|
|
65
|
-
>>> pprint(post.metadata)
|
|
66
|
-
{'excerpt': 'tl;dr', 'layout': 'post', 'title': 'Hello, world!'}
|
|
67
|
-
|
|
68
|
-
If you don't need the whole post object, just parse:
|
|
69
|
-
|
|
70
|
-
>>> with open('tests/hello-world.markdown') as f:
|
|
71
|
-
... metadata, content = frontmatter.parse(f.read())
|
|
72
|
-
>>> print(metadata['title'])
|
|
73
|
-
Hello, world!
|
|
74
|
-
|
|
75
|
-
Write back to plain text, too:
|
|
76
|
-
|
|
77
|
-
>>> print(frontmatter.dumps(post)) # doctest: +NORMALIZE_WHITESPACE
|
|
78
|
-
---
|
|
79
|
-
excerpt: tl;dr
|
|
80
|
-
layout: post
|
|
81
|
-
title: Hello, world!
|
|
82
|
-
---
|
|
83
|
-
Well, hello there, world.
|
|
84
|
-
|
|
85
|
-
Or write to a file (or file-like object):
|
|
86
|
-
|
|
87
|
-
>>> from io import BytesIO
|
|
88
|
-
>>> f = BytesIO()
|
|
89
|
-
>>> frontmatter.dump(post, f)
|
|
90
|
-
>>> print(f.getvalue().decode('utf-8')) # doctest: +NORMALIZE_WHITESPACE
|
|
91
|
-
---
|
|
92
|
-
excerpt: tl;dr
|
|
93
|
-
layout: post
|
|
94
|
-
title: Hello, world!
|
|
95
|
-
---
|
|
96
|
-
Well, hello there, world.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
Keywords: frontmatter
|
|
101
|
-
Platform: UNKNOWN
|
|
102
|
-
Classifier: Development Status :: 4 - Beta
|
|
103
|
-
Classifier: Intended Audience :: Developers
|
|
104
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
105
|
-
Classifier: Natural Language :: English
|
|
106
|
-
Classifier: Programming Language :: Python :: 2
|
|
107
|
-
Classifier: Programming Language :: Python :: 2.6
|
|
108
|
-
Classifier: Programming Language :: Python :: 2.7
|
|
109
|
-
Classifier: Programming Language :: Python :: 3
|
|
110
|
-
Classifier: Programming Language :: Python :: 3.3
|
|
111
|
-
Classifier: Programming Language :: Python :: 3.4
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
Python Frontmatter
|
|
2
|
-
==================
|
|
3
|
-
|
|
4
|
-
[Jekyll](http://jekyllrb.com/)-style YAML front matter offers a useful way to add arbitrary, structured metadata to text documents, regardless of type.
|
|
5
|
-
|
|
6
|
-
This is a small package to load and parse files (or just text) with YAML front matter.
|
|
7
|
-
|
|
8
|
-
[](https://travis-ci.org/eyeseast/python-frontmatter)
|
|
9
|
-
|
|
10
|
-
Install:
|
|
11
|
-
--------
|
|
12
|
-
|
|
13
|
-
pip install python-frontmatter
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Usage:
|
|
17
|
-
------
|
|
18
|
-
|
|
19
|
-
>>> import frontmatter
|
|
20
|
-
|
|
21
|
-
Load a post from a filename:
|
|
22
|
-
|
|
23
|
-
>>> post = frontmatter.load('tests/hello-world.markdown')
|
|
24
|
-
|
|
25
|
-
Or a file (or file-like object):
|
|
26
|
-
|
|
27
|
-
>>> with open('tests/hello-world.markdown') as f:
|
|
28
|
-
... post = frontmatter.load(f)
|
|
29
|
-
|
|
30
|
-
Or load from text:
|
|
31
|
-
|
|
32
|
-
>>> with open('tests/hello-world.markdown') as f:
|
|
33
|
-
... post = frontmatter.loads(f.read())
|
|
34
|
-
|
|
35
|
-
Access content:
|
|
36
|
-
|
|
37
|
-
>>> print(post.content)
|
|
38
|
-
Well, hello there, world.
|
|
39
|
-
|
|
40
|
-
# this works, too
|
|
41
|
-
>>> print(post)
|
|
42
|
-
Well, hello there, world.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Use metadata (metadata gets proxied as post keys):
|
|
46
|
-
|
|
47
|
-
>>> print(post['title'])
|
|
48
|
-
Hello, world!
|
|
49
|
-
|
|
50
|
-
Metadata is a dictionary, with some handy proxies:
|
|
51
|
-
|
|
52
|
-
>>> sorted(post.keys())
|
|
53
|
-
['layout', 'title']
|
|
54
|
-
|
|
55
|
-
>>> from pprint import pprint
|
|
56
|
-
>>> post['excerpt'] = 'tl;dr'
|
|
57
|
-
>>> pprint(post.metadata)
|
|
58
|
-
{'excerpt': 'tl;dr', 'layout': 'post', 'title': 'Hello, world!'}
|
|
59
|
-
|
|
60
|
-
If you don't need the whole post object, just parse:
|
|
61
|
-
|
|
62
|
-
>>> with open('tests/hello-world.markdown') as f:
|
|
63
|
-
... metadata, content = frontmatter.parse(f.read())
|
|
64
|
-
>>> print(metadata['title'])
|
|
65
|
-
Hello, world!
|
|
66
|
-
|
|
67
|
-
Write back to plain text, too:
|
|
68
|
-
|
|
69
|
-
>>> print(frontmatter.dumps(post)) # doctest: +NORMALIZE_WHITESPACE
|
|
70
|
-
---
|
|
71
|
-
excerpt: tl;dr
|
|
72
|
-
layout: post
|
|
73
|
-
title: Hello, world!
|
|
74
|
-
---
|
|
75
|
-
Well, hello there, world.
|
|
76
|
-
|
|
77
|
-
Or write to a file (or file-like object):
|
|
78
|
-
|
|
79
|
-
>>> from io import BytesIO
|
|
80
|
-
>>> f = BytesIO()
|
|
81
|
-
>>> frontmatter.dump(post, f)
|
|
82
|
-
>>> print(f.getvalue().decode('utf-8')) # doctest: +NORMALIZE_WHITESPACE
|
|
83
|
-
---
|
|
84
|
-
excerpt: tl;dr
|
|
85
|
-
layout: post
|
|
86
|
-
title: Hello, world!
|
|
87
|
-
---
|
|
88
|
-
Well, hello there, world.
|
|
89
|
-
|
|
90
|
-
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
try:
|
|
5
|
-
from setuptools import setup
|
|
6
|
-
except ImportError:
|
|
7
|
-
from distutils.core import setup
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
with open('README.md') as f:
|
|
11
|
-
readme = f.read()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
requirements = [
|
|
15
|
-
'PyYAML',
|
|
16
|
-
'six'
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
VERSION = '0.4.1'
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
setup(
|
|
24
|
-
name = 'python-frontmatter',
|
|
25
|
-
version = VERSION,
|
|
26
|
-
description = 'Parse and manage posts with YAML frontmatter',
|
|
27
|
-
long_description = readme,
|
|
28
|
-
author = 'Chris Amico',
|
|
29
|
-
author_email = 'eyeseast@gmail.com',
|
|
30
|
-
url = 'https://github.com/eyeseast/python-frontmatter',
|
|
31
|
-
packages = ['frontmatter'],
|
|
32
|
-
include_package_data = True,
|
|
33
|
-
install_requires = requirements,
|
|
34
|
-
license = 'MIT',
|
|
35
|
-
zip_safe = False,
|
|
36
|
-
keywords = 'frontmatter',
|
|
37
|
-
classifiers=[
|
|
38
|
-
'Development Status :: 4 - Beta',
|
|
39
|
-
'Intended Audience :: Developers',
|
|
40
|
-
'License :: OSI Approved :: MIT License',
|
|
41
|
-
'Natural Language :: English',
|
|
42
|
-
'Programming Language :: Python :: 2',
|
|
43
|
-
'Programming Language :: Python :: 2.6',
|
|
44
|
-
'Programming Language :: Python :: 2.7',
|
|
45
|
-
'Programming Language :: Python :: 3',
|
|
46
|
-
'Programming Language :: Python :: 3.3',
|
|
47
|
-
'Programming Language :: Python :: 3.4',
|
|
48
|
-
],
|
|
49
|
-
test_suite='test',
|
|
50
|
-
)
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "TODO: Understand Network Diagrams"
|
|
3
|
-
layout: post
|
|
4
|
-
published: true
|
|
5
|
-
tags: [todo]
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
Kim Rees, sitting in for Nathan Yau at [Flowing Data](http://flowingdata.com), has been posting examples of [network diagrams](http://flowingdata.com/category/visualization/network-visualization/) lately. I have to confess I'm stumped by most of them them. Or maybe I'm just overwhelmed. Maybe I'm [not alone](http://flowingdata.com/2012/05/28/network-diagrams-simplified/):
|
|
9
|
-
|
|
10
|
-
> Network diagrams are notoriously messy. Even a small number of nodes can be overwhelmed by their chaotic placement and relationships. [Cody Dunne](http://www.cs.umd.edu/~cdunne/) of [HCIL](http://www.cs.umd.edu/hcil/) showed off [his new work in simplifying these complex structures](http://www.cs.umd.edu/localphp/hcil/tech-reports-search.php?number=2012-11). In essence, he aggregates leaf nodes into a fan glyph that describes the underlying data in its size, arc, and color. Span nodes are similarly captured into crescent glyphs. The result is an easy to read, high level look at the network. You can easily compare different sections of the network, understand areas that may have been occluded by the lines in a traditional diagram, and see relationships far more quickly.
|
|
11
|
-
|
|
12
|
-
This seems like the kind of thing that could be useful for news, where we're often trying to understand and illustrate complex relationships. I'll have to find a good dataset to play with.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
I have no frontmatter.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
destination:
|
|
3
|
-
encoding:
|
|
4
|
-
xz:
|
|
5
|
-
enabled: true
|
|
6
|
-
min_size: 5120
|
|
7
|
-
options:
|
|
8
|
-
path_filter:
|
|
9
|
-
result:
|
|
10
|
-
append_to_file:
|
|
11
|
-
append_to_lafs_dir:
|
|
12
|
-
print_to_stdout: true
|
|
13
|
-
url: http://localhost:3456/uri
|
|
14
|
-
filter:
|
|
15
|
-
- 'Длинный стринг на русском'
|
|
16
|
-
- 'Еще одна длинная строка'
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
This is a test of both unicode and prettier dumping. The above metadata comes from the [pretty-yaml](https://github.com/mk-fg/pretty-yaml) readme file.
|
|
20
|
-
|
|
21
|
-
Metadata should be dumped in order.
|
{python-frontmatter-0.4.1 → Library/Python/2.7/site-packages}/frontmatter/default_handlers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|