昨天因为想复用国际化 i18n yml 中的一部分代码 于是 google 了一下 yaml 语法 发现 yaml 语法天生有'复用机制' 于是和大家分享一下
bill: &bill_share
number: 编号
total: 总额
deal_at: 交易日期
sale: *bill_share
purchase: *bill_share
sale:
number: 编号
total: 总额
deal_at: 交易日期
purchase:
number: 编号
total: 总额
deal_at: 交易日期
http://en.wikipedia.org/wiki/YAML
# sequencer protocols for Laser eye surgery
---
- step: &id001 # defines anchor label &id001
instrument: Lasik 2000
pulseEnergy: 5.4
pulseDuration: 12
repetition: 1000
spotSize: 1mm
- step: &id002
instrument: Lasik 2000
pulseEnergy: 5.0
pulseDuration: 10
repetition: 500
spotSize: 2mm
- step: *id001 # refers to the first step (with anchor &id001)
- step: *id002 # refers to the second step
- step: *id001
- step: *id002
http://en.wikipedia.org/wiki/YAML http://www.yaml.org/refcard.html http://www.yaml.org/spec/1.2/spec.html