internal/encoding/yaml: use cue/literal to quote string scalars
The YAML decoder had a function to wrap literal.Quote to use the
multi-line """ form when the string had any newlines.
It turns out that cue/literal can already do this via the option
Form.WithOptionalTabIndent, which enables an "auto" multi-line mode
to use the """ form when any newlines are present.
While here, I noticed an optimization in our use of strings.Repeat
which has already been done upstream for Go 1.23.
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: Iba3b9bafb0b434001173db82718b30d1e1b680ef
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1193240
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>