From ac9256a91e453845878b6097f5149b6a2e5f981a Mon Sep 17 00:00:00 2001 From: Duologic Date: Mon, 1 Apr 2024 00:53:05 +0200 Subject: [PATCH] fix(string): spliEscape correctly when double escaped --- string.libsonnet | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/string.libsonnet b/string.libsonnet index 6655981..70cbf6c 100644 --- a/string.libsonnet +++ b/string.libsonnet @@ -26,9 +26,25 @@ local d = import 'github.com/jsonnet-libs/docsonnet/doc-util/main.libsonnet'; splitEscape(str, c, escape='\\'): std.map( function(i) - std.strReplace(i, BelRune, escape + c), + std.strReplace( + std.strReplace( + i, + escape + BelRune, + escape, + ), + BelRune, + escape + c + ), std.split( - std.strReplace(str, escape + c, BelRune), + std.strReplace( + std.strReplace( + str, + escape, + escape + BelRune, + ), + escape + c, + BelRune + ), c, ) ),