fix inline tags being tokenized as blocks

This commit is contained in:
evilchili committed 2026-10-21 12:30:24 -07:00
1 parent 0df3677579
commit 928cb87fa7
6 files changed
+13 -5

No files matched your search

+1 -1
View File
@@ -144,7 +144,7 @@ class TagCollection {
}
}
getByName(name) {
return this.tags.filter(t => t.constructor.name == name)[0] || undefined;
return this.tags.filter(t => { return t.constructor.name == name; })[0] || undefined;
}
getByElementName(element) {
const el = element.toUpperCase();
+4 -1
View File
@@ -63,7 +63,7 @@ class Tokenizer {
const flushText = () => {
if (textBuffer.length > 0) {
tokens.push({
role: 'block',
role: 'text',
value: textBuffer,
});
textBuffer = '';
@@ -189,6 +189,9 @@ class Tokenizer {
&& (charAfter === undefined || PUNCTUATION.has(charAfter) || charAfter === '\n');
const role = leftFlanking ? 'open' : rightFlanking ? 'close' : 'block';
var token = tag.tokenize(role, sequence, source);
if (role == 'block' && !tag.isBlock) {
continue;
}
if (token) {
return token;
}
+1 -1
View File
@@ -1,4 +1,4 @@
export type TokenRole = 'open' | 'close' | 'block';
export type TokenRole = 'open' | 'close' | 'block' | 'text';
export interface Token {
role: TokenRole;
value: string;