pub fn unescape_markers(literal: &str) -> Cow<'_, str>
Expand description
Unescapes escaped interpolation sequence ($${
) and directive control flow (%%{
) start
markers in a string literal to ${
and %{
respectively.
use hcl_primitives::template::unescape_markers;
assert_eq!(unescape_markers("foo"), "foo");
assert_eq!(unescape_markers("${interpolation}"), "${interpolation}");
assert_eq!(unescape_markers("$${escaped_interpolation}"), "${escaped_interpolation}");
assert_eq!(unescape_markers("$$${escaped_interpolation}"), "$${escaped_interpolation}");
assert_eq!(unescape_markers("%{if foo}bar%{else}baz%{endif}"), "%{if foo}bar%{else}baz%{endif}");