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

Function yaml_emitter_write_comment

emitterc.go:1985–2020  ·  emitterc.go::yaml_emitter_write_comment
(emitter *yaml_emitter_t, comment []byte)

Source from the content-addressed store, hash-verified

1983}
1984
1985func yaml_emitter_write_comment(emitter *yaml_emitter_t, comment []byte) bool {
1986 breaks := false
1987 pound := false
1988 for i := 0; i < len(comment); {
1989 if is_break(comment, i) {
1990 if !write_break(emitter, comment, &i) {
1991 return false
1992 }
1993 //emitter.indention = true
1994 breaks = true
1995 pound = false
1996 } else {
1997 if breaks && !yaml_emitter_write_indent(emitter) {
1998 return false
1999 }
2000 if !pound {
2001 if comment[i] != '#' && (!put(emitter, '#') || !put(emitter, ' ')) {
2002 return false
2003 }
2004 pound = true
2005 }
2006 if !write(emitter, comment, &i) {
2007 return false
2008 }
2009 emitter.indention = false
2010 breaks = false
2011 }
2012 }
2013 if !breaks && !put_break(emitter) {
2014 return false
2015 }
2016
2017 emitter.whitespace = true
2018 //emitter.indention = true
2019 return true
2020}

Calls 6

is_breakFunction · 0.85
write_breakFunction · 0.85
putFunction · 0.85
writeFunction · 0.85
put_breakFunction · 0.85

Tested by

no test coverage detected