Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ assembly_refs:
build_number: 0
revision_number: 0
resources:
- name: "\r\n"
- name: |


classes:
- fullname: "OctopusRPA.Csv.CsvHelper"
name: "CsvHelper"
Expand Down
22 changes: 17 additions & 5 deletions proto-yaml/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,11 +337,23 @@ impl<W: Write> Serializer<W> {
ReflectValueRef::F64(v) => write!(self.output, "{v:.1}")?,
ReflectValueRef::Bool(v) => write!(self.output, "{v}")?,
ReflectValueRef::String(v) => {
write!(
self.output,
"\"{}\"",
Self::escape(v).paint(self.colors.string)
)?;
if v.contains('\n') {
write!(self.output, "{}", "|".paint(self.colors.string))?;
for line in v.split('\n') {
self.newline()?;
write!(
self.output,
"{}",
line.paint(self.colors.string)
)?;
}
} else {
write!(
self.output,
"\"{}\"",
Self::escape(v).paint(self.colors.string)
)?;
}
}
ReflectValueRef::Bytes(v) => {
write!(
Expand Down
8 changes: 6 additions & 2 deletions proto-yaml/src/tests/testdata/1.out
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ int32_dec: 123
str: "foo"
repeated_msg:
- int32_dec: 456
str: "bar\nbar"
str: |
bar
bar
- int32_dec: 789
str: "foo\\bar"
map_string_string:
"foo\nbar": "bar"
nested_msg:
int32_dec: 1234
str: "qux\nfoo"
str: |
qux
foo
map_string_string:
"bar": "baz"
"foo": "bar"
Loading