curvenote / pubmatter

A typst library for parsing and showing publication frontmatter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Option to add extra fields

roaldarbol opened this issue · comments

Since pubmatter does rigid checks on fields, currently, to add extra fields (options) inside with frontmatter. Could we imagine an extra field options which can be user-defined and either escape checks or be checked according to their specifications inside template.yml?

The issue is that currently, if you add extra options, you also need to add the options separately in the custom template. Not a massive issue, but add adds some confusion if you think you're relying on pubmatter for all your input from template.yml.

E.g. say I want to add degree. Currently, the workflow is this:

  • In template.yml, add degree under options.
  • In template.typ, add degree after frontmatter.
  • In my-custom-template.typ, add degree after frontmatter.
  • In my-custom-template.typ, for use, reference it with degree.

If we could have options in pubmatter, it could look like this:

  • In template.yml, add degree under options.
  • In template.typ, add degree in frontmatter.
  • In my-custom-template.typ, for use, reference it with fm.degree (or fm.options.degree).

Another idea would be to create another class that handles loading of extra fields, e.g. load_custom so it makes checks according to rules based on input type rather than for specific input names.