Accessing meta data with filters #6655
-
Description@jimjam-slam and I are working on a custom format and I've run into a few questions about how to process custom meta data. As a running example, say you want to allow authors to specify the following custom options in the document yaml. ---
mykey: val1
--- 1. What is the best way to set the default values for custom yaml options? contributes:
format:
common:
mykey: 0 So far I've followed option one, but I don't like how squirreled away they are. And approach like option two might make it more transparent. Any other good approaches you could suggest? 2. Is it possible to use namespaces to re-use existing keys? ---
format:
myformat-html:
debug: true
--- and I was puzzled because execute:
debug: true I can change the name of my key to Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
These are all very good questions and I'm afraid I don't have sufficiently firm official answers to give!
|
Beta Was this translation helpful? Give feedback.
These are all very good questions and I'm afraid I don't have sufficiently firm official answers to give!
What is the best way to set the default values for custom yaml options?
One approach you might not have considered is to answer a slightly different question: where do you need these default values? Solve the problem there. So, for example, solve the problem by having a Lua object initializer that fills in the default values when they're missing. That's more or less what we do, except that the default values we get come from a variety of different places (sometimes we need to honor cell defaults, sometimes documents or projects), so we don't really have a uniform software solution. …