I'm new in using yaml files, and after searched in the web I didn't found a solution yet.
I generate a yaml files and I want to make some indentations like this examples:
My currrent output:
fields:
- name: tx_trig
description: Indicates the start of Tx when the PRT timer expires
position: [0, 0]
type: logic
default: 0
- name: end_of_line
description: End of line
position: [1, 1]
type: logic
default: 0
- name: paramup
description: Parameter update
position: [2, 2]
type: logic
default: 0
My desire output (indent white spaces before a field node, and blank row after a node:
fields:
- name: tx_trig
description: Indicates the start of Tx when the PRT timer expires
position: [0, 0]
type: logic
default: 0
- name: end_of_line
description: End of line
position: [1, 1]
type: logic
default: 0
- name: paramup
description: Parameter update
position: [2, 2]
type: logic
default: 0
Here is a part of the generating code of the yaml file:
YamlSequenceNode fieldsSequence = new YamlSequenceNode();
foreach (Field field in register.Fields)
{
var fieldNode = new YamlMappingNode();
fieldNode.Add("name", field.Name);
fieldNode.Add("description", field.Description);
fieldNode.Add("position", field.Position);
fieldNode.Add("type", field.type.ToString());
fieldNode.Add("default", field.DefaultValue);
fieldsSequence.Add(fieldNode);
}
registerNode.Add("fields", fieldsSequence);
Thanks for any help.