MCPcopy
hub / github.com/go-yaml/yaml / yaml_emitter_increase_indent

Function yaml_emitter_increase_indent

emitterc.go:229–248  ·  view source on GitHub ↗

Increase the indentation level.

(emitter *yaml_emitter_t, flow, indentless bool)

Source from the content-addressed store, hash-verified

227
228// Increase the indentation level.
229func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool) bool {
230 emitter.indents = append(emitter.indents, emitter.indent)
231 if emitter.indent < 0 {
232 if flow {
233 emitter.indent = emitter.best_indent
234 } else {
235 emitter.indent = 0
236 }
237 } else if !indentless {
238 // [Go] This was changed so that indentations are more regular.
239 if emitter.states[len(emitter.states)-1] == yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE {
240 // The first indent inside a sequence will just skip the "- " indicator.
241 emitter.indent += 2
242 } else {
243 // Everything else aligns to the chosen indentation.
244 emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent)
245 }
246 }
247 return true
248}
249
250// State dispatcher.
251func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_event_t) bool {

Calls

no outgoing calls

Tested by

no test coverage detected