مرجع سريع

ورقة غش صياغة YAML

دليل مرجعي سريع لصياغة YAML: القواميس، القوائم، النصوص متعددة الأسطر، المرساة والأسماء المستعارة، ومفاتيح الدمج.

· تاريخ النشر

YAML (YAML Ain't Markup Language) هو معيار تسلسل بيانات سهل القراءة للبشر ومتوافق مع جميع لغات البرمجة.

القواميس والقوائم

# Comments begin with "#"
# Dictionaries are written as "key: value"
name: Martin D'vloper
languages:
  perl: Elite
  python: Elite
  pascal: Basic

# List items begin with "- "
foods:
  - Apple
  - Orange
  - Strawberry
  - Mango

# Booleans use lowercase
employed: true

السلاسل النصية متعددة الأسطر

# Literal Block Scalar (preserves newlines)
multiline_literal: |
  exactly as you see
  will appear these three
  lines of poetry
# Folded Block Scalar (folds newlines to spaces)
multiline_folded: >
  this is really a
  single line of text
  despite appearances

المراسي والوراثة (Anchors & Inheritance)

parent: &defaults
  a: 2
  b: 3

child:
  <<: *defaults
  b: 4

التسلسلات القابلة لإعادة الاستخدام

values: &ref
  - These values
  - will be reused below

other_values:
  <<: *ref

موضوعات ذات صلة