msprev / panzer

pandoc + styles
BSD 3-Clause "New" or "Revised" License
160 stars 13 forks source link

Can't extend a style defined in a later YAML block #33

Closed na-sa-do closed 7 years ago

na-sa-do commented 7 years ago

Okay, I guess it's my... unusual workflow's fault that I haven't bothered to move the style to global. But still.

msprev commented 7 years ago

Is it that you can't extend a style defined inside the metadata of the document? This should be possible. Can you post a minimal example to show what is not working?

na-sa-do commented 7 years ago
---
style: Child
styledef:
    Child:
        parent: Parent
---

blah blah blah

---
styledef:
    Parent: {}
---
msprev commented 7 years ago

I see what is going on. The 2 yaml blocks are merged into one big block and the two styledef fields are colliding. One is overriding the other so you only have 1 style defined. If you put the definition of the child and the definition of the parent under the same styledef field it will work.

Merging multiple yaml blocks in a source document into one big yaml block is pandoc behaviour (merges using left biased union). Panzer is consistent with this to avoid confusion (in fact it uses pandoc to parse yaml).