jam-schema / jams

Journal Article Metadata Schema
Creative Commons Zero v1.0 Universal
32 stars 5 forks source link

A YAML example using anchors #13

Closed hubgit closed 3 years ago

hubgit commented 3 years ago

I like to use anchors to identify authors, so that they can be referenced from other metadata sections without having to repeat anything:

e.g. https://github.com/hubgit/mdx-paper-example/blob/master/metadata.yml

jcolomb commented 3 years ago

That is interesting, can we use it for affilitation, how would it be translated in jats format ?

crsh commented 3 years ago

Interesting. What's the difference between an anchor and the id?

hubgit commented 3 years ago

Interesting. What's the difference between an anchor and the id?

An anchor (&) is a YAML feature that's used to identify nodes so that they can be included by reference using an alias (*).

https://yaml.org/spec/1.2/spec.html#id2785586

nathanlesage commented 3 years ago

Gosh, pointers! Question would be: Is this really helpful for our purposes?

tarleb commented 3 years ago

To me it's important to keep in mind. I wouldn't want to require users to learn these YAML features, but I also wouldn't want to make it impossible to use them. But that's up to tooling and thus a different story.

I think the example has great value because it shows how we need to link different parts of the metadata tree. For pandoc-scholar we used an 'id' field, but a numerical author index would work just as well.

jcolomb commented 3 years ago

Should we the go for anchor + id like in the example, for authors and for affiliation ?

nathanlesage commented 3 years ago

I agree that these pointers/anchors could be useful, but I don't think that we ourselves need to bother with them, as – if I don't overlook a giant elephant in the room – they wouldn't interfere with a standard (e.g., if I understand them correctly, you can either define a property ONCE and reference it everywhere, or copy all its data to all places where we need it). Hence, I think keeping this in mind is good for keeping the code DRY, but apart from that I don't think we need to spend particular focus on it. Or did I miss something obvious here?

jcolomb commented 3 years ago

19 link for later browsing. I am closing this as we will not use anchors in the standard or pandoc work, but may use it in any other integration of the standard.