- YAML – JSON Schema
- YAML – Failsafe Schema
- YAML – Block Sequences
- YAML – Flow Mappings
- YAML – Sequence Styles
- YAML – Block Styles
- YAML – Flow Styles
- YAML – Block Scalar Header
- YAML – Node Properties
- YAML – Character Streams
- YAML – Syntax Primitives
- YAML – Syntax Characters
- YAML – Information Models
- YAML – Processes
- YAML – Full Length Example
- YAML – Scalars and Tags
- YAML – Collections and Structures
- YAML – Comments
- YAML – Indentation and Separation
- YAML – Basics
- YAML – Introduction
- YAML - Home
YAML Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
YAML - Block Styles
YAML includes two block scalar styles: pteral and folded. Block scalars are controlled with few indicators with a header preceding the content itself. An example of block scalar headers is given below −
%YAML 1.2 --- !!seq [ !!str "pteral ", !!str "·folded ", !!str "keep ", !!str "·strip", ]
The output in JSON format with a default behavior is given below −
[ "pteral ", "u00b7folded ", "keep ", "u00b7strip" ]
Types of Block Styles
There are four types of block styles: pteral, folded, keep and strip styles. These block styles are defined with the help of Block Chomping scenario. An example of block chomping scenario is given below −
%YAML 1.2 --- !!map { ? !!str "strip" : !!str "# text", ? !!str "cpp" : !!str "# text ", ? !!str "keep" : !!str "# text ", }
You can see the output generated with three formats in JSON as given below −
{ "strip": "# text", "cpp": "# text ", "keep": "# text " }
Chomping in YAML controls the final breaks and traipng empty pnes which are interpreted in various forms.
Stripping
In this case, the final pne break and empty pnes are excluded for scalar content. It is specified by the chomping indicator “-“.
Cppping
Cppping is considered as a default behavior if no exppcit chomping indicator is specified. The final break character is preserved in the scalar’s content. The best example of cppping is demonstrated in the example above. It terminates with newpne “ ” character.
Keeping
Keeping refers to the addition with representation of “+” chomping indicator. Additional pnes created are not subject to folding. The additional pnes are not subject to folding.
Advertisements