From e4a5a3f2db5656aa7381f9f9edcd24a48a22f0ee Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Thu, 29 Sep 2022 03:27:26 -0700 Subject: [PATCH] Scripting: Fix value docstrings with newlines --- src/script/docgen.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/script/docgen.c b/src/script/docgen.c index b088b7c96..55d12eedc 100644 --- a/src/script/docgen.c +++ b/src/script/docgen.c @@ -301,7 +301,12 @@ void explainValueScoped(struct mScriptValue* value, const char* name, const char } } if (docstring) { - fprintf(out, "%scomment: \"%s\"\n", indent, docstring); + if (strchr(docstring, '\n')) { + fprintf(out, "%scomment: |-\n", indent); + printchomp(docstring, level + 1); + } else { + fprintf(out, "%scomment: \"%s\"\n", indent, docstring); + } } switch (value->type->base) {