Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support YAML metadata (Issue #2801) #2802

Merged
merged 6 commits into from May 28, 2017

Conversation

@ralsina
Copy link
Member

ralsina commented May 28, 2017

First step in #2801 : Naïve support for YAML metadata.

  • Optional yaml import
  • Fail only if required by posts
  • Parse just like our traditional metadata
ralsina added 3 commits May 28, 2017
utils.req_missing('pyyaml', 'use YAML metadata', optional=True)
raise ValueError('Error parsing metadata')
idx = meta_data.index('---', 1)
meta = yaml.load('\n'.join(meta_data[1:idx]))

This comment has been minimized.

Copy link
@Kwpolska

Kwpolska May 28, 2017

Member

Always use yaml.safe_load.

This comment has been minimized.

Copy link
@ralsina

ralsina May 28, 2017

Author Member

Ok

ralsina added 3 commits May 28, 2017
Copy link
Member

Kwpolska left a comment

LGTM

@felixfontein

This comment has been minimized.

Copy link
Contributor

felixfontein commented May 28, 2017

Shouldn't you also adjust the split_metadata function in PageCompiler? The new YAML (and TOML?) metadata allows empty lines between starting and ending --- (resp. +++?).

@ralsina

This comment has been minimized.

Copy link
Member Author

ralsina commented May 28, 2017

@felixfontein that's why this is a naive implementation, I don't want to spend two days thinking of corner cases :-)

@ralsina ralsina merged commit 18a4c67 into master May 28, 2017
5 checks passed
5 checks passed
codacy/pr Good work! A positive pull request.
Details
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@ralsina ralsina deleted the yaml-metadata branch May 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.