From dadc3a24ee4f7c2bf2cb0670aa7be4573ae6b471 Mon Sep 17 00:00:00 2001 From: Pavlos Rontidis Date: Mon, 25 Sep 2023 20:01:38 -0400 Subject: [PATCH] document truncate --- .../reference/remap/functions/truncate.cue | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/website/cue/reference/remap/functions/truncate.cue b/website/cue/reference/remap/functions/truncate.cue index c0961b9ef74499..179e8bf173c554 100644 --- a/website/cue/reference/remap/functions/truncate.cue +++ b/website/cue/reference/remap/functions/truncate.cue @@ -22,8 +22,18 @@ remap: functions: truncate: { { name: "ellipsis" description: """ - An ellipsis (`...`) is appended if this is set to `true` _and_ the `value` string ends up being - truncated because it's exceeded the `limit`. + This argument is depracted. An ellipsis (`...`) is appended if this is set to `true` _and_ the `value` string + ends up being truncated because it's exceeded the `limit`. + """ + de + required: true + type: ["boolean"] + }, + { + name: "suffix" + description: """ + A custom suffix (`...`) will be appended to truncated strings. + This is ignored if "ellipsis" is set to true for backwards compatibility. """ required: true type: ["boolean"] @@ -46,5 +56,12 @@ remap: functions: truncate: { """# return: "A rather lo..." }, + { + title: "Truncate a string" + source: #""" + truncate("A rather long sentence.", limit: 11, suffix: "[TRUNCATED]") + """# + return: "A rather lo[TRUNCATED]" + }, ] }