1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 10:18:38 +00:00
This commit is contained in:
techknowlogick
2021-02-28 18:08:33 -05:00
committed by GitHub
parent 030646eea4
commit 47f6a4ec3f
947 changed files with 26119 additions and 7062 deletions

34
vendor/gopkg.in/yaml.v3/emitterc.go generated vendored
View File

@@ -814,26 +814,24 @@ func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_
}
}
if len(emitter.key_line_comment) > 0 {
// [Go] A line comment was previously provided for the key. Handle it before
// the value so the inline comments are placed correctly.
if yaml_emitter_silent_nil_event(emitter, event) && len(emitter.line_comment) == 0 {
// Nothing other than the line comment will be written on the line.
emitter.line_comment = emitter.key_line_comment
emitter.key_line_comment = nil
} else {
// An actual value is coming, so emit the comment line.
// [Go] Line comments are generally associated with the value, but when there's
// no value on the same line as a mapping key they end up attached to the
// key itself.
if event.typ == yaml_SCALAR_EVENT {
if len(emitter.line_comment) == 0 {
// A scalar is coming and it has no line comments by itself yet,
// so just let it handle the line comment as usual. If it has a
// line comment, we can't have both so the one from the key is lost.
emitter.line_comment = emitter.key_line_comment
emitter.key_line_comment = nil
}
} else if event.sequence_style() != yaml_FLOW_SEQUENCE_STYLE && (event.typ == yaml_MAPPING_START_EVENT || event.typ == yaml_SEQUENCE_START_EVENT) {
// An indented block follows, so write the comment right now.
emitter.line_comment, emitter.key_line_comment = emitter.key_line_comment, emitter.line_comment
if !yaml_emitter_process_line_comment(emitter) {
return false
}
emitter.line_comment, emitter.key_line_comment = emitter.key_line_comment, emitter.line_comment
// Indent in unless it's a block that will reindent anyway.
if event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE || (event.typ != yaml_MAPPING_START_EVENT && event.typ != yaml_SEQUENCE_START_EVENT) {
emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent)
if !yaml_emitter_write_indent(emitter) {
return false
}
}
}
}
emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE)
@@ -1896,7 +1894,7 @@ func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bo
if !yaml_emitter_write_block_scalar_hints(emitter, value) {
return false
}
if !put_break(emitter) {
if !yaml_emitter_process_line_comment(emitter) {
return false
}
//emitter.indention = true
@@ -1933,10 +1931,10 @@ func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) boo
if !yaml_emitter_write_block_scalar_hints(emitter, value) {
return false
}
if !put_break(emitter) {
if !yaml_emitter_process_line_comment(emitter) {
return false
}
//emitter.indention = true
emitter.whitespace = true