-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Conversation
btw, is there a nicer way to write |
I'm not sure what you're trying to do, but does it help to look at the
source code for readWithM?
Mauro Bieg <[email protected]> writes:
… 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...
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#4604 (comment)
|
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. |
Is this waiting for the next release or something? |
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 |
@quasicomputational agreed. I can make the rebase and doc changes if @jgm will then merge this... |
closes jgm#1960 API change: Text.Pandoc.Readers.Markdown exports now `yamlToMeta`
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
Looks good! |
So starting with what pandoc version is `--metadata-file` available? Not working with 2.2.1...
See the changelog.
|
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