bdarcus / csln

Reimagining CSL
Mozilla Public License 2.0
12 stars 0 forks source link

use pattern-matching idea rather than conditional? #104

Open bdarcus opened 1 year ago

bdarcus commented 1 year ago

Don't know if this is a crazy idea, but writing it down just in case it's not.

Rather than adding a conditional to the template language, perhaps there's a way to implement an approach borrowed from the pattern-matching you see in different languages, and to keep it out of the template themselves?

Like, say:

match:
  type:
    book: ...
    article: ...
    default: ....

And maybe going further, allow this per-type at the top-level?

title:
  type:
    book: ...
    article: ...
    default: ....