From b99bbb5ee6d4b8c311afb00eaaa67c193ca0c4ef Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 20 Apr 2022 08:22:09 +0200 Subject: docs: fix lost description texts (#836) --- scripts/apidoc/signature.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts index 704c4dad..154d1c72 100644 --- a/scripts/apidoc/signature.ts +++ b/scripts/apidoc/signature.ts @@ -301,14 +301,17 @@ function extractDefaultFromComment(comment?: Comment): string { if (!comment) { return; } - const text = comment.shortText; - if (!text || text.trim() === '') { + const text = comment.shortText?.trim(); + if (!text) { return; } - const result = /(.*)[ \n]Defaults to `([^`]+)`./.exec(text); + const result = /^(.*)[ \n]Defaults to `([^`]+)`\.(.*)$/s.exec(text); if (!result) { return; } + if (result[3].trim()) { + throw new Error(`Found description text after the default value:\n${text}`); + } comment.shortText = result[1]; return result[2]; } -- cgit v1.2.3