Skip to content

Instantly share code, notes, and snippets.

@perlpunk
Last active January 11, 2018 17:10
Show Gist options
  • Save perlpunk/3418e7072229b23fc7a55381c1c6f0b6 to your computer and use it in GitHub Desktop.
Save perlpunk/3418e7072229b23fc7a55381c1c6f0b6 to your computer and use it in GitHub Desktop.
# 1.-3.: the resulting tag of a merged list or mapping will be the tag of the first item of the !!merge
--- # 1. set object tag in defaults
default-article: !article &defaults
foo: bar
theme: default-theme
article: !!merge
- *defaults
- theme: my-cool-theme
author: myself
--- # 2. without aliases
article: !article
author: myself
foo: bar
theme: my-cool-theme
--- # 3. set object tag with first item of the !!merge
default: &defaults
foo: bar
theme: default-theme
article: !!merge
- !article {}
- *defaults
- author: myself
theme: my-cool-theme
--- # 4. object tag does not come from aliases, but from the first non-aliased item
default: &defaults
foo: bar
theme: default-theme
article: !!merge
- *defaults
- !article
author: myself
theme: my-cool-theme
--- # 5. the first item, if a string, turns into the tagname (plus !)
article: !!merge
- article
- *defaults
- author: myself
theme: my-cool-theme
--- # 6. the first item, if a string, is the tagname
article: !!merge
- "!article"
- *defaults
- author: myself
theme: my-cool-theme
--- # 7. like 4
default: &defaults
foo: bar
theme: default-theme
article: !!merge
- *defaults
- !!perl/hash:Article
author: myself
theme: my-cool-theme
@ingydotnet
Copy link

Maybe something like this:

article: !!merge
- article
- *defaults
- author: myself
  theme: my-cool-theme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment