mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-10 08:35:42 +00:00
Allow special characters in Lua prefix and suffix
--lua-suffix='});^M' didn't work, so taking this approach instead
This commit is contained in:
parent
c4de13e874
commit
03560a3d84
@ -57,7 +57,15 @@ func NewLuaEncoder(prefs LuaPreferences) Encoder {
|
||||
"\\", "\\\\",
|
||||
"\177", "\\127",
|
||||
)
|
||||
return &luaEncoder{prefs.DocPrefix, prefs.DocSuffix, prefs.UnquotedKeys, escape}
|
||||
unescape := strings.NewReplacer(
|
||||
"\\'", "'",
|
||||
"\\\"", "\"",
|
||||
"\\n", "\n",
|
||||
"\\r", "\r",
|
||||
"\\t", "\t",
|
||||
"\\\\", "\\",
|
||||
)
|
||||
return &luaEncoder{unescape.Replace(prefs.DocPrefix), unescape.Replace(prefs.DocSuffix), prefs.UnquotedKeys, escape}
|
||||
}
|
||||
|
||||
func (le *luaEncoder) PrintDocumentSeparator(writer io.Writer) error {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user