Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

supplement(parser): reason for looping and searching for tags in the function isEnd is #231

Merged
merged 5 commits into from
Jan 8, 2024

Conversation

shoma-mano
Copy link
Contributor

@shoma-mano shoma-mano commented Jan 7, 2024

resolve #213
I couldn't find clear reason for loop, so this tip is just things ubugeeei said in discord mostly.

Copy link
Owner

@Ubugeeei Ubugeeei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shoma-mano

Great explain!

Could you update book/src/en to be the same? 😄

Comment on lines 286 to 301
```typescript
function isEnd(context: ParserContext, ancestors: ElementNode[]): boolean {
const s = context.source;

// sが"</"で始まり、かつその後にancestorsのタグ名が続くことを判定し、閉じタグがあるか(parseChildrenが終了するべきか)を判定します。
if (startsWith(s, "</")) {
for (let i = ancestors.length - 1; i >= 0; --i) {
if (startsWithEndTagOpen(s, ancestors[i].tag)) {
return true;
}
}
}

return !s;
}
```
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove semi-colons and double quotes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure my change that removes semi-colons and double quotes is ok, but I removed them anyway.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! This is fine.
I made a comprehensive commit regarding this format issue yesterday, but it seems like it hasn't been reflected in your branch. (Please sync it.)

@Ubugeeei Ubugeeei marked this pull request as draft January 7, 2024 16:25
@shoma-mano shoma-mano changed the title other: #51 add tip for isEnd function loop supplement(parser): reason for looping and searching for tags in the function isEnd is Jan 8, 2024
@Ubugeeei Ubugeeei marked this pull request as ready for review January 8, 2024 04:04
@Ubugeeei Ubugeeei merged commit d4613ee into Ubugeeei:main Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

supplement(parser): reason for looping and searching for tags in the function isEnd is
2 participants