@@ -158,7 +158,7 @@ export class GluaApiWriter {
158158 if ( ! this . writtenLibraryGlobals . has ( page . name ) ) {
159159 let api = '' ;
160160
161- api += page . description ? `${ putCommentBeforeEachLine ( page . description , false ) } \n` : '' ;
161+ api += page . description ? `${ putCommentBeforeEachLine ( page . description . trim ( ) , false ) } \n` : '' ;
162162
163163 if ( page . deprecated )
164164 api += `---@deprecated ${ removeNewlines ( page . deprecated ) } \n` ;
@@ -232,9 +232,8 @@ export class GluaApiWriter {
232232
233233 api += `---@enum ${ _enum . name } \n` ;
234234
235- if ( isContainedInTable )
236- {
237- api += _enum . description ? `${ putCommentBeforeEachLine ( _enum . description , false ) } \n` : '' ;
235+ if ( isContainedInTable ) {
236+ api += _enum . description ? `${ putCommentBeforeEachLine ( _enum . description . trim ( ) , false ) } \n` : '' ;
238237 api += `${ _enum . name } = {\n` ;
239238 }
240239
@@ -243,7 +242,7 @@ export class GluaApiWriter {
243242 key = key . split ( '.' ) [ 1 ] ;
244243 api += ` ${ key } = ${ item . value } , ` + ( item . description ? `--[[ ${ item . description } ]]` : '' ) + '\n' ;
245244 } else {
246- api += item . description ? `${ putCommentBeforeEachLine ( item . description , false ) } \n` : '' ;
245+ api += item . description ? `${ putCommentBeforeEachLine ( item . description . trim ( ) , false ) } \n` : '' ;
247246 if ( item . deprecated )
248247 api += `---@deprecated ${ removeNewlines ( item . deprecated ) } \n` ;
249248 api += `${ key } = ${ item . value } \n` ;
@@ -278,7 +277,7 @@ export class GluaApiWriter {
278277 if ( field . deprecated )
279278 api += `---@deprecated ${ removeNewlines ( field . deprecated ) } \n` ;
280279
281- api += `---${ removeNewlines ( field . description ) . replace ( / \s + / g , ' ' ) } \n` ;
280+ api += `---${ putCommentBeforeEachLine ( field . description . trim ( ) ) } \n` ;
282281
283282 const type = this . transformType ( field . type , field . callback ) ;
284283 api += `---@type ${ type } \n` ;
@@ -372,13 +371,13 @@ export class GluaApiWriter {
372371 let types = this . transformType ( arg . type , arg . callback ) ;
373372 if ( arg . altType ) types += "|" + this . transformType ( arg . altType ) ;
374373
375- luaDocComment += `---@param ${ GluaApiWriter . safeName ( arg . name ) } ${ arg . default !== undefined ? `?` : '' } ${ types } ${ putCommentBeforeEachLine ( arg . description ! ) } \n` ;
374+ luaDocComment += `---@param ${ GluaApiWriter . safeName ( arg . name ) } ${ arg . default !== undefined ? `?` : '' } ${ types } ${ putCommentBeforeEachLine ( arg . description ! . trimEnd ( ) ) } \n` ;
376375 } ) ;
377376 }
378377
379378 if ( func . returns ) {
380379 func . returns . forEach ( ret => {
381- const description = removeNewlines ( ret . description ?? '' ) ;
380+ const description = putCommentBeforeEachLine ( ret . description ! . trimEnd ( ) ) ;
382381
383382 luaDocComment += `---@return ` ;
384383
0 commit comments