Skip to content

Commit 11fcb0e

Browse files
Fix
Fixed a bug that in some cases the text comment might not be read.
1 parent 1456f55 commit 11fcb0e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

elementOfHtml.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,13 @@ export class ElementOfHtml {
162162
let position = declType.toLowerCase().replace('@', '')
163163
let text = decl.comment
164164
// Pulling text only for a specific position
165-
.match(new RegExp(`(?<=${position}).*? (?=@|$)`, 's'))[0]
166-
// Removing mandatory spaces at the beginning and at the end
167-
.slice(1, -1)
165+
.match(new RegExp(`(?<=${position}).*?(?=@|$)`, 's'))[0]
166+
167+
// Removing spaces necessary for readability of a comment
168+
if (text.at(0) == ' ')
169+
text = text.replace(' ', '')
170+
if (text.at(-1) == ' ')
171+
text = text.replace(/.$/, '')
168172

169173
switch (position) {
170174
case 'inside':

0 commit comments

Comments
 (0)