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

Introduce --metadata-file option #4604

Merged
merged 6 commits into from
Sep 15, 2018
Merged

Introduce --metadata-file option #4604

merged 6 commits into from
Sep 15, 2018

Conversation

mb21
Copy link
Collaborator

@mb21 mb21 commented Apr 27, 2018

implements #1960 and solves #3115

I finally got this compiling... still need to do some testing (especially around whether metadata from different sources has the right precedences) and write docs.

But feel free to play around with it!

Also: since YAML is a superset of JSON, you can actually already use this with --metadata-file file.json

@mb21
Copy link
Collaborator Author

mb21 commented Apr 27, 2018

btw, is there a nicer way to write readWithM parser def "" ? Doesn't really make sense to parse the empty input, but I somehow need to get rid of the parser stack...

@jgm
Copy link
Owner

jgm commented Apr 27, 2018 via email

@mb21
Copy link
Collaborator Author

mb21 commented May 2, 2018

Okay, I think this is good to merge... but would certainly appreciate a good look at it: there is quite some refactoring of old YAML parsing code, so I hope I didn't break anything inadvertently.

@mb21 mb21 changed the title WIP: introduce --metadata-file option Introduce --metadata-file option May 2, 2018
@jtaylor100
Copy link

jtaylor100 commented Jul 8, 2018

Is this waiting for the next release or something?

@quasicomputational
Copy link
Contributor

The conflicts are legitimate since the HsYAML switch-over a few days ago. But I think this PR is easy to adapt: the over-ride behaviour is correct inside Markdown files, and the one change I'd make is to explicitly document that in-band metadata (i.e., from within the document itself) over-rides out-of-band metadata (i.e., from --metadata-file).

@mb21
Copy link
Collaborator Author

mb21 commented Jul 9, 2018

@quasicomputational agreed. I can make the rebase and doc changes if @jgm will then merge this...

@mb21
Copy link
Collaborator Author

mb21 commented Sep 15, 2018

Okay, I redid this after rebasing from master. This time with lots more incremental commits.


: Read metadata from the supplied YAML (or JSON) file.
This option can be used with every input format, but string
scalars in the YAML file will always be parsed as Markdown.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also in a JSON file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, since YAML is a superset of JSON and we don't check the file extension, we get that for free!

@jgm jgm merged commit 6bd8037 into jgm:master Sep 15, 2018
@jgm
Copy link
Owner

jgm commented Sep 15, 2018

Looks good!

@mb21 mb21 deleted the yaml-file branch January 19, 2019 09:49
@jgm
Copy link
Owner

jgm commented Mar 18, 2019 via email

Repository owner deleted a comment from mb21 Mar 19, 2019
@jtaylor100
Copy link

@mb21 and @jgm Thanks! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants