From 8b58052ef77c97f7c1c9a5acae054e79267cd986 Mon Sep 17 00:00:00 2001 From: Roman Tsisyk <roman@tsisyk.com> Date: Thu, 28 Aug 2014 14:58:00 +0400 Subject: [PATCH] YAML: use LITERAL style for multi-line strings --- third_party/lua-yaml/lyaml.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/third_party/lua-yaml/lyaml.cc b/third_party/lua-yaml/lyaml.cc index b94ab2a013..9a75fbfe66 100644 --- a/third_party/lua-yaml/lyaml.cc +++ b/third_party/lua-yaml/lyaml.cc @@ -665,6 +665,9 @@ dump_node(struct lua_yaml_dumper *dumper) } else if (lua_isnumber(dumper->L, -1)) { /* string is convertible to number, quote it to preserve type */ style = YAML_SINGLE_QUOTED_SCALAR_STYLE; + } else if (strchr(str, '\n') != NULL) { + /* use LITERAL style for multiline strings */ + style = YAML_LITERAL_SCALAR_STYLE; } strbreak: break; -- GitLab